[systemd-commits] 2 commits - src/libsystemd src/resolve src/systemd
Lennart Poettering
lennart at kemper.freedesktop.org
Wed Dec 3 13:25:23 PST 2014
src/libsystemd/sd-rtnl/local-addresses.c | 11 ++++++++---
src/libsystemd/sd-rtnl/rtnl-message.c | 15 +++++++++++++++
src/resolve/resolved-dns-scope.c | 3 ++-
src/systemd/sd-rtnl.h | 1 +
4 files changed, 26 insertions(+), 4 deletions(-)
New commits:
commit 77209c3505fa856dae23ae566b729c862a9b71f4
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Dec 3 22:23:41 2014 +0100
resolved: don't resolve the hostname "gateway" with LLMNR, leave that to nss-myhostname
diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c
index 1ce2bb4..a43359f 100644
--- a/src/resolve/resolved-dns-scope.c
+++ b/src/resolve/resolved-dns-scope.c
@@ -334,7 +334,8 @@ DnsScopeMatch dns_scope_good_domain(DnsScope *s, int ifindex, uint64_t flags, co
if (s->protocol == DNS_PROTOCOL_LLMNR) {
if (dns_name_endswith(domain, "in-addr.arpa") > 0 ||
dns_name_endswith(domain, "ip6.arpa") > 0 ||
- dns_name_single_label(domain) > 0)
+ (dns_name_single_label(domain) > 0 &&
+ dns_name_equal(domain, "gateway") <= 0)) /* don't resolve "gateway" with LLMNR, let nss-myhostname handle this */
return DNS_SCOPE_MAYBE;
return DNS_SCOPE_NO;
commit a98433c05c5cce62a6a17db74e49363a88156486
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Dec 3 22:23:06 2014 +0100
rtnl: make checks for default routes more strict
Also check that the source netmask is 0, not only the destination
netmask.
diff --git a/src/libsystemd/sd-rtnl/local-addresses.c b/src/libsystemd/sd-rtnl/local-addresses.c
index 3ab9942..b669f90 100644
--- a/src/libsystemd/sd-rtnl/local-addresses.c
+++ b/src/libsystemd/sd-rtnl/local-addresses.c
@@ -197,7 +197,7 @@ int local_gateways(sd_rtnl *context, int ifindex, struct local_address **ret) {
for (m = reply; m; m = sd_rtnl_message_next(m)) {
struct local_address *a;
uint16_t type;
- unsigned char dst_len;
+ unsigned char dst_len, src_len;
uint32_t ifi;
r = sd_rtnl_message_get_errno(m);
@@ -211,14 +211,19 @@ int local_gateways(sd_rtnl *context, int ifindex, struct local_address **ret) {
if (type != RTM_NEWROUTE)
continue;
+ /* We only care for default routes */
r = sd_rtnl_message_route_get_dst_len(m, &dst_len);
if (r < 0)
return r;
-
- /* We only care for default routes */
if (dst_len != 0)
continue;
+ r = sd_rtnl_message_route_get_src_len(m, &src_len);
+ if (r < 0)
+ return r;
+ if (src_len != 0)
+ continue;
+
r = sd_rtnl_message_read_u32(m, RTA_OIF, &ifi);
if (r < 0)
return r;
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c
index 076c822..a2f7547 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) {
diff --git a/src/systemd/sd-rtnl.h b/src/systemd/sd-rtnl.h
index 554fc8b..bf1dde4 100644
--- a/src/systemd/sd-rtnl.h
+++ b/src/systemd/sd-rtnl.h
@@ -105,6 +105,7 @@ int sd_rtnl_message_route_set_dst_prefixlen(sd_rtnl_message *m, unsigned char pr
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_route_get_dst_len(sd_rtnl_message *m, unsigned char *dst_len);
+int sd_rtnl_message_route_get_src_len(sd_rtnl_message *m, unsigned char *src_len);
int sd_rtnl_message_neigh_get_family(sd_rtnl_message *m, int *family);
int sd_rtnl_message_neigh_get_ifindex(sd_rtnl_message *m, int *family);
More information about the systemd-commits
mailing list