New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix FreeBSD build issues #1074
Fix FreeBSD build issues #1074
Conversation
We carefully check for various operating system include guards to ensure that we include either the OS header or our own. This works fine if the OS header is included first, but if we include our own first and then the OS header we run into duplicate definitions. This fixes part of the build issues caused by recent FreeBSD including <net/bpf.h> from <net/if_pflog.h>.
New FreeBSD versions includes <net/bpf.h> from <net/if_pflog.h>, and indirectly include <net/dlt.h>. The FreeBSD version lacks DLT_IEEE802_15_4_TAP, so we really want to use our own version.
Fix build issues since if_pflog.h added a net/bpf.h include Obtained from: the-tcpdump-group/libpcap#1074 Sponsored by: Rubicon Communications, LLC ("Netgate")
|
The change that did that was: Note that what Wireshark is doing wrong is bothering to even try to dissect Note: any file format or packet format that includes a (THIS is why, when somebody proposes a new So why did this change have to include net/bpf.h? |
|
(See also the-tcpdump-group/tcpdump#587.) |
|
6d4baa0d011cb3e78b4b08415568e71c0aab00fe includes net/bpf.h because it now uses BPF_WORDALIGN() in PFLOG_HDRLEN. |
Given that None of the data types in the structure are Thus, the only way in which the size and layout of the structure would differ between ILP32 and LP64 environments would be if it were to be aligned on a 32-bit boundary in an ILP32 environment and a 64-bit boundary in an LP64 environment, as that would require its size to be a multiple of 8 in an LP64 environment but only a multiple of 4 in an ILP32 environment. As long as 1) neither So:
Furthermore:
So I don't see that it's necessary. If there's still anything compiler-dependent or ILP32 vs. LP64-dependent about the structure, that needs to be fixed, so that all While we're at it, if there will ever be a reason why that structure might change, whether it's a structure member being added or removed, a structure member having its size change (including array-size changes), a change to the numerical values of If no changes to the numerical values in question, and all changes to the structure result in an increase in the structure size, the And, given that
how about, when we finally have a FreeBSD (Then we can work on handling the other versions, and ensuring that they don't require any more than one |
Don't rely on the OS's pflog include files to give the pflog header length; instead, fetch it from the length field of the header, and round up to a multiple of 4. That way, it'll handle headers for OSes other than the one for which we're compiling code, and will handle different header lengths for any given OS if, for example, a new version of the OS adds more fields to the end. Don't rely on the OS's pflog include files to define direction types, reason types, action types, or the layout of the header; instead, define them ourselves in a header of our own, with #ifs to select the ones that are only on some platforms. That way, it'll handle some fields and field values (the ones common to all OSes with pflog) on all OSes, even ones without pflog. This should also clean up the FreeBSD build issues reported in #1074, as we no longer include <net/if_pflog.h>.
Don't rely on the OS's pflog include files to give the pflog header length; instead, fetch it from the length field of the header, and round up to a multiple of 4. That way, it'll handle headers for OSes other than the one for which we're compiling code, and will handle different header lengths for any given OS if, for example, a new version of the OS adds more fields to the end. Don't rely on the OS's pflog include files to define direction types, reason types, action types, or the layout of the header; instead, define them ourselves in a header of our own, with #ifs to select the ones that are only on some platforms. That way, it'll handle some fields and field values (the ones common to all OSes with pflog) on all OSes, even ones without pflog. This should also clean up the FreeBSD build issues reported in #1074, as we no longer include <net/if_pflog.h>. (cherry picked from commit 2757ddc)
This is something caught in UNH FreeBSD env. For some reason [1], the pcap/bpf.h header started to define _BPF_H_. It happens that the bpf_impl.h internal DPDK header uses this define as an internal guard. This triggers a build failure in bpf_convert.c which can't find RTE_BPF_LOG macro. Fix the include guard to use the filename and remove _. 1: the-tcpdump-group/libpcap#1074 Fixes: 94972f3 ("bpf: add BPF loading and execution framework") Cc: stable@dpdk.org Signed-off-by: David Marchand <david.marchand@redhat.com> Signed-off-by: 0-day Robot <robot@bytheb.org>
This is something caught in UNH FreeBSD env. For some reason [1], the pcap/bpf.h header started to define _BPF_H_. It happens that the bpf_impl.h internal DPDK header uses this define as an internal guard. This triggers a build failure in bpf_convert.c which can't find RTE_BPF_LOG macro. Fix the include guard to use the filename and remove _. 1: the-tcpdump-group/libpcap#1074 Fixes: 94972f3 ("bpf: add BPF loading and execution framework") Cc: stable@dpdk.org Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
[ upstream commit 63f39a430a0a7a8b893ffbf88cd452dbc7b97c97 ] This is something caught in UNH FreeBSD env. For some reason [1], the pcap/bpf.h header started to define _BPF_H_. It happens that the bpf_impl.h internal DPDK header uses this define as an internal guard. This triggers a build failure in bpf_convert.c which can't find RTE_BPF_LOG macro. Fix the include guard to use the filename and remove _. 1: the-tcpdump-group/libpcap#1074 Fixes: 94972f3 ("bpf: add BPF loading and execution framework") Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
[ upstream commit 63f39a430a0a7a8b893ffbf88cd452dbc7b97c97 ] This is something caught in UNH FreeBSD env. For some reason [1], the pcap/bpf.h header started to define _BPF_H_. It happens that the bpf_impl.h internal DPDK header uses this define as an internal guard. This triggers a build failure in bpf_convert.c which can't find RTE_BPF_LOG macro. Fix the include guard to use the filename and remove _. 1: the-tcpdump-group/libpcap#1074 Fixes: 94972f3 ("bpf: add BPF loading and execution framework") Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
[ upstream commit 63f39a430a0a7a8b893ffbf88cd452dbc7b97c97 ] This is something caught in UNH FreeBSD env. For some reason [1], the pcap/bpf.h header started to define _BPF_H_. It happens that the bpf_impl.h internal DPDK header uses this define as an internal guard. This triggers a build failure in bpf_convert.c which can't find RTE_BPF_LOG macro. Fix the include guard to use the filename and remove _. 1: the-tcpdump-group/libpcap#1074 Fixes: 94972f3 ("bpf: add BPF loading and execution framework") Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
This is something caught in UNH FreeBSD env. For some reason [1], the pcap/bpf.h header started to define _BPF_H_. It happens that the bpf_impl.h internal DPDK header uses this define as an internal guard. This triggers a build failure in bpf_convert.c which can't find RTE_BPF_LOG macro. Fix the include guard to use the filename and remove _. 1: the-tcpdump-group/libpcap#1074 Fixes: 94972f3 ("bpf: add BPF loading and execution framework") Cc: stable@dpdk.org Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Don't rely on the OS's pflog include files to give the pflog header length; instead, fetch it from the length field of the header, and round up to a multiple of 4. That way, it'll handle headers for OSes other than the one for which we're compiling code, and will handle different header lengths for any given OS if, for example, a new version of the OS adds more fields to the end. Don't rely on the OS's pflog include files to define direction types, reason types, action types, or the layout of the header; instead, define them ourselves in a header of our own, with #ifs to select the ones that are only on some platforms. That way, it'll handle some fields and field values (the ones common to all OSes with pflog) on all OSes, even ones without pflog. This should also clean up the FreeBSD build issues reported in the-tcpdump-group#1074, as we no longer include <net/if_pflog.h>. (cherry picked from commit 2757ddc)
Recent FreeBSD versions started including <net/bpf.h> from <net/if_pflog.h>, which triggered two distinct build issues.