From 16ad55d2abb8c8db4e0c6e68ae925f9205935978 Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 23 Jul 1996 22:00:14 +0000 Subject: [PATCH] Submitted by: archie@whistle.com slight cleanups on yesterday's patches --- sbin/route/route.c | 5 +++-- sys/netatalk/at_control.c | 21 +++++++++++---------- sys/netatalk/at_proto.c | 2 +- sys/netatalk/at_var.h | 2 +- usr.bin/netstat/route.c | 4 ++-- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/sbin/route/route.c b/sbin/route/route.c index 1a00d5261834..b2d1eb83370e 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -43,7 +43,7 @@ static const char copyright[] = static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94"; */ static const char rcsid[] = - "$Id: route.c,v 1.9 1996/07/09 19:02:28 julian Exp $"; + "$Id: route.c,v 1.10 1996/07/23 01:18:47 julian Exp $"; #endif /* not lint */ #include @@ -891,7 +891,8 @@ getaddr(which, s, hpp) case AF_APPLETALK: if (!atalk_aton(s, &su->sat.sat_addr)) errx(EX_NOHOST, "bad address: %s", s); - return(su->sat.sat_addr.s_node != 0); + rtm_addrs |= RTA_NETMASK; + return(forcehost || su->sat.sat_addr.s_node != 0); case AF_LINK: link_addr(s, &su->sdl); diff --git a/sys/netatalk/at_control.c b/sys/netatalk/at_control.c index 8ae0f62b98f5..91e8653c1c82 100644 --- a/sys/netatalk/at_control.c +++ b/sys/netatalk/at_control.c @@ -136,7 +136,7 @@ at_control( int cmd, caddr_t data, struct ifnet *ifp, struct proc *p ) } aa->aa_ifa.ifa_addr = (struct sockaddr *)&aa->aa_addr; - aa->aa_ifa.ifa_dstaddr = (struct sockaddr *)&aa->aa_addr; + aa->aa_ifa.ifa_dstaddr = (struct sockaddr *)&aa->aa_dstaddr; aa->aa_ifa.ifa_netmask = (struct sockaddr *)&aa->aa_netmask; /* @@ -378,29 +378,30 @@ at_ifinit( ifp, aa, sat ) return( error ); } - /* Initialize interface netmask, which is silly for us */ + /* Initialize netmask and broadcast address */ bzero(&aa->aa_netmask, sizeof(aa->aa_netmask)); + aa->aa_ifa.ifa_netmask = (struct sockaddr *) &aa->aa_netmask; aa->aa_netmask.sat_len = sizeof(struct sockaddr_at); aa->aa_netmask.sat_family = AF_APPLETALK; - aa->aa_ifa.ifa_netmask = (struct sockaddr *) &aa->aa_netmask; + + bzero(&aa->aa_broadaddr, sizeof(aa->aa_broadaddr)); + aa->aa_ifa.ifa_broadaddr = (struct sockaddr *) &aa->aa_broadaddr; + aa->aa_broadaddr.sat_len = sizeof(struct sockaddr_at); + aa->aa_broadaddr.sat_family = AF_APPLETALK; /* "Add a route to the network" */ aa->aa_ifa.ifa_metric = ifp->if_metric; if (ifp->if_flags & IFF_BROADCAST) { - bzero(&aa->aa_broadaddr, sizeof(aa->aa_broadaddr)); - aa->aa_broadaddr.sat_len = sat->sat_len; - aa->aa_broadaddr.sat_family = AF_APPLETALK; aa->aa_broadaddr.sat_addr.s_net = htons(0); aa->aa_broadaddr.sat_addr.s_node = 0xff; - aa->aa_ifa.ifa_broadaddr = (struct sockaddr *) &aa->aa_broadaddr; aa->aa_netmask.sat_addr.s_net = htons(0xffff); /* XXX */ - aa->aa_netmask.sat_addr.s_node = htons(0); /* XXX */ + aa->aa_netmask.sat_addr.s_node = 0; /* XXX */ } else if (ifp->if_flags & IFF_LOOPBACK) { aa->aa_ifa.ifa_dstaddr = aa->aa_ifa.ifa_addr; aa->aa_netmask.sat_addr.s_net = htons(0xffff); /* XXX */ - aa->aa_netmask.sat_addr.s_node = htons(0xffff); /* XXX */ + aa->aa_netmask.sat_addr.s_node = 0xff; /* XXX */ flags |= RTF_HOST; } else if (ifp->if_flags & IFF_POINTOPOINT) { aa->aa_ifa.ifa_dstaddr = aa->aa_ifa.ifa_addr; @@ -408,7 +409,7 @@ at_ifinit( ifp, aa, sat ) aa->aa_netmask.sat_addr.s_node = htons(0xffff); flags |= RTF_HOST; } - error = rtinit(&(aa->aa_ifa), (int)RTM_ADD, flags); + error = rtinit(&aa->aa_ifa, RTM_ADD, flags); #if 0 if ( ifp->if_flags & IFF_LOOPBACK ) { diff --git a/sys/netatalk/at_proto.c b/sys/netatalk/at_proto.c index ce830b6c30d8..2c65e5b5f3ae 100644 --- a/sys/netatalk/at_proto.c +++ b/sys/netatalk/at_proto.c @@ -66,7 +66,7 @@ struct domain atalkdomain = { AF_APPLETALK, "appletalk", 0, 0, 0, atalksw, &atalksw[sizeof(atalksw)/sizeof(atalksw[0])], 0, rn_inithead, - ((caddr_t) &((struct sockaddr_at *) 0)->sat_addr - (caddr_t)0), + 8 * (u_long) &((struct sockaddr_at *) 0)->sat_addr, sizeof(struct sockaddr_at) }; diff --git a/sys/netatalk/at_var.h b/sys/netatalk/at_var.h index 49af480f6cf5..f3977cc3b493 100644 --- a/sys/netatalk/at_var.h +++ b/sys/netatalk/at_var.h @@ -32,7 +32,7 @@ struct at_ifaddr { # define aa_ifp aa_ifa.ifa_ifp struct sockaddr_at aa_addr; struct sockaddr_at aa_broadaddr; -# define aa_dstaddr aa_netmask +# define aa_dstaddr aa_broadaddr; struct sockaddr_at aa_netmask; int aa_flags; u_short aa_firstnet, aa_lastnet; diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 77cd001bdcf8..6140477ef70d 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -36,7 +36,7 @@ static char sccsid[] = "From: @(#)route.c 8.6 (Berkeley) 4/28/95"; #endif static const char rcsid[] = - "$Id: route.c,v 1.16 1996/06/15 17:08:40 peter Exp $"; + "$Id: route.c,v 1.17 1996/07/23 01:18:17 julian Exp $"; #endif /* not lint */ #include @@ -418,7 +418,7 @@ p_sockaddr(sa, mask, flags, width) } case AF_APPLETALK: { - if (mask) + if (!(flags & RTF_HOST) && mask) cp = atalk_print2(sa,mask,11); else cp = atalk_print(sa,11);