SCCS-vsn: sbin/XNSrouted/input.c 5.8
SCCS-vsn: sbin/XNSrouted/main.c 5.8
SCCS-vsn: sbin/XNSrouted/startup.c 5.8
SCCS-vsn: sbin/XNSrouted/af.c 5.9
-static char sccsid[] = "@(#)af.c 5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)af.c 5.9 (Berkeley) %G%";
#endif /* not lint */
#include "defs.h"
#endif /* not lint */
#include "defs.h"
struct afswitch afswitch[AF_MAX] =
{ NIL, NIL, NIL, NIL, NIL, NIL, XNSNET, NIL, NIL, NIL, NIL };
struct afswitch afswitch[AF_MAX] =
{ NIL, NIL, NIL, NIL, NIL, NIL, XNSNET, NIL, NIL, NIL, NIL };
-struct sockaddr_ns xnnet_default = { AF_NS };
+struct sockaddr_ns xnnet_default = { sizeof(struct sockaddr_ns), AF_NS };
union ns_net ns_anynet;
union ns_net ns_zeronet;
union ns_net ns_anynet;
union ns_net ns_zeronet;
-static char sccsid[] = "@(#)input.c 5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)input.c 5.8 (Berkeley) %G%";
bzero(&sxn, sizeof (struct sockaddr_ns));
sxn.sns_family = AF_NS;
bzero(&sxn, sizeof (struct sockaddr_ns));
sxn.sns_family = AF_NS;
+ sxn.sns_len = sizeof (sxn);
sxn.sns_addr.x_net = net;
sxn.sns_addr.x_host = *(union ns_host *)ether_broadcast_addr;
return( (struct sockaddr *)&sxn);
sxn.sns_addr.x_net = net;
sxn.sns_addr.x_host = *(union ns_host *)ether_broadcast_addr;
return( (struct sockaddr *)&sxn);
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 5.8 (Berkeley) %G%";
ns_anynet.s_net[0] = -1; ns_anynet.s_net[1] = -1;
addr.sns_family = AF_NS;
ns_anynet.s_net[0] = -1; ns_anynet.s_net[1] = -1;
addr.sns_family = AF_NS;
+ addr.sns_len = sizeof(addr);
addr.sns_port = htons(IDPPORT_RIF);
s = getsocket(SOCK_DGRAM, 0, &addr);
if (s < 0)
addr.sns_port = htons(IDPPORT_RIF);
s = getsocket(SOCK_DGRAM, 0, &addr);
if (s < 0)
-static char sccsid[] = "@(#)startup.c 5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)startup.c 5.8 (Berkeley) %G%";
ifinit()
{
struct interface ifs, *ifp;
ifinit()
{
struct interface ifs, *ifp;
- char buf[(sizeof (struct ifreq ) * 20)];
+ char buf[BUFSIZ], *cp, *cplim;
struct ifreq ifreq, *ifr;
u_long i;
struct ifreq ifreq, *ifr;
u_long i;
}
ifr = ifc.ifc_req;
lookforinterfaces = 0;
}
ifr = ifc.ifc_req;
lookforinterfaces = 0;
- for (n = ifc.ifc_len / sizeof (struct ifreq); n > 0; n--, ifr++) {
+#ifdef RTM_ADD
+#define max(a, b) (a > b ? a : b)
+#define size(p) max((p).sa_len, sizeof(p))
+#else
+#define size(p) (sizeof (p))
+#endif
+ cplim = buf + ifc.ifc_len; /*skip over if's with big ifr_addr's */
+ for (cp = buf; cp < cplim;
+ cp += sizeof (ifr->ifr_name) + size(ifr->ifr_addr)) {
bzero((char *)&ifs, sizeof(ifs));
ifs.int_addr = ifr->ifr_addr;
ifreq = *ifr;
bzero((char *)&ifs, sizeof(ifs));
ifs.int_addr = ifr->ifr_addr;
ifreq = *ifr;