Skip to content

configure.ac and cmake/ConfigureChecks.cmake's TX_RING probe has the same header collision src/common/txring.h had #1044

Description

@fklassen

Describe the bug

#1043 fixed `src/common/txring.h` to stop including `<netpacket/packet.h>` alongside `<linux/if_packet.h>` - before C23, the two headers can't be included together (both define `struct sockaddr_ll` and `struct packet_mreq`, and the `_UAPI_DEF*` de-duplication guards don't apply pre-C23):

```
linux/if_packet.h:14:8: error: redefinition of 'struct sockaddr_ll'
linux/if_packet.h:297:8: error: redefinition of 'struct packet_mreq'
```

That fix is real and necessary, but not sufficient on its own: both build systems' own `TX_RING` feature probes independently include both conflicting headers, so the probe itself fails to compile under `-std=gnu11`/`-std=gnu17` (verified directly - reproduces the identical redefinition errors) - meaning `HAVE_TX_RING` never gets defined in the first place on affected systems (the openSUSE/Fedora-style "older language level" case #1043 called out), and `txring.h`'s now-correct `#ifdef HAVE_TX_RING` block never even gets reached.

  • `configure.ac` (autotools), around line 1587:
    ```
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
    #include <sys/socket.h>
    #include <netpacket/packet.h>
    #include <net/ethernet.h>
    #include <netinet/in.h>
    #include <linux/if_packet.h>
    ]], [[
    int test;
    test = TP_STATUS_WRONG_FORMAT
    ]])],...
    ```
  • `cmake/ConfigureChecks.cmake`, the `HAVE_TX_RING` `check_c_source_compiles()` block:
    ```
    check_c_source_compiles("
    #include <sys/socket.h>
    #include <netpacket/packet.h>
    #include <net/ethernet.h>
    #include <netinet/in.h>
    #include <linux/if_packet.h>
    int main(void) { int test = TP_STATUS_WRONG_FORMAT; return test; }
    " HAVE_TX_RING)
    ```

Verified locally: with #1043's fix applied but neither probe touched, `Linux TX_RING:` still printed `no` on a system defaulting to `-std=gnu17` (GCC 14), for exactly this reason.

Proposed fix

Drop `<netpacket/packet.h>` from both TX_RING probe test programs (it supplies nothing the test needs - only `TP_STATUS_WRONG_FORMAT`, from `<linux/if_packet.h>`), matching the same fix already applied to `txring.h`. The separate `HAVE_PF_PACKET`/PF_PACKET probes, which only include `<netpacket/packet.h>` and never `<linux/if_packet.h>`, are unaffected and don't need changes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions