Re: [PATCH xtables] xtables-monitor: fix build with older glibc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Baruch Siach <baruch@xxxxxxxxxx> wrote:
> Hi Florian,
> 
> Florian Westphal writes:
> > Baruch Siach <baruch@xxxxxxxxxx> wrote:
> >> glibc older than 2.19 require _BSD_SOURCE to expose BSD style fields of
> >> struct tcphdr. Fix the following build failure:
> >>
> >> xtables-monitor.c: In function 'trace_print_packet':
> >> xtables-monitor.c:406:43: error: 'const struct tcphdr' has no member named 'th_sport'
> >>     printf("SPORT=%d DPORT=%d ", ntohs(tcph->th_sport), ntohs(tcph->th_dport));
> >>                                            ^
> >> xtables-monitor.c:406:66: error: 'const struct tcphdr' has no member named 'th_dport'
> >>     printf("SPORT=%d DPORT=%d ", ntohs(tcph->th_sport), ntohs(tcph->th_dport));
> >
> > Thanks for the patch, but this gives me:
> >
> >> +#define _BSD_SOURCE
> >
> > In file included from /usr/include/bits/libc-header-start.h:33:0, from /usr/include/stdlib.h:25,
> > from xtables-monitor.c:13: /usr/include/features.h:184:3:
> > # warning "_BSD_SOURCE and # _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
> >
> > build does complete though.
> > Does _DEFAULT_SOURCE work for older glibc as well?
> 
> It doesn't.

Figures...

> I guess that the alternative is to use the GNU names for
> tcphdr fields. That should work with any glibc version. Would you
> approve a patch doing that?

Sure, thanks a lot!



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux