linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] rtnetlink/netdevice include triggers userspace compiler errors
@ 2010-11-15 16:01 Andy Whitcroft
  2010-11-15 16:01 ` [PATCH 1/1] net: rtnetlink.h -- only include linux/netdevice.h when used by the kernel Andy Whitcroft
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Whitcroft @ 2010-11-15 16:01 UTC (permalink / raw)
  To: David S. Miller", Eric Dumazet
  Cc: netdev, linux-kernel, Andy Whitcroft, Tim Gardner

We have seen a number of reports of userspace applications (including
eglibc) which fail to compile when trying to use linux/rtnetlink.h.
It appears that a new helper function has necessitated the inclusion of
linux/netdevice.h which in turn causes a collision with userspace headers
from libc, with net/if.h.

It appears that this header is not required for the userspace exported
components of rtnetlink.h.  Following this email is a patch to pull this
include down in the the kernel specific section of this header.  It seems
to both fix this issue for userspace and still compiles correctly for
kernel use.

Against v2.6.37-rc1.

-apw

Andy Whitcroft (1):
  net: rtnetlink.h -- only include linux/netdevice.h when used by the
    kernel

 include/linux/rtnetlink.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] net: rtnetlink.h -- only include linux/netdevice.h when used by the kernel
  2010-11-15 16:01 [PATCH 0/1] rtnetlink/netdevice include triggers userspace compiler errors Andy Whitcroft
@ 2010-11-15 16:01 ` Andy Whitcroft
  2010-11-15 19:30   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Whitcroft @ 2010-11-15 16:01 UTC (permalink / raw)
  To: David S. Miller", Eric Dumazet
  Cc: netdev, linux-kernel, Andy Whitcroft, Tim Gardner

The commit below added a new helper dev_ingress_queue to cleanly obtain the
ingress queue pointer.  This necessitated including 'linux/netdevice.h':

  commit 24824a09e35402b8d58dcc5be803a5ad3937bdba
  Author: Eric Dumazet <eric.dumazet@gmail.com>
  Date:   Sat Oct 2 06:11:55 2010 +0000

    net: dynamic ingress_queue allocation

However this include triggers issues for applications in userspace
which use the rtnetlink interfaces.  Commonly this requires they include
'net/if.h' and 'linux/rtnetlink.h' leading to a compiler error as below:

  In file included from /usr/include/linux/netdevice.h:28:0,
                   from /usr/include/linux/rtnetlink.h:9,
                   from t.c:2:
  /usr/include/linux/if.h:135:8: error: redefinition of ‘struct ifmap’
  /usr/include/net/if.h:112:8: note: originally defined here
  /usr/include/linux/if.h:169:8: error: redefinition of ‘struct ifreq’
  /usr/include/net/if.h:127:8: note: originally defined here
  /usr/include/linux/if.h:218:8: error: redefinition of ‘struct ifconf’
  /usr/include/net/if.h:177:8: note: originally defined here

The new helper is only defined for the kernel and protected by __KERNEL__
therefore we can simply pull the include down into the same protected
section.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 include/linux/rtnetlink.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index d42f274..bbad657 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -6,7 +6,6 @@
 #include <linux/if_link.h>
 #include <linux/if_addr.h>
 #include <linux/neighbour.h>
-#include <linux/netdevice.h>
 
 /* rtnetlink families. Values up to 127 are reserved for real address
  * families, values above 128 may be used arbitrarily.
@@ -606,6 +605,7 @@ struct tcamsg {
 #ifdef __KERNEL__
 
 #include <linux/mutex.h>
+#include <linux/netdevice.h>
 
 static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str)
 {
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] net: rtnetlink.h -- only include linux/netdevice.h when used by the kernel
  2010-11-15 16:01 ` [PATCH 1/1] net: rtnetlink.h -- only include linux/netdevice.h when used by the kernel Andy Whitcroft
@ 2010-11-15 19:30   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2010-11-15 19:30 UTC (permalink / raw)
  To: apw; +Cc: eric.dumazet, netdev, linux-kernel, tim.gardner

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: Text/Plain; charset=iso-8859-7, Size: 1425 bytes --]

From: Andy Whitcroft <apw@canonical.com>
Date: Mon, 15 Nov 2010 16:01:59 +0000

> The commit below added a new helper dev_ingress_queue to cleanly obtain the
> ingress queue pointer.  This necessitated including 'linux/netdevice.h':
 ...
> However this include triggers issues for applications in userspace
> which use the rtnetlink interfaces.  Commonly this requires they include
> 'net/if.h' and 'linux/rtnetlink.h' leading to a compiler error as below:
> 
>   In file included from /usr/include/linux/netdevice.h:28:0,
>                    from /usr/include/linux/rtnetlink.h:9,
>                    from t.c:2:
>   /usr/include/linux/if.h:135:8: error: redefinition of ¡struct ifmap¢
>   /usr/include/net/if.h:112:8: note: originally defined here
>   /usr/include/linux/if.h:169:8: error: redefinition of ¡struct ifreq¢
>   /usr/include/net/if.h:127:8: note: originally defined here
>   /usr/include/linux/if.h:218:8: error: redefinition of ¡struct ifconf¢
>   /usr/include/net/if.h:177:8: note: originally defined here
> 
> The new helper is only defined for the kernel and protected by __KERNEL__
> therefore we can simply pull the include down into the same protected
> section.
> 
> Signed-off-by: Andy Whitcroft <apw@canonical.com>

Applied, thanks Andy.
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-15 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-15 16:01 [PATCH 0/1] rtnetlink/netdevice include triggers userspace compiler errors Andy Whitcroft
2010-11-15 16:01 ` [PATCH 1/1] net: rtnetlink.h -- only include linux/netdevice.h when used by the kernel Andy Whitcroft
2010-11-15 19:30   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).