diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-02-05 13:41:05 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-02-05 13:41:05 +0000 |
commit | 24321b1e3f012bc7e4755c6e393e11c1665eb831 (patch) | |
tree | 451c73f0d9543b8f0467854c91b1797a9b2ad24c /usr.sbin/rarpd | |
parent | 5b889e887219a5c781e612d236c9059501015058 (diff) |
for -a, survive existance of non-ethernet non-pointtopoint interfaces, Jean-Luc.Richier@imag.fr
Diffstat (limited to 'usr.sbin/rarpd')
-rw-r--r-- | usr.sbin/rarpd/rarpd.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/usr.sbin/rarpd/rarpd.c b/usr.sbin/rarpd/rarpd.c index 16771c32655..7aecd9cb7b2 100644 --- a/usr.sbin/rarpd/rarpd.c +++ b/usr.sbin/rarpd/rarpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rarpd.c,v 1.7 1997/01/22 09:22:01 deraadt Exp $ */ +/* $OpenBSD: rarpd.c,v 1.8 1997/02/05 13:41:04 deraadt Exp $ */ /* $NetBSD: rarpd.c,v 1.12 1996/03/21 18:28:23 jtc Exp $ */ /* @@ -28,7 +28,7 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char rcsid[] = "$OpenBSD: rarpd.c,v 1.7 1997/01/22 09:22:01 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: rarpd.c,v 1.8 1997/02/05 13:41:04 deraadt Exp $"; #endif @@ -197,21 +197,27 @@ init_one(ifname) char *ifname; { struct if_info *p; + int fd; /* first check to see if this "if" was already opened? */ for(p = iflist; p; p = p->ii_next) if (!strncmp(p->ii_name, ifname, IFNAMSIZ)) return; + fd = rarp_open(ifname); + if (fd < 0) + return; + p = (struct if_info *)malloc(sizeof(*p)); if (p == 0) { err(FATAL, "malloc: %s", strerror(errno)); /* NOTREACHED */ } + p->ii_next = iflist; iflist = p; - p->ii_fd = rarp_open(ifname); + p->ii_fd = fd; strncpy(p->ii_name, ifname, IFNAMSIZ); lookup_eaddr(ifname, p->ii_eaddr); lookup_ipaddr(ifname, &p->ii_ipaddr, &p->ii_netmask); @@ -336,6 +342,10 @@ rarp_open(device) } (void) strncpy(ifr.ifr_name, device, sizeof ifr.ifr_name); if (ioctl(fd, BIOCSETIF, (caddr_t) & ifr) < 0) { + if (aflag) { /* for -a skip not ethernet interfaces */ + close(fd); + return -1; + } err(FATAL, "BIOCSETIF: %s", strerror(errno)); /* NOTREACHED */ } @@ -346,6 +356,10 @@ rarp_open(device) /* NOTREACHED */ } if (dlt != DLT_EN10MB) { + if (aflag) { /* for -a skip not ethernet interfaces */ + close(fd); + return -1; + } err(FATAL, "%s is not an ethernet", device); /* NOTREACHED */ } |