summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-rtnl/rtnl-message.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-03 21:42:58 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-03 21:48:45 +0100
commite9140aff750e4f251f5f09b67412fed995fe9c47 (patch)
tree30f2c292e0154cfee8ce91bdf2c47674030255e9 /src/libsystemd/sd-rtnl/rtnl-message.c
parent144232a8e0ea77eed8c5a456832758681b5b3511 (diff)
nss-myhostname: always resolve the host name "gateway" to the local default gateway
This is useful inside of containers or local networks to intrdouce a stable name of the default gateway host (in case of containers usually the host, in case of LANs usually local router).
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 7ec6143da6..076c822e6f 100644
--- a/src/libsystemd/sd-rtnl/rtnl-message.c
+++ b/src/libsystemd/sd-rtnl/rtnl-message.c
@@ -143,6 +143,21 @@ int sd_rtnl_message_route_get_family(sd_rtnl_message *m, int *family) {
return 0;
}
+int sd_rtnl_message_route_get_dst_len(sd_rtnl_message *m, unsigned char *dst_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(dst_len, -EINVAL);
+
+ rtm = NLMSG_DATA(m->hdr);
+
+ *dst_len = rtm->rtm_dst_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) {