examples/multi_process: fix compilation error on FreeBSD

Message ID 1559725576-6427-1-git-send-email-david.marchand@redhat.com (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers
Series examples/multi_process: fix compilation error on FreeBSD |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation fail apply issues

Commit Message

David Marchand June 5, 2019, 9:06 a.m. UTC
  Caught on FreeBSD 12:

/usr/include/netinet/ip.h:71:17: error: field 'ip_src' has incomplete type
  struct in_addr ip_src,ip_dst; /* source and dest address */
                 ^~~~~~

POSIX defines netinet/in.h as the right header for in_addr.
Linux seems fine without it but let's include it explicitly.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 examples/multi_process/client_server_mp/mp_server/main.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Thomas Monjalon June 5, 2019, 9:25 a.m. UTC | #1
05/06/2019 11:06, David Marchand:
> Caught on FreeBSD 12:
> 
> /usr/include/netinet/ip.h:71:17: error: field 'ip_src' has incomplete type
>   struct in_addr ip_src,ip_dst; /* source and dest address */
>                  ^~~~~~
> 
> POSIX defines netinet/in.h as the right header for in_addr.
> Linux seems fine without it but let's include it explicitly.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Please could you add a "Fixes:" tag with Cc stable?
  
David Marchand June 5, 2019, 9:36 a.m. UTC | #2
On Wed, Jun 5, 2019 at 11:26 AM Thomas Monjalon <thomas@monjalon.net> wrote:

> 05/06/2019 11:06, David Marchand:
> > Caught on FreeBSD 12:
> >
> > /usr/include/netinet/ip.h:71:17: error: field 'ip_src' has incomplete
> type
> >   struct in_addr ip_src,ip_dst; /* source and dest address */
> >                  ^~~~~~
> >
> > POSIX defines netinet/in.h as the right header for in_addr.
> > Linux seems fine without it but let's include it explicitly.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
>
> Please could you add a "Fixes:" tag with Cc stable?
>

We did not build the examples before.
Not sure what to tag as the "culprit".
The one that adds FreeBSD support ?
  
Thomas Monjalon June 5, 2019, 9:52 a.m. UTC | #3
05/06/2019 11:36, David Marchand:
> On Wed, Jun 5, 2019 at 11:26 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> 
> > 05/06/2019 11:06, David Marchand:
> > > Caught on FreeBSD 12:
> > >
> > > /usr/include/netinet/ip.h:71:17: error: field 'ip_src' has incomplete
> > type
> > >   struct in_addr ip_src,ip_dst; /* source and dest address */
> > >                  ^~~~~~
> > >
> > > POSIX defines netinet/in.h as the right header for in_addr.
> > > Linux seems fine without it but let's include it explicitly.
> > >
> > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> >
> > Please could you add a "Fixes:" tag with Cc stable?
> >
> 
> We did not build the examples before.
> Not sure what to tag as the "culprit".
> The one that adds FreeBSD support ?

I was thinking about the patch using in_addr so we can have a meaningful backport.
  
David Marchand June 5, 2019, 10:32 a.m. UTC | #4
On Wed, Jun 5, 2019 at 11:52 AM Thomas Monjalon <thomas@monjalon.net> wrote:

> 05/06/2019 11:36, David Marchand:
> > On Wed, Jun 5, 2019 at 11:26 AM Thomas Monjalon <thomas@monjalon.net>
> wrote:
> >
> > > 05/06/2019 11:06, David Marchand:
> > > > Caught on FreeBSD 12:
> > > >
> > > > /usr/include/netinet/ip.h:71:17: error: field 'ip_src' has incomplete
> > > type
> > > >   struct in_addr ip_src,ip_dst; /* source and dest address */
> > > >                  ^~~~~~
> > > >
> > > > POSIX defines netinet/in.h as the right header for in_addr.
> > > > Linux seems fine without it but let's include it explicitly.
> > > >
> > > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > >
> > > Please could you add a "Fixes:" tag with Cc stable?
> > >
> >
> > We did not build the examples before.
> > Not sure what to tag as the "culprit".
> > The one that adds FreeBSD support ?
>
> I was thinking about the patch using in_addr so we can have a meaningful
> backport.
>

I can't find the reason why this header is included and it goes back to the
initial release.
Removed this header include with a 1.2.3r0 and it builds fine :-)
  

Patch

diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c
index 9a8e422..b1e8a8c 100644
--- a/examples/multi_process/client_server_mp/mp_server/main.c
+++ b/examples/multi_process/client_server_mp/mp_server/main.c
@@ -11,6 +11,7 @@ 
 #include <inttypes.h>
 #include <sys/queue.h>
 #include <errno.h>
+#include <netinet/in.h>
 #include <netinet/ip.h>
 #include <signal.h>