[systemd-devel] [PATCH] nss-myhostname: also recognize "gateway."

harald at redhat.com harald at redhat.com
Mon Dec 15 02:34:24 PST 2014


From: Harald Hoyer <harald at redhat.com>

"gateway." skips adding the domain search path and saves some queries to
the nameserver.
---
 src/nss-myhostname/nss-myhostname.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c
index aa92cc9..2f76860 100644
--- a/src/nss-myhostname/nss-myhostname.c
+++ b/src/nss-myhostname/nss-myhostname.c
@@ -78,7 +78,7 @@ enum nss_status _nss_myhostname_gethostbyname4_r(
                 canonical = "localhost";
                 local_address_ipv4 = htonl(INADDR_LOOPBACK);
 
-        } else if (streq(name, "gateway")) {
+        } else if (streq(name, "gateway") || streq(name, "gateway.")) {
 
                 n_addresses = local_gateways(NULL, 0, AF_UNSPEC, &addresses);
                 if (n_addresses <= 0) {
@@ -348,7 +348,7 @@ enum nss_status _nss_myhostname_gethostbyname3_r(
                 canonical = "localhost";
                 local_address_ipv4 = htonl(INADDR_LOOPBACK);
 
-        } else if (streq(name, "gateway")) {
+        } else if (streq(name, "gateway") || streq(name, "gateway.")) {
 
                 n_addresses = local_gateways(NULL, 0, af, &addresses);
                 if (n_addresses <= 0) {
-- 
2.2.0



More information about the systemd-devel mailing list