chiark / gitweb /
nss-myhostname: also recognize "gateway."
authorHarald Hoyer <harald@redhat.com>
Mon, 15 Dec 2014 10:34:24 +0000 (11:34 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 16 Dec 2014 05:30:34 +0000 (00:30 -0500)
"gateway." skips adding the domain search path and saves some queries to
the nameserver.

src/nss-myhostname/nss-myhostname.c

index aa92cc9..2f76860 100644 (file)
@@ -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) {