summaryrefslogtreecommitdiffstats
path: root/usr.sbin/amd
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2014-10-24 10:29:56 +0000
committerschwarze <schwarze@openbsd.org>2014-10-24 10:29:56 +0000
commitd34a827a8cf9e819e4c8c5a0519ab0a92d79a143 (patch)
treeb28aee26324d59e64e4262d9ace3d89397688f79 /usr.sbin/amd
parenttedu networks(5) support; (diff)
downloadwireguard-openbsd-d34a827a8cf9e819e4c8c5a0519ab0a92d79a143.tar.xz
wireguard-openbsd-d34a827a8cf9e819e4c8c5a0519ab0a92d79a143.zip
retire networks(5) support;
OK deraadt@
Diffstat (limited to 'usr.sbin/amd')
-rw-r--r--usr.sbin/amd/amd/wire.c68
-rw-r--r--usr.sbin/amd/doc/amdref.texinfo4
2 files changed, 11 insertions, 61 deletions
diff --git a/usr.sbin/amd/amd/wire.c b/usr.sbin/amd/amd/wire.c
index f21fd57c515..7a137a8da04 100644
--- a/usr.sbin/amd/amd/wire.c
+++ b/usr.sbin/amd/amd/wire.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)wire.c 8.1 (Berkeley) 6/6/93
- * $Id: wire.c,v 1.12 2003/06/17 18:00:24 millert Exp $
+ * $Id: wire.c,v 1.13 2014/10/24 10:29:56 schwarze Exp $
*/
/*
@@ -72,7 +72,6 @@ getwire(void)
{
struct ifaddrs *ifa, *ifaddrs;
struct hostent *hp;
- struct netent *np;
addrlist *al;
char *s, *netname = NULL;
@@ -101,68 +100,19 @@ getwire(void)
al->ip_next = localnets;
localnets = al;
+ /*
+ * Look up the host name; fall back to a dotted quad.
+ */
if (netname == NULL) {
- in_addr_t net;
- in_addr_t mask;
in_addr_t subnet;
- in_addr_t subnetshift;
char dq[20];
- /*
- * Figure out the subnet's network address
- */
subnet = al->ip_addr & al->ip_mask;
-
-#ifdef IN_CLASSA
- subnet = ntohl(subnet);
-
- if (IN_CLASSA(subnet)) {
- mask = IN_CLASSA_NET;
- subnetshift = 8;
- } else if (IN_CLASSB(subnet)) {
- mask = IN_CLASSB_NET;
- subnetshift = 8;
- } else {
- mask = IN_CLASSC_NET;
- subnetshift = 4;
- }
-
- /*
- * If there are more bits than the standard mask
- * would suggest, subnets must be in use.
- * Guess at the subnet mask, assuming reasonable
- * width subnet fields.
- * XXX: Or-in at least 1 byte's worth of 1s to make
- * sure the top bits remain set.
- */
- while (subnet &~ mask)
- mask = (mask >> subnetshift) | 0xff000000;
-
- net = subnet & mask;
- while ((mask & 1) == 0)
- mask >>= 1, net >>= 1;
-
- /*
- * Now get a usable name.
- * First use the network database,
- * then the host database,
- * and finally just make a dotted quad.
- */
- np = getnetbyaddr(net, AF_INET);
-#else
- /* This is probably very wrong. */
- np = getnetbyaddr(subnet, AF_INET);
-#endif /* IN_CLASSA */
- if (np)
- s = np->n_name;
- else {
- subnet = al->ip_addr & al->ip_mask;
- hp = gethostbyaddr((char *) &subnet, 4, AF_INET);
- if (hp)
- s = hp->h_name;
- else
- s = inet_dquad(dq, sizeof(dq), subnet);
- }
+ hp = gethostbyaddr((char *) &subnet, 4, AF_INET);
+ if (hp)
+ s = hp->h_name;
+ else
+ s = inet_dquad(dq, sizeof(dq), subnet);
netname = strdup(s);
}
}
diff --git a/usr.sbin/amd/doc/amdref.texinfo b/usr.sbin/amd/doc/amdref.texinfo
index 07ff9ec4f33..7b1f1fe8a43 100644
--- a/usr.sbin/amd/doc/amdref.texinfo
+++ b/usr.sbin/amd/doc/amdref.texinfo
@@ -36,7 +36,7 @@
@c OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
@c
@c from: @(#)amdref.texinfo 8.1 (Berkeley) 6/6/93
-@c $Id: amdref.texinfo,v 1.11 2004/02/19 23:40:38 deraadt Exp $
+@c $Id: amdref.texinfo,v 1.12 2014/10/24 10:29:56 schwarze Exp $
@c
@setfilename amdref.info
@c @setfilename /usr/local/emacs/info/amd
@@ -1238,7 +1238,7 @@ the full pathname of the name being resolved. For example
@cindex Mount selector; wire
@cindex Selector; wire
the name of the network to which the primary network interface is
-attached. If a symbolic name cannot be found in the networks or hosts
+attached. If a symbolic name cannot be found in the hosts
database then dotted IP address format is used. This value is also
output by the ``-v'' option.