From cfe7c1f5e8c64866cc9c831f5559f0b3b44f66da Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 24 Jun 2009 14:58:57 -0700 Subject: [PATCH] datapath: Ignore return value from rtnl_notify(). In Linux 2.6.30, the rtnl_notify() return type was changed from int to void along with the following commit message: This patch also modifies the rtnetlink code to ignore the return value of rtnl_notify() in all callers. The function rtnl_notify() (before this patch) returned the error of the unicast notification which makes rtnl_set_sk_err() reports errors to all listeners. This is not of any help since the origin of the change (the socket that requested the echoing) notices the ENOBUFS error if the notification fails and should resync itself. Thus there's no point in checking the return value, even in older versions of the kernel, and so this commit changes our code to ignore it, even on older kernel versions. We also update the rtnl_notify() wrapper macros to make the return type void on older kernel versions. This has not been tested, just built. Thanks to Mikio for spurring me to try building with Linux 2.6.29 and 2.6.30. --- datapath/datapath.c | 3 ++- .../linux-2.6/compat-2.6/include/linux/rtnetlink.h | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index 64e06ceb6..2a9616137 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -177,7 +177,8 @@ static void dp_ifinfo_notify(int event, struct net_bridge_port *port) kfree_skb(skb); goto errout; } - err = rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_KERNEL); + rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_KERNEL); + return; errout: if (err < 0) rtnl_set_sk_err(net, RTNLGRP_LINK, err); diff --git a/datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h b/datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h index 8bc51560f..4d7bd784b 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h @@ -4,7 +4,7 @@ #include_next #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -static inline int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, +static inline void rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group, struct nlmsghdr *nlh, gfp_t flags) { BUG_ON(nlh); /* not implemented */ @@ -12,7 +12,6 @@ static inline int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, /* errors reported via destination sk->sk_err */ nlmsg_multicast(rtnl, skb, 0, group); } - return 0; } static inline void rtnl_set_sk_err(struct net *net, u32 group, int error) @@ -20,10 +19,15 @@ static inline void rtnl_set_sk_err(struct net *net, u32 group, int error) netlink_set_err(rtnl, 0, group, error); } #elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) +/* No 'net' parameter in these versions. */ #define rtnl_notify(skb, net, pid, group, nlh, flags) \ - ((void) (net), rtnl_notify(skb, pid, group, nlh, flags)) + ((void) (net), (void) rtnl_notify(skb, pid, group, nlh, flags)) #define rtnl_set_sk_err(net, group, error) \ ((void) (net), rtnl_set_sk_err(group, error)) -#endif /* linux kernel < 2.6.25 */ +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) +/* Make the return type effectively 'void' to match Linux 2.6.30+. */ +#define rtnl_notify(skb, net, pid, group, nlh, flags) \ + ((void) rtnl_notify(skb, net, pid, group, nlh, flags)) +#endif #endif /* linux/rtnetlink.h wrapper */ -- 2.43.0