diff mbox

[ovs-dev,2/2] datapath: test for netlink_set_err returning void

Message ID 1448604443-12224-3-git-send-email-simon.horman@netronome.com
State Changes Requested
Headers show

Commit Message

Simon Horman Nov. 27, 2015, 6:07 a.m. UTC
In v2.6.33 netlink_set_err returns void. However, 1a50307ba182 ("netlink:
fix NETLINK_RECV_NO_ENOBUFS in netlink_set_err()") was backported and
included in v2.6.33.2 and in that and subsequent v2.6.33 stable releases
netlink_set_err returns an int.

It seems plausible that there are other backports floating around. So check
for netlink_set_err returning void rather than including compatibility code
based on the version of the kernel.

Signed-off-by: Simon Horman <simon.horman@netronome.com>

---
* Also applicable to branch-2.4, branch-2.3 and branch-2.2.
  I can provide backports if that would be useful.
---
 .travis.yml                                   | 1 +
 acinclude.m4                                  | 2 ++
 datapath/linux/compat/include/net/genetlink.h | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/.travis.yml b/.travis.yml
index 141359b76c1e..422a6bd30909 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -33,6 +33,7 @@  env:
   - KERNEL=3.4.110
   - KERNEL=3.2.72
   - KERNEL=2.6.33.20
+  - KERNEL=2.6.33.1
   - KERNEL=2.6.32.68
 
 script: ./.travis/build.sh $OPTS
diff --git a/acinclude.m4 b/acinclude.m4
index e4846d90af37..fba9e70b47d1 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -431,6 +431,8 @@  AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_in_addr])
   OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_find_nested])
   OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_is_last])
+  OVS_GREP_IFELSE([$KSRC/include/linux/netlink.h], [void.*netlink_set_err],
+                  [OVS_DEFINE([HAVE_VOID_NETLINK_SET_ERR])])
 
   OVS_GREP_IFELSE([$KSRC/include/net/sctp/checksum.h], [sctp_compute_cksum])
 
diff --git a/datapath/linux/compat/include/net/genetlink.h b/datapath/linux/compat/include/net/genetlink.h
index cf89d4c239e2..2830fa3767c8 100644
--- a/datapath/linux/compat/include/net/genetlink.h
+++ b/datapath/linux/compat/include/net/genetlink.h
@@ -67,7 +67,7 @@  static inline int rpl_genl_unregister_family(struct genl_family *family)
 static inline int genl_set_err(struct genl_family *family, struct net *net,
 			       u32 portid, u32 group, int code)
 {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
+#ifdef HAVE_VOID_NETLINK_SET_ERR
 	netlink_set_err(net->genl_sock, portid, group, code);
 	return 0;
 #else