From: Susant Sahani Date: Mon, 21 Jul 2014 07:45:38 +0000 (+0530) Subject: sd-rtnl: add support to set packet family type X-Git-Tag: v218~679 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=64c8407133fdc1887785789d0fe574bc21035433;p=platform%2Fupstream%2Fsystemd.git sd-rtnl: add support to set packet family type This patch adds functionality to set family type in the rtnl message for example PF_BRIDGE. --- diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index ccef716..44ad303 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -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; diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h index 1e7eb81..0980de8 100644 --- a/src/systemd/sd-rtnl.h +++ b/src/systemd/sd-rtnl.h @@ -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);