Bug 1966383 - glibc: Header file conflict between <netinet/in.h> and <linux/icmp.h> as the result of RFC 8335 PROBE support
Summary: glibc: Header file conflict between <netinet/in.h> and <linux/icmp.h> as the ...
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: glibc
Version: 9.0
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: beta
: ---
Assignee: glibc team
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-01 03:12 UTC by Chunyu Hu
Modified: 2023-07-18 14:29 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-25 23:57:32 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Chunyu Hu 2021-06-01 03:12:49 UTC
Description of problem:

When compiling trinity in latest rhel9, there's conflicts between netinet headers and linux-headers, which should be resolved, otherwise some use may be affected

Version-Release number of selected component (if applicable):
glibc-headers-2.33-13.el9.x86_64

rpm -qf /usr/include/linux/libc-compat.h 
kernel-headers-5.13.0-0.rc3.25.el9.x86_64

How reproducible:
always

Steps to Reproduce:
1. git clone https://github.com/kernelslacker/trinity.git
2. ./configure
3. make -j $(nproc)

Actual results:
conflicts showed, and compile broken:

  CC	net/proto-irda.o
In file included from include/net.h:5,
                 from net/proto-ip-raw.c:2:
/usr/include/netinet/in.h:31:8: error: redefinition of ‘struct in_addr’
   31 | struct in_addr
      |        ^~~~~~~
In file included from /usr/include/linux/icmp.h:23,
                 from net/proto-ip-raw.c:1:
/usr/include/linux/in.h:89:8: note: originally defined here
   89 | struct in_addr {
      |        ^~~~~~~
In file included from /usr/include/netinet/in.h:37,
                 from include/net.h:5,
                 from net/proto-ip-raw.c:2:
/usr/include/bits/in.h:150:8: error: redefinition of ‘struct ip_mreqn’
  150 | struct ip_mreqn
      |        ^~~~~~~~
In file included from /usr/include/linux/icmp.h:23,
                 from net/proto-ip-raw.c:1:
/usr/include/linux/in.h:178:8: note: originally defined here
  178 | struct ip_mreqn {
      |        ^~~~~~~~
In file included from /usr/include/netinet/in.h:37,
                 from include/net.h:5,
                 from net/proto-ip-raw.c:2:
/usr/include/bits/in.h:158:8: error: redefinition of ‘struct in_pktinfo’
  158 | struct in_pktinfo


Expected results:
UAPI

Additional info:

From /usr/include/linux/libc-compat.h :

 *
 * This fixes the situation where the linux headers are included *after* the
 * libc headers. To fix the problem with the inclusion in the other order the
 * userspace libc headers must be fixed like this:
 *
 * * For all definitions that conflict with kernel definitions wrap those
 *   defines in the following:
 *   #if !__UAPI_DEF_FOO
 *     ...
 *   #endif
 *
 * This prevents the redefinition of a construct already defined by the kernel.

Comment 2 Florian Weimer 2021-06-02 18:00:03 UTC
Reported upstream: https://lore.kernel.org/netdev/87im2wup0m.fsf@oldenburg.str.redhat.com/

Comment 4 Florian Weimer 2021-06-18 13:06:05 UTC
Upstream UAPI patch submission: https://lore.kernel.org/netdev/20210603212211.335237-1-andreas.a.roeseler@gmail.com/

Comment 5 Florian Weimer 2021-11-25 18:25:15 UTC
I see the kernel patch made it into the tree?

commit e32ea44c7ae476f4c90e35ab0a29dc8ff082bc11
Author: Andreas Roeseler <andreas.a.roeseler>
Date:   Thu Jun 3 16:22:11 2021 -0500

    icmp: fix lib conflict with trinity
    
    Including <linux/in.h> and <netinet/in.h> in the dependencies breaks
    compilation of trinity due to multiple definitions. <linux/in.h> is only
    used in <linux/icmp.h> to provide the definition of the struct in_addr,
    but this can be substituted out by using the datatype __be32.
    
    Signed-off-by: Andreas Roeseler <andreas.a.roeseler>
    Signed-off-by: David S. Miller <davem>

Chunyu Hu, may we close this bug? Thanks.

Comment 6 Chunyu Hu 2021-11-25 23:57:32 UTC
(In reply to Florian Weimer from comment #5)
> I see the kernel patch made it into the tree?
> 
> commit e32ea44c7ae476f4c90e35ab0a29dc8ff082bc11
> Author: Andreas Roeseler <andreas.a.roeseler>
> Date:   Thu Jun 3 16:22:11 2021 -0500
> 
>     icmp: fix lib conflict with trinity
>     
>     Including <linux/in.h> and <netinet/in.h> in the dependencies breaks
>     compilation of trinity due to multiple definitions. <linux/in.h> is only
>     used in <linux/icmp.h> to provide the definition of the struct in_addr,
>     but this can be substituted out by using the datatype __be32.
>     
>     Signed-off-by: Andreas Roeseler <andreas.a.roeseler>
>     Signed-off-by: David S. Miller <davem>
> 
> Chunyu Hu, may we close this bug? Thanks.

Thanks for info. Close this.


Note You need to log in before you can comment on or make changes to this bug.