chiark / gitweb /
sd-rtnl: add support to set packet family type
authorSusant Sahani <susant@redhat.com>
Mon, 21 Jul 2014 07:45:38 +0000 (13:15 +0530)
committerTom Gundersen <teg@jklm.no>
Wed, 29 Oct 2014 09:59:46 +0000 (10:59 +0100)
This patch adds functionality to set family type
in the rtnl message for example PF_BRIDGE.

src/libsystemd/sd-rtnl/rtnl-message.c
src/systemd/sd-rtnl.h

index ccef716..44ad303 100644 (file)
@@ -186,6 +186,20 @@ int sd_rtnl_message_link_set_type(sd_rtnl_message *m, unsigned type) {
         return 0;
 }
 
+int sd_rtnl_message_link_set_family(sd_rtnl_message *m, unsigned family) {
+        struct ifinfomsg *ifi;
+
+        assert_return(m, -EINVAL);
+        assert_return(m->hdr, -EINVAL);
+        assert_return(rtnl_message_type_is_link(m->hdr->nlmsg_type), -EINVAL);
+
+        ifi = NLMSG_DATA(m->hdr);
+
+        ifi->ifi_family = family;
+
+        return 0;
+}
+
 int sd_rtnl_message_new_link(sd_rtnl *rtnl, sd_rtnl_message **ret,
                              uint16_t nlmsg_type, int index) {
         struct ifinfomsg *ifi;
index 1e7eb81..0980de8 100644 (file)
@@ -93,6 +93,7 @@ int sd_rtnl_message_addr_get_ifindex(sd_rtnl_message *m, int *ifindex);
 
 int sd_rtnl_message_link_set_flags(sd_rtnl_message *m, unsigned flags, unsigned change);
 int sd_rtnl_message_link_set_type(sd_rtnl_message *m, unsigned type);
+int sd_rtnl_message_link_set_family(sd_rtnl_message *m, unsigned family);
 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_link_get_type(sd_rtnl_message *m, unsigned *type);