提交 3b42a96d 编写于 作者: A Andy Whitcroft 提交者: David S. Miller

net: rtnetlink.h -- only include linux/netdevice.h when used by the kernel

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

  commit 24824a09
  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: NAndy Whitcroft <apw@canonical.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9457b24a
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <linux/if_link.h> #include <linux/if_link.h>
#include <linux/if_addr.h> #include <linux/if_addr.h>
#include <linux/neighbour.h> #include <linux/neighbour.h>
#include <linux/netdevice.h>
/* rtnetlink families. Values up to 127 are reserved for real address /* rtnetlink families. Values up to 127 are reserved for real address
* families, values above 128 may be used arbitrarily. * families, values above 128 may be used arbitrarily.
...@@ -606,6 +605,7 @@ struct tcamsg { ...@@ -606,6 +605,7 @@ struct tcamsg {
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/netdevice.h>
static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str) static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册