summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-rtnl/rtnl-message.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-03 22:23:06 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-03 22:23:21 +0100
commita98433c05c5cce62a6a17db74e49363a88156486 (patch)
treebaa8b92a0de5f70292bd5f71d054ee62fd075557 /src/libsystemd/sd-rtnl/rtnl-message.c
parente9140aff750e4f251f5f09b67412fed995fe9c47 (diff)
rtnl: make checks for default routes more strict
Also check that the source netmask is 0, not only the destination netmask.
Diffstat (limited to 'src/libsystemd/sd-rtnl/rtnl-message.c')
-rw-r--r--src/libsystemd/sd-rtnl/rtnl-message.c15
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 076c822e6f..a2f75471b4 100644
--- a/src/libsystemd/sd-rtnl/rtnl-message.c
+++ b/src/libsystemd/sd-rtnl/rtnl-message.c
@@ -158,6 +158,21 @@ int sd_rtnl_message_route_get_dst_len(sd_rtnl_message *m, unsigned char *dst_len
return 0;
}
+int sd_rtnl_message_route_get_src_len(sd_rtnl_message *m, unsigned char *src_len) {
+ 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(src_len, -EINVAL);
+
+ rtm = NLMSG_DATA(m->hdr);
+
+ *src_len = rtm->rtm_src_len;
+
+ 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) {