summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@gmail.com>2015-10-05 09:36:57 +0530
committerSusant Sahani <ssahani@gmail.com>2015-10-05 09:43:29 +0530
commitc06cb593eba5696cd0e92af59e864ce80d702ce4 (patch)
treeb2938e60ab585625aff67795f052177e61729a2e
parentced671e105e96c33e4ece1041dd7fbb0f2d4b0d3 (diff)
sd-rtnl: introduce new API to set the NL header flags
By default we set as NLM_F_CREATE | NLM_F_EXCL in sd_rtnl_message_new_link But incase of bridge we need to set NLM_F_REQUEST | NLM_F_ACK. If NLM_F_EXCL is set then we are unable to set the parameters. As bridge supports setting properties after creation not during creation.
-rw-r--r--src/libsystemd/sd-netlink/netlink-message.c9
-rw-r--r--src/systemd/sd-netlink.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/src/libsystemd/sd-netlink/netlink-message.c b/src/libsystemd/sd-netlink/netlink-message.c
index 0d8e37b856..cf693de5fb 100644
--- a/src/libsystemd/sd-netlink/netlink-message.c
+++ b/src/libsystemd/sd-netlink/netlink-message.c
@@ -149,6 +149,15 @@ int sd_netlink_message_get_type(sd_netlink_message *m, uint16_t *type) {
return 0;
}
+int sd_netlink_message_set_flags(sd_netlink_message *m, uint16_t flags) {
+ assert_return(m, -EINVAL);
+ assert_return(flags, -EINVAL);
+
+ m->hdr->nlmsg_flags = flags;
+
+ return 0;
+}
+
int sd_netlink_message_is_broadcast(sd_netlink_message *m) {
assert_return(m, -EINVAL);
diff --git a/src/systemd/sd-netlink.h b/src/systemd/sd-netlink.h
index cb462bf48f..e09b8c8e2d 100644
--- a/src/systemd/sd-netlink.h
+++ b/src/systemd/sd-netlink.h
@@ -104,6 +104,7 @@ int sd_netlink_message_request_dump(sd_netlink_message *m, int dump);
int sd_netlink_message_is_error(sd_netlink_message *m);
int sd_netlink_message_get_errno(sd_netlink_message *m);
int sd_netlink_message_get_type(sd_netlink_message *m, uint16_t *type);
+int sd_netlink_message_set_flags(sd_netlink_message *m, uint16_t flags);
int sd_netlink_message_is_broadcast(sd_netlink_message *m);
/* rtnl */