diff options
author | Tom Gundersen <teg@jklm.no> | 2014-12-02 00:58:17 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-12-02 00:58:17 +0100 |
commit | dae4de9d42debf448bf667e0e4fd4606dfcfae0c (patch) | |
tree | d684111e63c229bba0c75f645a277fd32e26be64 | |
parent | 5a16bc264c32237e38a844d55e7a1820a31b8440 (diff) |
sd-rtnl: add sd_rtnl_message_route_get_family
-rw-r--r-- | src/libsystemd/sd-rtnl/rtnl-message.c | 15 | ||||
-rw-r--r-- | src/systemd/sd-rtnl.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index 44ad303198..22ee4c5042 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -128,6 +128,21 @@ int sd_rtnl_message_route_set_scope(sd_rtnl_message *m, unsigned char scope) { return 0; } +int sd_rtnl_message_route_get_family(sd_rtnl_message *m, int *family) { + struct rtmsg *rtm; + + assert_return(m, -EINVAL); + assert_return(m->hdr, -EINVAL); + assert_return(rtnl_message_type_is_route(m->hdr->nlmsg_type), -EINVAL); + assert_return(family, -EINVAL); + + rtm = NLMSG_DATA(m->hdr); + + *family = rtm->rtm_family; + + return 0; +} + int sd_rtnl_message_new_route(sd_rtnl *rtnl, sd_rtnl_message **ret, uint16_t nlmsg_type, int rtm_family, unsigned char rtm_protocol) { diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h index 95bdb1d3d6..0d17b16eb0 100644 --- a/src/systemd/sd-rtnl.h +++ b/src/systemd/sd-rtnl.h @@ -101,6 +101,7 @@ int sd_rtnl_message_link_get_type(sd_rtnl_message *m, unsigned *type); int sd_rtnl_message_route_set_dst_prefixlen(sd_rtnl_message *m, unsigned char prefixlen); int sd_rtnl_message_route_set_scope(sd_rtnl_message *m, unsigned char scope); +int sd_rtnl_message_route_get_family(sd_rtnl_message *m, int *family); int sd_rtnl_message_append_string(sd_rtnl_message *m, unsigned short type, const char *data); int sd_rtnl_message_append_u8(sd_rtnl_message *m, unsigned short type, uint8_t data); |