summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-11-26 17:17:16 (GMT)
committerThomas Haller <thaller@redhat.com>2014-11-27 09:34:57 (GMT)
commitb54775d3169b56d9c0aee47d6937b0358a5443e0 (patch)
treec50289c17a86575fe9cbafb87e278608ca137cef /include
parent8b023fd441c3fd96aad2acca31d2702b1aa1f21e (diff)
downloadlibnl-b54775d3169b56d9c0aee47d6937b0358a5443e0.zip
libnl-b54775d3169b56d9c0aee47d6937b0358a5443e0.tar.gz
libnl-b54775d3169b56d9c0aee47d6937b0358a5443e0.tar.bz2
route/link: return -NLE_OPNOTSUPP in rtnl_link_get_kernel() for old kernels
Older kernels without patch a3d1289126e7b14307074b76bf1677015ea5036f do not support rtnl_getlink() by ifname. Detect this situation and fail with -NLE_OPNOTSUPP instead of -NLE_INVAL. This changes behavior in returning a different error code for this case. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/netlink/utils.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/netlink/utils.h b/include/netlink/utils.h
index 6b4b787..431502f 100644
--- a/include/netlink/utils.h
+++ b/include/netlink/utils.h
@@ -113,6 +113,14 @@ enum {
NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE = 4,
#define NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE NL_CAPABILITY_NL_CONNECT_RETRY_GENERATE_PORT_ON_ADDRINUSE
+ /**
+ * Indicate that rtnl_link_get_kernel() fails with -NLE_OPNOTSUPP in case
+ * of older kernals not supporting lookup by ifname. This changes behavior
+ * from returning -NLE_INVAL to return -NLE_OPNOTSUPP.
+ */
+ NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP = 5,
+#define NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP NL_CAPABILITY_ROUTE_LINK_GET_KERNEL_FAIL_OPNOTSUPP
+
__NL_CAPABILITY_MAX
#define NL_CAPABILITY_MAX (__NL_CAPABILITY_MAX - 1)
};