diff options
author | Tom Gundersen <teg@jklm.no> | 2014-05-10 16:06:23 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-05-10 20:56:37 +0200 |
commit | f4e884dd1c4cc4bc6d5f068f96b14ceda46f3962 (patch) | |
tree | 15200b6e5e2b990db9ffb26d50f33bbbdebe7551 /src/libsystemd | |
parent | 31d0ac36c62c9ed9646fb478b9d71cc2ecc3e55c (diff) |
sd-rtnl: message - add support for getting prefixlen from address messages
Diffstat (limited to 'src/libsystemd')
-rw-r--r-- | src/libsystemd/sd-rtnl/rtnl-message.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index 9043c675ac..d611207dea 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -290,6 +290,21 @@ int sd_rtnl_message_addr_get_family(sd_rtnl_message *m, unsigned char *family) { return 0; } +int sd_rtnl_message_addr_get_prefixlen(sd_rtnl_message *m, unsigned char *prefixlen) { + struct ifaddrmsg *ifa; + + assert_return(m, -EINVAL); + assert_return(m->hdr, -EINVAL); + assert_return(rtnl_message_type_is_addr(m->hdr->nlmsg_type), -EINVAL); + assert_return(prefixlen, -EINVAL); + + ifa = NLMSG_DATA(m->hdr); + + *prefixlen = ifa->ifa_prefixlen; + + return 0; +} + int sd_rtnl_message_addr_get_scope(sd_rtnl_message *m, unsigned char *scope) { struct ifaddrmsg *ifa; |