chiark / gitweb /
rtnl: add link_get_flags
authorTom Gundersen <teg@jklm.no>
Tue, 3 Dec 2013 23:34:58 +0000 (00:34 +0100)
committerTom Gundersen <teg@jklm.no>
Wed, 4 Dec 2013 13:15:13 +0000 (14:15 +0100)
src/libsystemd-rtnl/rtnl-message.c
src/systemd/sd-rtnl.h

index 06c7622f7c936bf9dd7c9f6077156176d308cc35..8d62df965a199500925939abc22f4ec5fbddeafd 100644 (file)
@@ -127,7 +127,7 @@ int sd_rtnl_message_route_new(uint16_t nlmsg_type, unsigned char rtm_family,
         return 0;
 }
 
         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;
 
         struct ifinfomsg *ifi;
         int r;
 
@@ -222,6 +222,21 @@ int sd_rtnl_message_link_get_ifindex(sd_rtnl_message *m, int *ifindex) {
         return 0;
 }
 
         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) {
 /* 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) {
index 6cd179a262393b4ad785369b9e15b0ba06d189c3..0a63b28a19e264499064bd9a1632e3ec8b536eaa 100644 (file)
@@ -81,6 +81,7 @@ int sd_rtnl_message_get_errno(sd_rtnl_message *m);
 int sd_rtnl_message_get_type(sd_rtnl_message *m, uint16_t *type);
 
 int sd_rtnl_message_link_get_ifindex(sd_rtnl_message *m, int *ifindex);
 int sd_rtnl_message_get_type(sd_rtnl_message *m, uint16_t *type);
 
 int sd_rtnl_message_link_get_ifindex(sd_rtnl_message *m, int *ifindex);
+int sd_rtnl_message_link_get_flags(sd_rtnl_message *m, unsigned *flags);
 
 int sd_rtnl_message_append(sd_rtnl_message *m, unsigned short type, const void *data);
 int sd_rtnl_message_open_container(sd_rtnl_message *m, unsigned short type);
 
 int sd_rtnl_message_append(sd_rtnl_message *m, unsigned short type, const void *data);
 int sd_rtnl_message_open_container(sd_rtnl_message *m, unsigned short type);