Bug 895141 - header <linux/if_bridge.h> is not self-contained
Summary: header <linux/if_bridge.h> is not self-contained
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 949464 (view as bug list)
Depends On:
Blocks: 994265 1002735
TreeView+ depends on / blocked
 
Reported: 2013-01-14 17:10 UTC by Eric Blake
Modified: 2015-01-06 14:47 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1002735 (view as bug list)
Environment:
Last Closed: 2015-01-06 14:47:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Eric Blake 2013-01-14 17:10:56 UTC
Description of problem:
POSIX requires that standard headers should be self-contained.  While headers under the linux/ namespace are (obviously) not standardized, it is nicer if they abide by the same rules.  It is a pain to have to write applications that pre-include other headers before being able to use a kernel header.

Version-Release number of selected component (if applicable):
kernel-headers-3.8.0-0.rc3.git0.1.fc19.i686

How reproducible:
100%

Steps to Reproduce:
1. cat foo.c
2. gcc -c -Wall foo.c
3. gcc -c -Wall foo.c -DWORKAROUND
  
Actual results:
1.
#ifdef WORKAROUND
#include <netinet/ip6.h>
#endif
#include <linux/if_bridge.h>

2.
In file included from foo.c:4:0:
/usr/include/linux/if_bridge.h:172:20: error: field ‘ip6’ has incomplete type

3. clean compilation

Expected results:
both 2 and 3 should give clean compilation

Additional info:
see also https://www.redhat.com/archives/libvir-list/2013-January/msg00930.html for a real-life project impacted by this header bug

Comment 1 Josh Boyer 2013-01-14 18:48:04 UTC
Can you report this upstream?  3.8 is still in the -rc phase, so there's a chance it can get fixed by the upstream developers before 3.8 releases.

Comment 2 Eric Blake 2013-01-14 21:11:28 UTC
(In reply to comment #1)
> Can you report this upstream?

Having never reported an upstream kernel bug before, how best do I go about doing that?

Comment 3 Eric Blake 2013-01-16 18:56:46 UTC
Looks like others are aware of this issue, given that this thread cc'd netdev.org: https://www.redhat.com/archives/libvir-list/2013-January/msg00981.html

Comment 4 Fedora End Of Life 2013-04-03 15:43:29 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 5 Justin M. Forbes 2013-04-05 18:51:32 UTC
Is this still an issue with the 3.9 kernels in F19?

Comment 6 Eric Blake 2013-04-05 19:41:00 UTC
Not just in F19, but also rawhide:

$ gcc -c -Wall foo.c
In file included from foo.c:4:0:
/usr/include/linux/if_bridge.h:183:20: error: field ‘ip6’ has incomplete type
    struct in6_addr ip6;
                    ^

$ rpm -q kernel-headers
kernel-headers-3.9.0-0.rc5.git1.1.fc20.i686

Comment 7 Josh Boyer 2013-04-08 13:12:20 UTC
*** Bug 949464 has been marked as a duplicate of this bug. ***

Comment 8 Harald Hoyer 2013-04-09 16:23:19 UTC
when will this be fixed?

Comment 9 Justin M. Forbes 2013-04-10 14:22:41 UTC
Upstream discussion on it is a mess due to conflicting definitions. No clue as to when it will actually be fixed.

Comment 10 Damian Wrobel 2013-08-07 13:09:55 UTC
Just faced the same problem on F19 using kernel-headers-3.10.4-300.fc19.x86_64.

For the record the commit which broke it: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ee07c6e7a6f8a25c18f0a6b18152fbd7499245f6

Comment 11 Eric Blake 2013-09-13 16:44:06 UTC
I just noticed that in the latest rawhide, <netinet/in.h> and <linux/in6.h> no longer clash.  Yay!  But <linux/if_bridge.h> is still not self-contained :(

kernel-headers-3.12.0-0.rc0.git22.2.fc21.x86_64
glibc-2.18.90-1.fc21.x86_64

Proof:
$ cat foo.c
#ifdef A
# include <netinet/in.h>
#endif
#ifdef B
# include <linux/in6.h>
#endif
#ifdef C
# include <linux/if_bridge.h>
#endif
typedef int dummy;
$ gcc -Wall -c -o foo.o foo.c -DC
In file included from foo.c:8:0:
/usr/include/linux/if_bridge.h:184:20: error: field 'ip6' has incomplete type
    struct in6_addr ip6;
                    ^
$ gcc -Wall -c -o foo.o foo.c -DA -DC
$ gcc -Wall -c -o foo.o foo.c -DB -DC
$ gcc -Wall -c -o foo.o foo.c -DA -DB -DC

There's hope that we might get this solved yet.

Comment 12 Josh Boyer 2013-09-18 20:53:21 UTC
*********** MASS BUG UPDATE **************

We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 19 kernel bugs.

Fedora 19 has now been rebased to 3.11.1-200.fc19.  Please test this kernel update and let us know if you issue has been resolved or if it is still present with the newer kernel.

If you experience different issues, please open a new bug report for those.

Comment 13 Eric Blake 2013-09-18 21:02:43 UTC
Per comment 11, this bug is still present even in kernel 3.12.0.

Comment 14 Justin M. Forbes 2014-01-03 22:09:32 UTC
*********** MASS BUG UPDATE **************

We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 19 kernel bugs.

Fedora 19 has now been rebased to 3.12.6-200.fc19.  Please test this kernel update (or newer) and let us know if you issue has been resolved or if it is still present with the newer kernel.

If you have moved on to Fedora 20, and are still experiencing this issue, please change the version to Fedora 20.

If you experience different issues, please open a new bug report for those.

Comment 15 Eric Blake 2014-01-03 22:13:13 UTC
Still present in F20.

Comment 16 Justin M. Forbes 2014-02-24 13:59:44 UTC
*********** MASS BUG UPDATE **************

We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 20 kernel bugs.

Fedora 20 has now been rebased to 3.13.4-200.fc20.  Please test this kernel update and let us know if you issue has been resolved or if it is still present with the newer kernel.

If you experience different issues, please open a new bug report for those.

Comment 17 Eric Blake 2014-02-24 16:32:01 UTC
The issue is still present:

$ rpm -q kernel-headers
kernel-headers-3.13.4-200.fc20.x86_64
$ cat f.c
#ifdef WORKAROUND
#include <netinet/ip6.h>
#endif
#include <linux/if_bridge.h>
$ gcc -c -Wall f.c
In file included from f.c:4:0:
/usr/include/linux/if_bridge.h:184:20: error: field ‘ip6’ has incomplete type
    struct in6_addr ip6;
                    ^
$ gcc -c -Wall f.c -DWORKAROUND
$

Comment 18 Justin M. Forbes 2014-05-21 19:39:55 UTC
*********** MASS BUG UPDATE **************

We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 20 kernel bugs.

Fedora 20 has now been rebased to 3.14.4-200.fc20.  Please test this kernel update (or newer) and let us know if you issue has been resolved or if it is still present with the newer kernel.

If you experience different issues, please open a new bug report for those.

Comment 19 Eric Blake 2014-05-21 19:44:54 UTC
The issue is still present:

$ rpm -q kernel-headers
kernel-headers-3.14.4-200.fc20.x86_64
$ cat f.c
#ifdef WORKAROUND
#include <netinet/ip6.h>
#endif
#include <linux/if_bridge.h>
$ gcc -c -Wall f.c
In file included from f.c:5:0:
/usr/include/linux/if_bridge.h:184:20: error: field ‘ip6’ has incomplete type
    struct in6_addr ip6;
                    ^
$ gcc -c -Wall f.c -DWORKAROUND
$

Comment 20 Justin M. Forbes 2014-11-13 16:02:06 UTC
*********** MASS BUG UPDATE **************

We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 20 kernel bugs.

Fedora 20 has now been rebased to 3.17.2-200.fc20.  Please test this kernel update (or newer) and let us know if you issue has been resolved or if it is still present with the newer kernel.

If you have moved on to Fedora 21, and are still experiencing this issue, please change the version to Fedora 21.

If you experience different issues, please open a new bug report for those.

Comment 21 Eric Blake 2014-11-13 18:26:30 UTC
The issue is still present:

$ rpm -q kernel-headers
kernel-headers-3.17.2-200.fc20.x86_64
$ cat f.c
#ifdef WORKAROUND
#include <netinet/ip6.h>
#endif
#include <linux/if_bridge.h>
$ gcc -c -Wall f.c
In file included from f.c:5:0:
/usr/include/linux/if_bridge.h:184:20: error: field ‘ip6’ has incomplete type
    struct in6_addr ip6;
                    ^
$ gcc -c -Wall f.c -DWORKAROUND
$

Comment 22 Eric Blake 2014-11-13 18:28:11 UTC
https://lkml.org/lkml/2014/11/5/832 appears to be the fix.

Comment 23 Josh Boyer 2015-01-06 14:47:43 UTC
(In reply to Eric Blake from comment #22)
> https://lkml.org/lkml/2014/11/5/832 appears to be the fix.

OK, that landed in 3.18-rc5 which means it has been fixed in Rawhide for a while now (at least on the kernel side).  F20 and F21 will get a 3.18 rebase within the next week or two.

The glibc commit required seems to have landed in glibc-2.19 though, which means even when the kernel is fixed for F20 glibc will be lacking the necessary change.  F21 has glibc-2.20 and should be fixed.

[jwboyer@nuc-i7 ~]$ rpm -q kernel-headers glibc
kernel-headers-3.18.1-2.fc22.x86_64
glibc-2.20.90-12.fc22.x86_64
[jwboyer@nuc-i7 ~]$ cat f.c
#ifdef WORKAROUND
#include <netinet/ip6.h>
#endif
#include <linux/if_bridge.h>

[jwboyer@nuc-i7 ~]$ gcc -c -Wall f.c
[jwboyer@nuc-i7 ~]$ 


Closing this bug out.  Thanks for your patience.


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