summaryrefslogtreecommitdiff
path: root/src/libsystemd-rtnl/rtnl-message.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2013-12-04 00:34:58 +0100
committerTom Gundersen <teg@jklm.no>2013-12-04 14:15:13 +0100
commit50b3c42f971f4c9c7791c3b2831f6146ebd15e06 (patch)
tree9b60b3ca3e2bbc6f91747478e618e6e5861dd4ed /src/libsystemd-rtnl/rtnl-message.c
parent8cec01b9e9b7264639fd1fc0fe373ef4d5baaf49 (diff)
rtnl: add link_get_flags
Diffstat (limited to 'src/libsystemd-rtnl/rtnl-message.c')
-rw-r--r--src/libsystemd-rtnl/rtnl-message.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libsystemd-rtnl/rtnl-message.c b/src/libsystemd-rtnl/rtnl-message.c
index 06c7622f7c..8d62df965a 100644
--- a/src/libsystemd-rtnl/rtnl-message.c
+++ b/src/libsystemd-rtnl/rtnl-message.c
@@ -127,7 +127,7 @@ int sd_rtnl_message_route_new(uint16_t nlmsg_type, unsigned char rtm_family,
return 0;
}
-int sd_rtnl_message_link_new(uint16_t nlmsg_type, int index, unsigned int type, unsigned int flags, sd_rtnl_message **ret) {
+int sd_rtnl_message_link_new(uint16_t nlmsg_type, int index, unsigned type, unsigned flags, sd_rtnl_message **ret) {
struct ifinfomsg *ifi;
int r;
@@ -222,6 +222,21 @@ int sd_rtnl_message_link_get_ifindex(sd_rtnl_message *m, int *ifindex) {
return 0;
}
+int sd_rtnl_message_link_get_flags(sd_rtnl_message *m, unsigned *flags) {
+ struct ifinfomsg *ifi;
+
+ assert_return(m, -EINVAL);
+ assert_return(flags, -EINVAL);
+ assert_return(m->hdr->nlmsg_type == RTM_NEWLINK || m->hdr->nlmsg_type == RTM_DELLINK ||
+ m->hdr->nlmsg_type == RTM_GETLINK || m->hdr->nlmsg_type == RTM_SETLINK, -EINVAL);
+
+ ifi = NLMSG_DATA(m->hdr);
+
+ *flags = ifi->ifi_flags;
+
+ return 0;
+}
+
/* If successful the updated message will be correctly aligned, if unsuccessful the old message is
untouched */
static int add_rtattr(sd_rtnl_message *m, unsigned short type, const void *data, size_t data_length) {