summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJef Oliver <jef.oliver@intel.com>2016-08-27 02:19:49 (GMT)
committerThomas Haller <thaller@redhat.com>2016-08-29 11:09:29 (GMT)
commit5860c205d4db7fa38ce3f2780c6dd9897b8043b6 (patch)
treeadef449d9e3ddb57fa5a1205de32f0f623bc282f /include
parent746bbba3e55206c67808d3243aad740abc92ab3f (diff)
downloadlibnl-5860c205d4db7fa38ce3f2780c6dd9897b8043b6.zip
libnl-5860c205d4db7fa38ce3f2780c6dd9897b8043b6.tar.gz
libnl-5860c205d4db7fa38ce3f2780c6dd9897b8043b6.tar.bz2
lib/route: allow override of message type during link change
When rtnl_link_build_change_request() builds a change request, it sets the message type to RTM_NEWLINK by default. If the request fails, it changes the type to RTM_SETLINK, and resubmits. For some address families, this will result in a requested change never being applied by the kernel. An exmaple of this is the Linux bridge. When a netlink message of type RTM_NEWLINK is recieved, rather than failing, it simply ignores the message and does not return a failure. To fix this, this patch implements an override for address families that require it. The override can be set when an address family registers itself in libnl. This patch adds ao_override_rtm to the rtnl_link_af_ops structure. This patch adds a static function named af_request_type. This patch modifies rtnl_link_build_change_request to call af_request_type to properly set the request type if an address family wishes to override. Signed-off-by: Jef Oliver <jef.oliver@intel.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/netlink-private/route/link/api.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/netlink-private/route/link/api.h b/include/netlink-private/route/link/api.h
index 1a793c8..1cda72e 100644
--- a/include/netlink-private/route/link/api.h
+++ b/include/netlink-private/route/link/api.h
@@ -146,6 +146,14 @@ struct rtnl_link_af_ops
*/
int (*ao_compare)(struct rtnl_link *,
struct rtnl_link *, int, uint32_t, int);
+
+ /* RTM_NEWLINK override
+ *
+ * Called if a change link request is set to the kernel. If this is set
+ * to anything other than zero, RTM_NEWLINK will be overriden with
+ * RTM_SETLINK when rtnl_link_build_change_request() is called.
+ */
+ const int ao_override_rtm;
};
extern struct rtnl_link_af_ops *rtnl_link_af_ops_lookup(unsigned int);