- } else if ((subnet != net) && ((lna & 0xff) == 0) &&
- (np = getnetbyaddr(subnet, AF_INET))) {
- struct in_addr subnaddr, inet_makeaddr();
-
- subnaddr = inet_makeaddr(subnet, INADDR_ANY);
- if (bcmp(&sin->sin_addr, &subnaddr, sizeof(subnaddr)) == 0)
- name = np->n_name;
- else
- goto host;
- } else {
-host:
- hp = gethostbyaddr(&sin->sin_addr,
- sizeof (struct in_addr), AF_INET);
- if (hp)
- name = hp->h_name;
+ else if (lna == INADDR_ANY) {
+ np = getnetbyaddr(net, AF_INET);
+ if (np)
+ name = np->n_name;
+ else if (net == 0)
+ name = "default";
+ } else if ((lna & 0xff) == 0 &&
+ (np = getnetbyaddr(subnet, AF_INET))) {
+ struct in_addr subnaddr, inet_makeaddr();
+
+ subnaddr = inet_makeaddr(subnet, INADDR_ANY);
+ if (bcmp(&sin->sin_addr, &subnaddr,
+ sizeof(subnaddr)) == 0)
+ name = np->n_name;
+ else
+ goto host;
+ } else {
+ host:
+ hp = gethostbyaddr(&sin->sin_addr,
+ sizeof (struct in_addr), AF_INET);
+ if (hp)
+ name = hp->h_name;
+ }
+ printf("\t%s(%s), metric %d\n", name,
+ inet_ntoa(sin->sin_addr), n->rip_metric);
+ } else
+ printf("\t%s, metric %d\n",
+ inet_ntoa(sin->sin_addr), n->rip_metric);
+ break;
+ }
+
+ default:
+ { u_short *p = (u_short *)n->rip_dst.sa_data;
+
+ printf("\t(af %d) %x %x %x %x %x %x %x, metric %d\n",
+ p[0], p[1], p[2], p[3], p[4], p[5], p[6],
+ n->rip_dst.sa_family,
+ n->rip_metric);
+ break;