Subject: Re: [GIT PATCH] NET: Fixes for net-2.6.19

From: Stephen Hemminger <[email-masked]>
Date: Thu, 28 Sep 2006 16:27:04 -0700

On Thu, 28 Sep 2006 16:04:58 -0700 (PDT)
David Miller <[email-masked]> wrote:

> From: Stephen Hemminger <[email-masked]>
> Date: Thu, 28 Sep 2006 15:50:52 -0700
> 
> > On Thu, 28 Sep 2006 14:33:04 -0700 (PDT)
> > David Miller <[email-masked]> wrote:
> > 
> > > From: Stephen Hemminger <[email-masked]>
> > > Date: Thu, 28 Sep 2006 08:36:45 -0700
> > > 
> > > > Please figure out how to keep rtnetlink.h useful from user space.
> > > > I tried putting the current sanitized version of rtnetlink.h into
> > > > iproute2 and the build fails. 
> > > 
> > > Please give the error so I have a chance of fixing this.
> > 
> > If I put 2.6.19 headers in:
> > 
> > 
> > In file included from ../include/linux/rtnetlink.h:5,
> >                  from ../include/libnetlink.h:6,
> >                  from ll_map.c:23:
> > /usr/include/linux/if.h:117: error: redefinition of $,1rxstruct ifmap$,1ry
> > /usr/include/linux/if.h:153: error: redefinition of $,1rxstruct ifreq$,1ry
> > /usr/include/linux/if.h:203: error: redefinition of $,1rxstruct ifconf$,1ry
> 
> Hmmm... we explicitly removed the "linux/if.h" inclusion from
> rtnetlink.h so this is weird.  Where is the linux/if.h include coming
> from?
> 

It got added by this:

commit 0844565fb8a9418f5a860aa480c1aef70319c9a2
Author: Thomas Graf <[email-masked]>
Date:   Fri Aug 4 23:05:56 2006 -0700

    [NET]: Move netlink interface bits to linux/if.h
    
    Signed-off-by: Thomas Graf <[email-masked]>
    Signed-off-by: David S. Miller <[email-masked]>

diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 890c4d4..84f3eb4 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -2,6 +2,7 @@ #ifndef __LINUX_RTNETLINK_H
 #define __LINUX_RTNETLINK_H
 
 #include <linux/netlink.h>
+#include <linux/if.h>
 
 /****
  *		Routing/neighbour discovery messages.

Note: if I put a santized version if linux/if.h in the iproute2, then it
gets more errors as well:

In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:26:1: warning: "IFNAMSIZ" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:130:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:30:1: warning: "IFF_UP" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:46:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:31:1: warning: "IFF_BROADCAST" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:48:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:32:1: warning: "IFF_DEBUG" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:50:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:33:1: warning: "IFF_LOOPBACK" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:52:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:34:1: warning: "IFF_POINTOPOINT" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:54:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:35:1: warning: "IFF_NOTRAILERS" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:56:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:36:1: warning: "IFF_RUNNING" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:58:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:37:1: warning: "IFF_NOARP" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:60:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:38:1: warning: "IFF_PROMISC" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:62:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:39:1: warning: "IFF_ALLMULTI" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:66:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:41:1: warning: "IFF_MASTER" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:69:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:42:1: warning: "IFF_SLAVE" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:71:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:44:1: warning: "IFF_MULTICAST" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:74:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:46:1: warning: "IFF_PORTSEL" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:77:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:47:1: warning: "IFF_AUTOMEDIA" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:79:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:48:1: warning: "IFF_DYNAMIC" redefined
In file included from ll_map.c:20:
/usr/include/net/if.h:81:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ll_map.c:23:
../include/linux/if.h:120: error: redefinition of ‘struct ifmap’
../include/linux/if.h:156: error: redefinition of ‘struct ifreq’
../include/linux/if.h:206: error: redefinition of ‘struct ifconf’
ll_map.c: In function ‘ll_remember_index’:
ll_map.c:55: warning: implicit declaration of function ‘IFLA_RTA’
ll_map.c:55: warning: implicit declaration of function ‘IFLA_PAYLOAD’
ll_map.c:55: warning: passing argument 3 of ‘parse_rtattr’ makes pointer from integer without a cast
make[1]: *** [ll_map.o] Error 1
ipaddress.c: In function ‘print_linkinfo’:
ipaddress.c:151: warning: implicit declaration of function ‘IFLA_RTA’
ipaddress.c:151: warning: passing argument 3 of ‘parse_rtattr’ makes pointer from integer without a cast
ipaddress.c: In function ‘print_addrinfo’:
ipaddress.c:285: error: ‘IFA_MAX’ undeclared (first use in this function)
ipaddress.c:285: error: (Each undeclared identifier is reported only once
ipaddress.c:285: error: for each function it appears in.)
ipaddress.c:291: error: dereferencing pointer to incomplete type
ipaddress.c:300: warning: implicit declaration of function ‘IFA_RTA’
ipaddress.c:300: error: dereferencing pointer to incomplete type
ipaddress.c:300: warning: passing argument 3 of ‘parse_rtattr’ makes pointer from integer without a cast
ipaddress.c:302: error: ‘IFA_LOCAL’ undeclared (first use in this function)
ipaddress.c:303: error: ‘IFA_ADDRESS’ undeclared (first use in this function)
ipaddress.c:307: error: dereferencing pointer to incomplete type
ipaddress.c:309: error: dereferencing pointer to incomplete type
ipaddress.c:311: error: dereferencing pointer to incomplete type
ipaddress.c:316: error: ‘IFA_LABEL’ undeclared (first use in this function)
ipaddress.c:319: error: dereferencing pointer to incomplete type
ipaddress.c:327: error: dereferencing pointer to incomplete type
ipaddress.c:334: error: dereferencing pointer to incomplete type
ipaddress.c:358: error: dereferencing pointer to incomplete type
ipaddress.c:358: error: dereferencing pointer to incomplete type
ipaddress.c:359: error: dereferencing pointer to incomplete type
ipaddress.c:361: error: dereferencing pointer to incomplete type
ipaddress.c:363: error: dereferencing pointer to incomplete type
ipaddress.c:365: error: dereferencing pointer to incomplete type
ipaddress.c:368: error: dereferencing pointer to incomplete type
ipaddress.c:371: error: dereferencing pointer to incomplete type
ipaddress.c:378: error: dereferencing pointer to incomplete type
ipaddress.c:381: error: dereferencing pointer to incomplete type
ipaddress.c:385: error: dereferencing pointer to incomplete type
ipaddress.c:389: error: ‘IFA_BROADCAST’ undeclared (first use in this function)
ipaddress.c:391: error: dereferencing pointer to incomplete type
ipaddress.c:396: error: ‘IFA_ANYCAST’ undeclared (first use in this function)
ipaddress.c:398: error: dereferencing pointer to incomplete type
ipaddress.c:403: error: dereferencing pointer to incomplete type
ipaddress.c:404: error: dereferencing pointer to incomplete type
ipaddress.c:404: error: ‘IFA_F_SECONDARY’ undeclared (first use in this function)
ipaddress.c:405: error: dereferencing pointer to incomplete type
ipaddress.c:408: error: dereferencing pointer to incomplete type
ipaddress.c:408: error: ‘IFA_F_TENTATIVE’ undeclared (first use in this function)
ipaddress.c:409: error: dereferencing pointer to incomplete type
ipaddress.c:412: error: dereferencing pointer to incomplete type
ipaddress.c:412: error: ‘IFA_F_DEPRECATED’ undeclared (first use in this function)
ipaddress.c:413: error: dereferencing pointer to incomplete type
ipaddress.c:416: error: dereferencing pointer to incomplete type
ipaddress.c:416: error: ‘IFA_F_PERMANENT’ undeclared (first use in this function)
ipaddress.c:419: error: dereferencing pointer to incomplete type
ipaddress.c:420: error: dereferencing pointer to incomplete type
ipaddress.c:421: error: dereferencing pointer to incomplete type
ipaddress.c:424: error: ‘IFA_CACHEINFO’ undeclared (first use in this function)
ipaddress.c:428: error: dereferencing pointer to incomplete type
ipaddress.c:431: error: dereferencing pointer to incomplete type
ipaddress.c:432: error: dereferencing pointer to incomplete type
ipaddress.c:435: error: dereferencing pointer to incomplete type
ipaddress.c:285: warning: unused variable ‘rta_tb’
ipaddress.c: In function ‘print_selected_addrinfo’:
ipaddress.c:462: error: dereferencing pointer to incomplete type
ipaddress.c:463: error: dereferencing pointer to incomplete type
ipaddress.c: In function ‘ipaddr_list_or_flush’:
ipaddress.c:538: error: ‘IFA_F_PERMANENT’ undeclared (first use in this function)
ipaddress.c:544: error: ‘IFA_F_SECONDARY’ undeclared (first use in this function)
ipaddress.c:550: error: ‘IFA_F_TENTATIVE’ undeclared (first use in this function)
ipaddress.c:553: error: ‘IFA_F_DEPRECATED’ undeclared (first use in this function)
ipaddress.c:655: error: dereferencing pointer to incomplete type
ipaddress.c:656: error: dereferencing pointer to incomplete type
ipaddress.c:658: error: dereferencing pointer to incomplete type
ipaddress.c:660: error: dereferencing pointer to incomplete type
ipaddress.c:663: error: ‘IFA_MAX’ undeclared (first use in this function)
ipaddress.c:664: warning: implicit declaration of function ‘IFA_PAYLOAD’
ipaddress.c:664: warning: passing argument 3 of ‘parse_rtattr’ makes pointer from integer without a cast
ipaddress.c:665: error: ‘IFA_LOCAL’ undeclared (first use in this function)
ipaddress.c:666: error: ‘IFA_ADDRESS’ undeclared (first use in this function)
ipaddress.c:671: error: dereferencing pointer to incomplete type
ipaddress.c:679: error: ‘IFA_LABEL’ undeclared (first use in this function)
ipaddress.c:682: error: dereferencing pointer to incomplete type
ipaddress.c:663: warning: unused variable ‘tb’
ipaddress.c: In function ‘ipaddr_modify’:
ipaddress.c:738: error: field ‘ifa’ has incomplete type
ipaddress.c:754: error: invalid application of ‘sizeof’ to incomplete type ‘struct ifaddrmsg’ 
ipaddress.c:770: error: ‘IFA_ADDRESS’ undeclared (first use in this function)
ipaddress.c:786: error: ‘IFA_BROADCAST’ undeclared (first use in this function)
ipaddress.c:797: error: ‘IFA_ANYCAST’ undeclared (first use in this function)
ipaddress.c:812: error: ‘IFA_LABEL’ undeclared (first use in this function)
ipaddress.c:825: error: ‘IFA_LOCAL’ undeclared (first use in this function)
make[1]: *** [ipaddress.o] Error 1
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:26:1: warning: "IFNAMSIZ" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:130:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:30:1: warning: "IFF_UP" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:46:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:31:1: warning: "IFF_BROADCAST" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:48:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:32:1: warning: "IFF_DEBUG" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:50:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:33:1: warning: "IFF_LOOPBACK" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:52:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:34:1: warning: "IFF_POINTOPOINT" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:54:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:35:1: warning: "IFF_NOTRAILERS" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:56:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:36:1: warning: "IFF_RUNNING" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:58:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:37:1: warning: "IFF_NOARP" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:60:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:38:1: warning: "IFF_PROMISC" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:62:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:39:1: warning: "IFF_ALLMULTI" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:66:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:41:1: warning: "IFF_MASTER" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:69:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:42:1: warning: "IFF_SLAVE" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:71:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:44:1: warning: "IFF_MULTICAST" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:74:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:46:1: warning: "IFF_PORTSEL" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:77:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:47:1: warning: "IFF_AUTOMEDIA" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:79:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:48:1: warning: "IFF_DYNAMIC" redefined
In file included from tc_filter.c:18:
/usr/include/net/if.h:81:1: warning: this is the location of the previous definition
In file included from ../include/linux/rtnetlink.h:5,
                 from ../include/libnetlink.h:6,
                 from ../include/utils.h:7,
                 from tc_filter.c:27:
../include/linux/if.h:120: error: redefinition of ‘struct ifmap’
../include/linux/if.h:156: error: redefinition of ‘struct ifreq’
../include/linux/if.h:206: error: redefinition of ‘struct ifconf’
make[1]: *** [tc_filter.o] Error 1
/usr/bin/ld: cannot find -lnetlink
collect2: ld returned 1 exit status
make[1]: *** [ss] Error 1
make[1]: *** No rule to make target `../lib/libnetlink.a', needed by `genl'.  Stop.
make: *** [all] Error 2

-- 
Stephen Hemminger <[email-masked]>