-/* $OpenBSD: bpf.c,v 1.3 1996/04/21 22:28:27 deraadt Exp $ */
-/* $NetBSD: bpf.c,v 1.25 1996/03/30 21:57:30 christos Exp $ */
+/* $OpenBSD: bpf.c,v 1.4 1996/05/10 12:31:05 deraadt Exp $ */
+/* $NetBSD: bpf.c,v 1.27 1996/05/07 05:26:02 thorpej Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
{
struct bpf_if *bp;
char *cp;
- int unit, s, error;
+ int unit_seen, i, s, error;
/*
- * Separate string into name part and unit number. Put a null
- * byte at the end of the name part, and compute the number.
- * If the a unit number is unspecified, the default is 0,
- * as initialized above. XXX This should be common code.
+ * Make sure the provided name has a unit number, and default
+ * it to '0' if not specified.
+ * XXX This is ugly ... do this differently?
*/
- unit = 0;
+ unit_seen = 0;
cp = ifr->ifr_name;
- cp[sizeof(ifr->ifr_name) - 1] = '\0';
- while (*cp++) {
- if (*cp >= '0' && *cp <= '9') {
- unit = *cp - '0';
- *cp++ = '\0';
- while (*cp)
- unit = 10 * unit + *cp++ - '0';
- break;
+ cp[sizeof(ifr->ifr_name) - 1] = '\0'; /* sanity */
+ while (*cp++)
+ if (*cp >= '0' && *cp <= '9')
+ unit_seen = 1;
+ if (!unit_seen) {
+ /* Make sure to leave room for the '\0'. */
+ for (i = 0; i < (IFNAMSIZ - 1); ++i) {
+ if ((ifr->ifr_name[i] >= 'a' &&
+ ifr->ifr_name[i] <= 'z') ||
+ (ifr->ifr_name[i] >= 'A' &&
+ ifr->ifr_name[i] <= 'Z'))
+ continue;
+ ifr->ifr_name[i] = '0';
}
}
+
/*
* Look through attached interfaces for the named one.
*/
for (bp = bpf_iflist; bp != 0; bp = bp->bif_next) {
struct ifnet *ifp = bp->bif_ifp;
- if (ifp == 0 || unit != ifp->if_unit
- || strcmp(ifp->if_name, ifr->ifr_name) != 0)
+ if (ifp == 0 ||
+ strcmp(ifp->if_xname, ifr->ifr_name) != 0)
continue;
/*
* We found the requested interface.
}
/*
- * Convert an interface name plus unit number of an ifp to a single
- * name which is returned in the ifr.
+ * Copy the interface name to the ifreq.
*/
static void
bpf_ifname(ifp, ifr)
struct ifnet *ifp;
struct ifreq *ifr;
{
- char *s = ifp->if_name;
- char *d = ifr->ifr_name;
- while ((*d++ = *s++) != '\0')
- continue;
- sprintf(d, "%d", ifp->if_unit);
+ bcopy(ifp->if_xname, ifr->ifr_name, IFNAMSIZ);
}
/*
D_MARKFREE(&bpf_dtab[i]);
#if 0
- printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit);
+ printf("bpf: %s attached\n", ifp->if_xname);
#endif
}
-/* $OpenBSD: if.c,v 1.8 1996/05/09 11:10:28 deraadt Exp $ */
-/* $NetBSD: if.c,v 1.24 1996/02/13 22:00:09 christos Exp $ */
+/* $OpenBSD: if.c,v 1.9 1996/05/10 12:31:07 deraadt Exp $ */
+/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
int if_index = 0;
struct ifaddr **ifnet_addrs;
-static char *sprint_d __P((u_int, char *, int));
/*
* Attach an interface to the
struct ifnet *ifp;
{
unsigned socksize, ifasize;
- int namelen, unitlen, masklen;
- char workbuf[12], *unitname;
+ int namelen, masklen;
register struct sockaddr_dl *sdl;
register struct ifaddr *ifa;
static int if_indexlim = 8;
/*
* create a Link Level name for this device
*/
- unitname = sprint_d((u_int)ifp->if_unit, workbuf, sizeof(workbuf));
- namelen = strlen(ifp->if_name);
- unitlen = strlen(unitname);
+ namelen = strlen(ifp->if_xname);
#define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m))
- masklen = _offsetof(struct sockaddr_dl, sdl_data[0]) +
- unitlen + namelen;
+ masklen = _offsetof(struct sockaddr_dl, sdl_data[0]) + namelen;
socksize = masklen + ifp->if_addrlen;
#define ROUNDUP(a) (1 + (((a) - 1) | (sizeof(long) - 1)))
if (socksize < sizeof(*sdl))
sdl = (struct sockaddr_dl *)(ifa + 1);
sdl->sdl_len = socksize;
sdl->sdl_family = AF_LINK;
- bcopy(ifp->if_name, sdl->sdl_data, namelen);
- bcopy(unitname, namelen + (caddr_t)sdl->sdl_data, unitlen);
- sdl->sdl_nlen = (namelen += unitlen);
+ bcopy(ifp->if_xname, sdl->sdl_data, namelen);
+ sdl->sdl_nlen = namelen;
sdl->sdl_index = ifp->if_index;
sdl->sdl_type = ifp->if_type;
ifnet_addrs[if_index - 1] = ifa;
if (ifp->if_timer == 0 || --ifp->if_timer)
continue;
if (ifp->if_watchdog)
- (*ifp->if_watchdog)(ifp->if_unit);
+ (*ifp->if_watchdog)(ifp);
}
splx(s);
timeout(if_slowtimo, NULL, hz / IFNET_SLOWHZ);
ifunit(name)
register char *name;
{
- register char *cp;
register struct ifnet *ifp;
- int unit;
- unsigned len;
- char *ep, c;
- for (cp = name; cp < name + IFNAMSIZ && *cp; cp++)
- if (*cp >= '0' && *cp <= '9')
- break;
- if (*cp == '\0' || cp == name + IFNAMSIZ)
- return ((struct ifnet *)0);
- /*
- * Save first char of unit, and pointer to it,
- * so we can put a null there to avoid matching
- * initial substrings of interface names.
- */
- len = cp - name + 1;
- c = *cp;
- ep = cp;
- for (unit = 0; *cp >= '0' && *cp <= '9'; )
- unit = unit * 10 + *cp++ - '0';
- *ep = 0;
- for (ifp = ifnet.tqh_first; ifp != 0; ifp = ifp->if_list.tqe_next) {
- if (bcmp(ifp->if_name, name, len))
- continue;
- if (unit == ifp->if_unit)
- break;
- }
- *ep = c;
- return (ifp);
+ for (ifp = ifnet.tqh_first; ifp != 0; ifp = ifp->if_list.tqe_next)
+ if (strcmp(ifp->if_xname, name) == 0)
+ return (ifp);
+
+ return (NULL);
}
/*
register struct ifconf *ifc = (struct ifconf *)data;
register struct ifnet *ifp;
register struct ifaddr *ifa;
- register char *cp, *ep;
struct ifreq ifr, *ifrp;
int space = ifc->ifc_len, error = 0;
- int i, ndig;
ifrp = ifc->ifc_req;
- ep = ifr.ifr_name + sizeof (ifr.ifr_name);
- for (ifp = ifnet.tqh_first;
- space > sizeof (ifr) && ifp != 0; ifp = ifp->if_list.tqe_next) {
- strncpy(ifr.ifr_name, ifp->if_name, sizeof(ifr.ifr_name) - 2);
- for (cp = ifr.ifr_name; cp < ep && *cp; cp++)
- continue;
- i = ifp->if_unit;
- ndig = 0;
- do {
- ndig++;
- i /= 10;
- } while (i);
- cp += ndig;
- if (cp >= ep)
- continue;
- *cp = '\0';
- i = ifp->if_unit;
- do {
- *--cp = '0' + i % 10;
- i /= 10;
- } while (i);
+ for (ifp = ifnet.tqh_first; space >= sizeof (ifr) && ifp != 0;
+ ifp = ifp->if_list.tqe_next) {
+ bcopy(ifp->if_xname, ifr.ifr_name, IFNAMSIZ);
if ((ifa = ifp->if_addrlist.tqh_first) == 0) {
bzero((caddr_t)&ifr.ifr_addr, sizeof(ifr.ifr_addr));
error = copyout((caddr_t)&ifr, (caddr_t)ifrp,
break;
space -= sizeof (ifr), ifrp++;
} else
- for (; space > sizeof (ifr) && ifa != 0; ifa = ifa->ifa_list.tqe_next) {
- register struct sockaddr *sa = ifa->ifa_addr;
+ for (; space >= sizeof (ifr) && ifa != 0;
+ ifa = ifa->ifa_list.tqe_next) {
+ register struct sockaddr *sa = ifa->ifa_addr;
#if defined(COMPAT_43) || defined(COMPAT_LINUX) || defined(COMPAT_SVR4)
- if (cmd == OSIOCGIFCONF) {
- struct osockaddr *osa =
- (struct osockaddr *)&ifr.ifr_addr;
- ifr.ifr_addr = *sa;
- osa->sa_family = sa->sa_family;
- error = copyout((caddr_t)&ifr, (caddr_t)ifrp,
- sizeof (ifr));
- ifrp++;
- } else
+ if (cmd == OSIOCGIFCONF) {
+ struct osockaddr *osa =
+ (struct osockaddr *)&ifr.ifr_addr;
+ ifr.ifr_addr = *sa;
+ osa->sa_family = sa->sa_family;
+ error = copyout((caddr_t)&ifr, (caddr_t)ifrp,
+ sizeof (ifr));
+ ifrp++;
+ } else
#endif
- if (sa->sa_len <= sizeof(*sa)) {
- ifr.ifr_addr = *sa;
- error = copyout((caddr_t)&ifr, (caddr_t)ifrp,
- sizeof (ifr));
- ifrp++;
- } else {
- space -= sa->sa_len - sizeof(*sa);
- if (space < sizeof (ifr))
+ if (sa->sa_len <= sizeof(*sa)) {
+ ifr.ifr_addr = *sa;
+ error = copyout((caddr_t)&ifr, (caddr_t)ifrp,
+ sizeof (ifr));
+ ifrp++;
+ } else {
+ space -= sa->sa_len - sizeof(*sa);
+ if (space < sizeof (ifr))
+ break;
+ error = copyout((caddr_t)&ifr, (caddr_t)ifrp,
+ sizeof (ifr.ifr_name));
+ if (error == 0)
+ error = copyout((caddr_t)sa,
+ (caddr_t)&ifrp->ifr_addr,
+ sa->sa_len);
+ ifrp = (struct ifreq *)(sa->sa_len +
+ (caddr_t)&ifrp->ifr_addr);
+ }
+ if (error)
break;
- error = copyout((caddr_t)&ifr, (caddr_t)ifrp,
- sizeof (ifr.ifr_name));
- if (error == 0)
- error = copyout((caddr_t)sa,
- (caddr_t)&ifrp->ifr_addr, sa->sa_len);
- ifrp = (struct ifreq *)
- (sa->sa_len + (caddr_t)&ifrp->ifr_addr);
+ space -= sizeof (ifr);
}
- if (error)
- break;
- space -= sizeof (ifr);
- }
}
ifc->ifc_len -= space;
return (error);
}
-
-static char *
-sprint_d(n, buf, buflen)
- u_int n;
- char *buf;
- int buflen;
-{
- register char *cp = buf + buflen - 1;
-
- *cp = 0;
- do {
- cp--;
- *cp = "0123456789"[n % 10];
- n /= 10;
- } while (n != 0);
- return (cp);
-}
-/* $OpenBSD: if.h,v 1.4 1996/05/06 05:43:43 mickey Exp $ */
-/* $NetBSD: if.h,v 1.20 1996/02/13 22:00:12 christos Exp $ */
+/* $OpenBSD: if.h,v 1.5 1996/05/10 12:31:07 deraadt Exp $ */
+/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
*/
TAILQ_HEAD(ifnet_head, ifnet); /* the actual queue head */
+/*
+ * Length of interface external name, including terminating '\0'.
+ * Note: this is the same size as a generic device's external name.
+ */
+#define IFNAMSIZ 16
+
struct ifnet { /* and the entries */
- char *if_name; /* name, e.g. ``en'' or ``lo'' */
+ void *if_softc; /* lower-level data for this if */
TAILQ_ENTRY(ifnet) if_list; /* all struct ifnets are chained */
TAILQ_HEAD(, ifaddr) if_addrlist; /* linked list of addresses per if */
+ char if_xname[IFNAMSIZ]; /* external name (name + unit) */
int if_pcount; /* number of promiscuous listeners */
caddr_t if_bpf; /* packet filter structure */
u_short if_index; /* numeric abbreviation for this if */
- short if_unit; /* sub-unit for lower level driver */
short if_timer; /* time 'til if_watchdog called */
short if_flags; /* up/down, broadcast, etc. */
struct if_data if_data; /* statistics and other data about if */
int (*if_ioctl) /* ioctl routine */
__P((struct ifnet *, u_long, caddr_t));
int (*if_reset) /* XXX bus reset routine */
- __P((int));
+ __P((struct ifnet *));
void (*if_watchdog) /* timer routine */
- __P((int));
+ __P((struct ifnet *));
struct ifqueue {
struct mbuf *ifq_head;
struct mbuf *ifq_tail;
* remainder may be interface specific.
*/
struct ifreq {
-#define IFNAMSIZ 16
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
union {
struct sockaddr ifru_addr;
-/* $NetBSD: if_arcsubr.c,v 1.7 1996/04/15 14:01:25 is Exp $ */
+/* $NetBSD: if_arcsubr.c,v 1.8 1996/05/07 02:40:29 thorpej Exp $ */
/*
* Copyright (c) 1994, 1995 Ignatios Souvatzis
break;
default:
- printf("%s%d: can't handle af%d\n", ifp->if_name, ifp->if_unit,
+ printf("%s: can't handle af%d\n", ifp->if_xname,
dst->sa_family);
senderr(EAFNOSUPPORT);
}
if (m)
m_freem(m);
- log(LOG_INFO,"%s%d: got out of seq. packet: %s\n",
- ifp->if_name, ifp->if_unit, s);
+ log(LOG_INFO,"%s: got out of seq. packet: %s\n",
+ ifp->if_xname, s);
return NULL;
}
ifp->if_hdrlen = ARC_HDRLEN;
if (ifp->if_flags & IFF_LINK0 && arc_phdsmtu > 60480)
log(LOG_ERR,
- "%s%d: arc_phdsmtu is %d, but must not exceed 60480",
- ifp->if_name, ifp->if_unit, arc_phdsmtu);
+ "%s: arc_phdsmtu is %d, but must not exceed 60480",
+ ifp->if_xname, arc_phdsmtu);
ifp->if_mtu = (ifp->if_flags & IFF_LINK0 ? arc_phdsmtu : ARCMTU);
ac = (struct arccom *)ifp;
ac->ac_seqid = (time.tv_sec) & 0xFFFF; /* try to make seqid unique */
if (ac->ac_anaddr == 0) {
/* XXX this message isn't entirely clear, to me -- cgd */
- log(LOG_ERR,"%s%d: link address 0 reserved for broadcasts. Please change it and ifconfig %s%d down up\n",
- ifp->if_name,ifp->if_unit,ifp->if_name,ifp->if_unit);
+ log(LOG_ERR,"%s: link address 0 reserved for broadcasts. Please change it and ifconfig %s down up\n",
+ ifp->if_xname, ifp->if_xname);
}
for (ifa = ifp->if_addrlist.tqh_first; ifa != 0;
ifa = ifa->ifa_list.tqe_next)
-/* $OpenBSD: if_ethersubr.c,v 1.11 1996/05/06 14:13:53 mickey Exp $ */
-/* $NetBSD: if_ethersubr.c,v 1.18 1996/02/13 22:00:14 christos Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.12 1996/05/10 12:31:08 deraadt Exp $ */
+/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
* Copyright (c) 1982, 1989, 1993
break;
default:
- printf("%s%d: can't handle af%d\n", ifp->if_name, ifp->if_unit,
+ printf("%s: can't handle af%d\n", ifp->if_xname,
dst->sa_family);
senderr(EAFNOSUPPORT);
}
-/* $NetBSD: if_fddisubr.c,v 1.3 1995/12/24 03:32:03 mycroft Exp $ */
+/* $NetBSD: if_fddisubr.c,v 1.4 1996/05/07 02:40:32 thorpej Exp $ */
/*
* Copyright (c) 1995
l = mtod(m, struct llc *);
l->llc_dsap = l->llc_ssap = LLC_ISO_LSAP;
l->llc_control = LLC_UI;
+#if defined(__FreeBSD__)
IFDEBUG(D_ETHER)
int i;
printf("unoutput: sending pkt to: ");
printf("%x ", edst[i] & 0xff);
printf("\n");
ENDDEBUG
+#endif
} break;
#endif /* ISO */
#ifdef LLC
}
#endif
default:
- printf("%s%d: can't handle af%d\n", ifp->if_name, ifp->if_unit,
+ printf("%s: can't handle af%d\n", ifp->if_xname,
dst->sa_family);
senderr(EAFNOSUPPORT);
}
if (m == 0)
return;
*mtod(m, struct fddi_header *) = *fh;
+#if defined(__FreeBSD__)
IFDEBUG(D_ETHER)
printf("clnp packet");
ENDDEBUG
+#endif
schednetisr(NETISR_ISO);
inq = &clnlintrq;
break;
-/* $OpenBSD: if_loop.c,v 1.4 1996/04/28 14:37:06 mickey Exp $ */
-/* $NetBSD: if_loop.c,v 1.14 1995/07/23 16:33:08 mycroft Exp $ */
+/* $OpenBSD: if_loop.c,v 1.5 1996/05/10 12:31:09 deraadt Exp $ */
+/* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
for (i = 0; i < NLOOP; i++) {
ifp = &loif[i];
- ifp->if_unit = i;
- ifp->if_name = "lo";
+ sprintf(ifp->if_xname, "lo%d", i);
+ ifp->if_softc = NULL;
ifp->if_mtu = LOMTU;
ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST;
ifp->if_ioctl = loioctl;
break;
#endif
default:
- printf("lo%d: can't handle af%d\n", ifp->if_unit,
+ printf("%s: can't handle af%d\n", ifp->if_xname,
dst->sa_family);
m_freem(m);
return (EAFNOSUPPORT);
-/* $OpenBSD: if_ppp.c,v 1.6 1996/04/21 22:28:32 deraadt Exp $ */
-/* $NetBSD: if_ppp.c,v 1.30 1996/03/19 01:00:49 paulus Exp $ */
+/* $OpenBSD: if_ppp.c,v 1.7 1996/05/10 12:31:10 deraadt Exp $ */
+/* $NetBSD: if_ppp.c,v 1.31 1996/05/07 02:40:36 thorpej Exp $ */
/*
* if_ppp.c - Point-to-Point Protocol (PPP) Asynchronous driver.
register int i = 0;
for (sc = ppp_softc; i < NPPP; sc++) {
- sc->sc_if.if_name = "ppp";
- sc->sc_if.if_unit = i++;
+ sc->sc_unit = i; /* XXX */
+ sprintf(sc->sc_if.if_xname, "ppp%d", i++);
+ sc->sc_if.if_softc = sc;
sc->sc_if.if_mtu = PPP_MTU;
sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
sc->sc_if.if_type = IFT_PPP;
break;
case PPPIOCGUNIT:
- *(int *)data = sc->sc_if.if_unit;
+ *(int *)data = sc->sc_unit; /* XXX */
break;
case PPPIOCGFLAGS:
sc->sc_xc_state = (*cp)->comp_alloc(ccp_option, nb);
if (sc->sc_xc_state == NULL) {
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: comp_alloc failed\n",
- sc->sc_if.if_unit);
+ printf("%s: comp_alloc failed\n",
+ sc->sc_if.if_xname);
error = ENOBUFS;
}
splhigh();
sc->sc_rc_state = (*cp)->decomp_alloc(ccp_option, nb);
if (sc->sc_rc_state == NULL) {
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: decomp_alloc failed\n",
- sc->sc_if.if_unit);
+ printf("%s: decomp_alloc failed\n",
+ sc->sc_if.if_xname);
error = ENOBUFS;
}
splhigh();
return (error);
}
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: no compressor for [%x %x %x], %x\n",
- sc->sc_if.if_unit, ccp_option[0], ccp_option[1],
+ printf("%s: no compressor for [%x %x %x], %x\n",
+ sc->sc_if.if_xname, ccp_option[0], ccp_option[1],
ccp_option[2], nb);
return (EINVAL); /* no handler found */
#endif /* PPP_COMPRESS */
caddr_t data;
{
struct proc *p = curproc; /* XXX */
- register struct ppp_softc *sc = &ppp_softc[ifp->if_unit];
+ register struct ppp_softc *sc = ifp->if_softc;
register struct ifaddr *ifa = (struct ifaddr *)data;
register struct ifreq *ifr = (struct ifreq *)data;
struct ppp_stats *psp;
struct sockaddr *dst;
struct rtentry *rtp;
{
- register struct ppp_softc *sc = &ppp_softc[ifp->if_unit];
+ register struct ppp_softc *sc = ifp->if_softc;
int protocol, address, control;
u_char *cp;
int s, error;
mode = NPMODE_PASS;
break;
default:
- printf("ppp%d: af%d not supported\n", ifp->if_unit, dst->sa_family);
+ printf("%s: af%d not supported\n", ifp->if_xname, dst->sa_family);
error = EAFNOSUPPORT;
goto bad;
}
len += m->m_len;
if (sc->sc_flags & SC_LOG_OUTPKT) {
- printf("ppp%d output: ", ifp->if_unit);
+ printf("%s output: ", ifp->if_xname);
pppdumpm(m0);
}
if (sc->sc_xc_state != NULL
&& (*sc->sc_xcomp->comp_init)
(sc->sc_xc_state, dp + CCP_HDRLEN, slen - CCP_HDRLEN,
- sc->sc_if.if_unit, 0, sc->sc_flags & SC_DEBUG)) {
+ sc->sc_unit, 0, sc->sc_flags & SC_DEBUG)) {
s = splhigh();
sc->sc_flags |= SC_COMP_RUN;
splx(s);
if (sc->sc_rc_state != NULL
&& (*sc->sc_rcomp->decomp_init)
(sc->sc_rc_state, dp + CCP_HDRLEN, slen - CCP_HDRLEN,
- sc->sc_if.if_unit, 0, sc->sc_mru,
+ sc->sc_unit, 0, sc->sc_mru,
sc->sc_flags & SC_DEBUG)) {
s = splhigh();
sc->sc_flags |= SC_DECOMP_RUN;
ilen = 0;
for (mp = m; mp != NULL; mp = mp->m_next)
ilen += mp->m_len;
- printf("ppp%d: got %d bytes\n", ifp->if_unit, ilen);
+ printf("%s: got %d bytes\n", ifp->if_xname, ilen);
pppdumpm(m);
}
* CCP down or issue a Reset-Req.
*/
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: decompress failed %d\n", ifp->if_unit, rv);
+ printf("%s: decompress failed %d\n", ifp->if_xname, rv);
s = splhigh();
sc->sc_flags |= SC_VJ_RESET;
if (rv == DECOMP_ERROR)
if (xlen <= 0) {
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: VJ uncompress failed on type comp\n",
- ifp->if_unit);
+ printf("%s: VJ uncompress failed on type comp\n",
+ ifp->if_xname);
goto bad;
}
if (xlen < 0) {
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: VJ uncompress failed on type uncomp\n",
- ifp->if_unit);
+ printf("%s: VJ uncompress failed on type uncomp\n",
+ ifp->if_xname);
goto bad;
}
IF_DROP(inq);
splx(s);
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: input queue full\n", ifp->if_unit);
+ printf("%s: input queue full\n", ifp->if_xname);
ifp->if_iqdrops++;
goto bad;
}
-/* $NetBSD: if_pppvar.h,v 1.3 1996/03/15 02:28:06 paulus Exp $ */
+/* $NetBSD: if_pppvar.h,v 1.4 1996/05/07 02:40:39 thorpej Exp $ */
/*
* if_pppvar.h - private structures and declarations for PPP.
*
*/
struct ppp_softc {
struct ifnet sc_if; /* network-visible interface */
+ int sc_unit; /* XXX unit number */
u_int sc_flags; /* control/status bits; see if_ppp.h */
void *sc_devp; /* pointer to device-dep structure */
void (*sc_start) __P((struct ppp_softc *)); /* start output proc */
-/* $OpenBSD: if_sl.c,v 1.3 1996/03/14 08:41:45 tholo Exp $ */
-/* $NetBSD: if_sl.c,v 1.38 1996/02/13 22:00:23 christos Exp $ */
+/* $OpenBSD: if_sl.c,v 1.4 1996/05/10 12:31:11 deraadt Exp $ */
+/* $NetBSD: if_sl.c,v 1.39 1996/05/07 02:40:43 thorpej Exp $ */
/*
* Copyright (c) 1987, 1989, 1992, 1993
register int i = 0;
for (sc = sl_softc; i < NSL; sc++) {
- sc->sc_if.if_name = "sl";
- sc->sc_if.if_unit = i++;
+ sprintf(sc->sc_if.if_xname, "sl%d", i++);
+ sc->sc_if.if_softc = sc;
+ sc->sc_unit = i; /* XXX */
sc->sc_if.if_mtu = SLMTU;
sc->sc_if.if_flags =
IFF_POINTOPOINT | SC_AUTOCOMP | IFF_MULTICAST;
switch (cmd) {
case SLIOCGUNIT:
- *(int *)data = sc->sc_if.if_unit;
+ *(int *)data = sc->sc_unit; /* XXX */
break;
default:
struct sockaddr *dst;
struct rtentry *rtp;
{
- register struct sl_softc *sc = &sl_softc[ifp->if_unit];
+ register struct sl_softc *sc = ifp->if_softc;
register struct ip *ip;
register struct ifqueue *ifq;
int s;
* the line protocol to support other address families.
*/
if (dst->sa_family != AF_INET) {
- printf("sl%d: af%d not supported\n", sc->sc_if.if_unit,
+ printf("%s: af%d not supported\n", sc->sc_if.if_xname,
dst->sa_family);
m_freem(m);
sc->sc_if.if_noproto++;
-/* $NetBSD: if_slvar.h,v 1.15 1995/03/26 20:30:14 jtc Exp $ */
+/* $NetBSD: if_slvar.h,v 1.16 1996/05/07 02:40:46 thorpej Exp $ */
/*-
* Copyright (c) 1991, 1993
*/
struct sl_softc {
struct ifnet sc_if; /* network-visible interface */
+ int sc_unit; /* XXX unit number */
struct ifqueue sc_fastq; /* interactive output queue */
struct tty *sc_ttyp; /* pointer to tty structure */
u_char *sc_mp; /* pointer to next available buf char */
-/* $OpenBSD: if_tun.c,v 1.8 1996/04/24 06:43:51 mickey Exp $ */
-/* $NetBSD: if_tun.c,v 1.22 1996/02/13 22:00:26 christos Exp $ */
+/* $OpenBSD: if_tun.c,v 1.9 1996/05/10 12:31:13 deraadt Exp $ */
+/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
* Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
int tunselect __P((dev_t, int, struct proc *));
-static int tuninit __P((int));
+static int tuninit __P((struct tun_softc *));
void
tunattach(unused)
tunctl[i].tun_flags = TUN_INITED;
ifp = &tunctl[i].tun_if;
- ifp->if_unit = i;
- ifp->if_name = "tun";
+ sprintf(ifp->if_xname, "tun%d", i);
+ ifp->if_softc = &tunctl[i];
ifp->if_mtu = TUNMTU;
ifp->if_ioctl = tun_ioctl;
ifp->if_output = tun_output;
return ENXIO;
ifp = &tp->tun_if;
tp->tun_flags |= TUN_OPEN;
- TUNDEBUG(("%s%d: open\n", ifp->if_name, ifp->if_unit));
+ TUNDEBUG(("%s: open\n", ifp->if_xname));
return (0);
}
tp->tun_pgrp = 0;
selwakeup(&tp->tun_rsel);
- TUNDEBUG(("%s%d: closed\n", ifp->if_name, ifp->if_unit));
+ TUNDEBUG(("%s: closed\n", ifp->if_xname));
return (0);
}
static int
-tuninit(unit)
- int unit;
+tuninit(tp)
+ struct tun_softc *tp;
{
- struct tun_softc *tp = &tunctl[unit];
struct ifnet *ifp = &tp->tun_if;
register struct ifaddr *ifa;
- TUNDEBUG(("%s%d: tuninit\n", ifp->if_name, ifp->if_unit));
+ TUNDEBUG(("%s: tuninit\n", ifp->if_xname));
ifp->if_flags |= IFF_UP | IFF_RUNNING;
s = splimp();
switch(cmd) {
case SIOCSIFADDR:
- tuninit(ifp->if_unit);
- TUNDEBUG(("%s%d: address set\n", ifp->if_name, ifp->if_unit));
+ tuninit((struct tun_softc *)(ifp->if_softc));
+ TUNDEBUG(("%s: address set\n", ifp->if_xname));
break;
case SIOCSIFDSTADDR:
- tuninit(ifp->if_unit);
- TUNDEBUG(("%s%d: destination address set\n",
- ifp->if_name, ifp->if_unit));
+ tuninit((struct tun_softc *)(ifp->if_softc));
+ TUNDEBUG(("%s: destination address set\n", ifp->if_name));
break;
default:
error = EINVAL;
struct sockaddr *dst;
struct rtentry *rt;
{
- struct tun_softc *tp = &tunctl[ifp->if_unit];
+ struct tun_softc *tp = ifp->if_softc;
struct proc *p;
int s;
- TUNDEBUG(("%s%d: tun_output\n", ifp->if_name, ifp->if_unit));
+ TUNDEBUG(("%s: tun_output\n", ifp->if_xname));
if ((tp->tun_flags & TUN_READY) != TUN_READY) {
- TUNDEBUG(("%s%d: not ready 0%o\n", ifp->if_name,
- ifp->if_unit, tp->tun_flags));
+ TUNDEBUG(("%s: not ready 0%o\n", ifp->if_xname,
+ tp->tun_flags));
m_freem (m0);
return EHOSTDOWN;
}
struct mbuf *m, *m0;
int error=0, len, s;
- TUNDEBUG(("%s%d: read\n", ifp->if_name, ifp->if_unit));
+ TUNDEBUG(("%s: read\n", ifp->if_xname));
if ((tp->tun_flags & TUN_READY) != TUN_READY) {
- TUNDEBUG(("%s%d: not ready 0%o\n", ifp->if_name,
- ifp->if_unit, tp->tun_flags));
+ TUNDEBUG(("%s: not ready 0%o\n", ifp->if_xname,
+ tp->tun_flags));
return EHOSTDOWN;
}
int isr;
int error=0, s, tlen, mlen;
- TUNDEBUG(("%s%d: tunwrite\n", ifp->if_name, ifp->if_unit));
+ TUNDEBUG(("%s: tunwrite\n", ifp->if_xname));
if (uio->uio_resid < 0 || uio->uio_resid > TUNMTU) {
- TUNDEBUG(("%s%d: len=%d!\n", ifp->if_name, ifp->if_unit,
- uio->uio_resid));
+ TUNDEBUG(("%s: len=%d!\n", ifp->if_xname, uio->uio_resid));
return EIO;
}
tlen = uio->uio_resid;
struct ifnet *ifp = &tp->tun_if;
s = splimp();
- TUNDEBUG(("%s%d: tunselect\n", ifp->if_name, ifp->if_unit));
+ TUNDEBUG(("%s: tunselect\n", ifp->if_xname));
switch (rw) {
case FREAD:
if (ifp->if_snd.ifq_len > 0) {
splx(s);
- TUNDEBUG(("%s%d: tunselect q=%d\n", ifp->if_name,
- ifp->if_unit, ifp->if_snd.ifq_len));
+ TUNDEBUG(("%s: tunselect q=%d\n", ifp->if_xname,
+ ifp->if_snd.ifq_len));
return 1;
}
selrecord(curproc, &tp->tun_rsel);
return 1;
}
splx(s);
- TUNDEBUG(("%s%d: tunselect waiting\n", ifp->if_name, ifp->if_unit));
+ TUNDEBUG(("%s: tunselect waiting\n", ifp->if_xname));
return 0;
}
-/* $OpenBSD: ppp_tty.c,v 1.3 1996/04/21 22:28:42 deraadt Exp $ */
-/* $NetBSD: ppp_tty.c,v 1.5 1996/03/15 02:28:10 paulus Exp $ */
+/* $OpenBSD: ppp_tty.c,v 1.4 1996/05/10 12:31:13 deraadt Exp $ */
+/* $NetBSD: ppp_tty.c,v 1.6 1996/05/07 02:40:51 thorpej Exp $ */
/*
* ppp_tty.c - Point-to-Point Protocol (PPP) driver for asynchronous
if (c & TTY_FE) {
/* framing error or overrun on this char - abort packet */
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: bad char %x\n", sc->sc_if.if_unit, c);
+ printf("%s: bad char %x\n", sc->sc_if.if_xname, c);
goto flush;
}
sc->sc_flags |= SC_PKTLOST; /* note the dropped packet */
if ((sc->sc_flags & (SC_FLUSH | SC_ESCAPED)) == 0){
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: bad fcs %x\n", sc->sc_if.if_unit,
+ printf("%s: bad fcs %x\n", sc->sc_if.if_xname,
sc->sc_fcs);
sc->sc_if.if_ierrors++;
sc->sc_stats.ppp_ierrors++;
if (ilen < PPP_HDRLEN + PPP_FCSLEN) {
if (ilen) {
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: too short (%d)\n", sc->sc_if.if_unit, ilen);
+ printf("%s: too short (%d)\n", sc->sc_if.if_xname, ilen);
sc->sc_if.if_ierrors++;
sc->sc_stats.ppp_ierrors++;
sc->sc_flags |= SC_PKTLOST;
pppgetm(sc);
if (sc->sc_m == NULL) {
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: no input mbufs!\n", sc->sc_if.if_unit);
+ printf("%s: no input mbufs!\n", sc->sc_if.if_xname);
goto flush;
}
}
if (c != PPP_ALLSTATIONS) {
if (sc->sc_flags & SC_REJ_COMP_AC) {
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: garbage received: 0x%x (need 0xFF)\n",
- sc->sc_if.if_unit, c);
+ printf("%s: garbage received: 0x%x (need 0xFF)\n",
+ sc->sc_if.if_xname, c);
goto flush;
}
*sc->sc_mp++ = PPP_ALLSTATIONS;
}
if (sc->sc_ilen == 1 && c != PPP_UI) {
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: missing UI (0x3), got 0x%x\n",
- sc->sc_if.if_unit, c);
+ printf("%s: missing UI (0x3), got 0x%x\n",
+ sc->sc_if.if_xname, c);
goto flush;
}
if (sc->sc_ilen == 2 && (c & 1) == 1) {
}
if (sc->sc_ilen == 3 && (c & 1) == 0) {
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: bad protocol %x\n", sc->sc_if.if_unit,
+ printf("%s: bad protocol %x\n", sc->sc_if.if_xname,
(sc->sc_mp[-1] << 8) + c);
goto flush;
}
/* packet beyond configured mru? */
if (++sc->sc_ilen > sc->sc_mru + PPP_HDRLEN + PPP_FCSLEN) {
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: packet too big\n", sc->sc_if.if_unit);
+ printf("%s: packet too big\n", sc->sc_if.if_xname);
goto flush;
}
pppgetm(sc);
if (m->m_next == NULL) {
if (sc->sc_flags & SC_DEBUG)
- printf("ppp%d: too few input mbufs!\n", sc->sc_if.if_unit);
+ printf("%s: too few input mbufs!\n", sc->sc_if.if_xname);
goto flush;
}
}
sc->sc_rawin[sc->sc_rawin_count++] = c;
if (sc->sc_rawin_count >= sizeof(sc->sc_rawin)
|| (c < 0 && sc->sc_rawin_count > 0)) {
- printf("ppp%d input: ", sc->sc_if.if_unit);
+ printf("%s input: ", sc->sc_if.if_xname);
pppdumpb(sc->sc_rawin, sc->sc_rawin_count);
sc->sc_rawin_count = 0;
}
-/* $OpenBSD: hd_output.c,v 1.2 1996/03/04 07:36:24 niklas Exp $ */
-/* $NetBSD: hd_output.c,v 1.6 1996/02/13 22:04:29 christos Exp $ */
+/* $OpenBSD: hd_output.c,v 1.3 1996/05/10 12:31:15 deraadt Exp $ */
+/* $NetBSD: hd_output.c,v 1.7 1996/05/07 02:36:06 thorpej Exp $ */
/*
* Copyright (c) University of British Columbia, 1984
if (IF_QFULL(&ifp->if_snd)) {
IF_DROP(&ifp->if_snd);
/*
- * printf("%s%d: HDLC says OK to send but queue full, may
- * hang\n", ifp->if_name, ifp->if_unit);
+ * printf("%s: HDLC says OK to send but queue full, may
+ * hang\n", ifp->if_xname);
*/
m_freem(m);
} else {
-/* $OpenBSD: llc_subr.c,v 1.2 1996/03/04 07:36:33 niklas Exp $ */
-/* $NetBSD: llc_subr.c,v 1.4 1996/02/13 22:04:51 christos Exp $ */
+/* $OpenBSD: llc_subr.c,v 1.3 1996/05/10 12:31:16 deraadt Exp $ */
+/* $NetBSD: llc_subr.c,v 1.5 1996/05/07 02:36:08 thorpej Exp $ */
/*
* Copyright (C) Dirk Husemann, Computer Science Department IV,
register int i;
/* print interface */
- printf("if %s%d\n", linkp->llcl_if->if_name, linkp->llcl_if->if_unit);
+ printf("if %s\n", linkp->llcl_if->if_xname);
/* print message */
printf(">> %s <<\n", message);
-/* $NetBSD: if_arp.c,v 1.29 1996/03/30 21:53:19 christos Exp $ */
+/* $NetBSD: if_arp.c,v 1.30 1996/05/07 02:40:41 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993
db_printf(" ifp=%p ", rt->rt_ifp);
if (rt->rt_ifp)
- db_printf("(%s%d)",
- rt->rt_ifp->if_name,
- rt->rt_ifp->if_unit);
+ db_printf("(%s)", rt->rt_ifp->if_xname);
else
db_printf("(NULL)");
-/* $OpenBSD: if_ether.c,v 1.5 1996/04/21 22:28:58 deraadt Exp $ */
-/* $NetBSD: if_ether.c,v 1.29 1996/03/30 21:53:19 christos Exp $ */
+/* $OpenBSD: if_ether.c,v 1.6 1996/05/10 12:31:19 deraadt Exp $ */
+/* $NetBSD: if_ether.c,v 1.30 1996/05/07 02:40:46 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1988, 1993
db_printf(" ifp=%p ", rt->rt_ifp);
if (rt->rt_ifp)
- db_printf("(%s%d)",
- rt->rt_ifp->if_name,
- rt->rt_ifp->if_unit);
+ db_printf("(%s)", rt->rt_ifp->if_xname);
else
db_printf("(NULL)");
-/* $OpenBSD: ip_mroute.c,v 1.3 1996/04/21 22:29:02 deraadt Exp $ */
-/* $NetBSD: ip_mroute.c,v 1.26 1996/03/16 23:54:00 christos Exp $ */
+/* $OpenBSD: ip_mroute.c,v 1.4 1996/05/10 12:31:19 deraadt Exp $ */
+/* $NetBSD: ip_mroute.c,v 1.27 1996/05/07 02:40:50 thorpej Exp $ */
/*
* IP multicast forwarding procedures
/* Create a fake encapsulation interface. */
ifp = (struct ifnet *)malloc(sizeof(*ifp), M_MRTABLE, M_WAITOK);
bzero(ifp, sizeof(*ifp));
- ifp->if_name = "mdecap";
- ifp->if_unit = vifcp->vifc_vifi;
+ sprintf(ifp->if_xname, "mdecap%d", vifcp->vifc_vifi);
/* Prepare cached route entry. */
bzero(&vifp->v_route, sizeof(vifp->v_route));
ip->ip_ttl++; /* compensate for -1 in *_send routines */
if (rsvpdebug && ip->ip_p == IPPROTO_RSVP) {
vifp = viftable + vifi;
- printf("Sending IPPROTO_RSVP from %x to %x on vif %d (%s%s%d)\n",
+ printf("Sending IPPROTO_RSVP from %x to %x on vif %d (%s%s)\n",
ntohl(ip->ip_src), ntohl(ip->ip_dst), vifi,
(vifp->v_flags & VIFF_TUNNEL) ? "tunnel on " : "",
- vifp->v_ifp->if_name, vifp->v_ifp->if_unit);
+ vifp->v_ifp->if_xname);
}
return (ip_mdq(m, ifp, rt, vifi));
}
-/* $OpenBSD: esis.c,v 1.3 1996/04/21 22:29:21 deraadt Exp $ */
-/* $NetBSD: esis.c,v 1.13 1996/04/13 01:34:39 cgd Exp $ */
+/* $OpenBSD: esis.c,v 1.4 1996/05/10 12:31:21 deraadt Exp $ */
+/* $NetBSD: esis.c,v 1.14 1996/05/07 02:45:04 thorpej Exp $ */
/*-
* Copyright (c) 1991, 1993
#ifdef ARGO_DEBUG
if (argo_debug[D_ESISOUTPUT]) {
printf(
- "esis_rdoutput: ifp %p (%s%d), ht %d, m %p, oidx %p\n",
- ifp, ifp->if_name, ifp->if_unit, esis_holding_time,
+ "esis_rdoutput: ifp %p (%s), ht %d, m %p, oidx %p\n",
+ ifp, ifp->if_xname, esis_holding_time,
inbound_m, inbound_oidx);
printf("\tdestination: %s\n", clnp_iso_addrp(rd_dstnsap));
printf("\tredirected toward:%s\n", clnp_iso_addrp(rd_gwnsap));
#ifdef ARGO_DEBUG
if (argo_debug[D_ESISOUTPUT]) {
int i;
- printf("esis_shoutput: ifp %p (%s%d), %s, ht %d, to: [%d] ",
- ifp, ifp->if_name, ifp->if_unit,
+ printf("esis_shoutput: ifp %p (%s), %s, ht %d, to: [%d] ",
+ ifp, ifp->if_xname,
type == ESIS_ESH ? "esh" : "ish",
ht, sn_len);
for (i = 0; i < sn_len; i++)
if (argo_debug[D_ISISINPUT]) {
int i;
- printf("isis_input: pkt on ifp %p (%s%d): from:",
- ifp, ifp->if_name, ifp->if_unit);
+ printf("isis_input: pkt on ifp %p (%s): from:",
+ ifp, ifp->if_xname);
for (i = 0; i < 6; i++)
printf("%x%c", shp->snh_shost[i] & 0xff,
(i < 5) ? ':' : ' ');
#ifdef ARGO_DEBUG
if (argo_debug[D_ISISOUTPUT]) {
u_char *cp = (u_char *) LLADDR(sdl), *cplim = cp + sn_len;
- printf("isis_output: ifp %p (%s%d), to: ",
- ifp, ifp->if_name, ifp->if_unit);
+ printf("isis_output: ifp %p (%s), to: ",
+ ifp, ifp->if_xname);
while (cp < cplim) {
printf("%x", *cp++);
printf("%c", (cp < cplim) ? ':' : ' ');
-/* $OpenBSD: if_eon.c,v 1.3 1996/04/21 22:29:23 deraadt Exp $ */
-/* $NetBSD: if_eon.c,v 1.13 1996/04/13 01:34:44 cgd Exp $ */
+/* $OpenBSD: if_eon.c,v 1.4 1996/05/10 12:31:22 deraadt Exp $ */
+/* $NetBSD: if_eon.c,v 1.14 1996/05/07 02:45:10 thorpej Exp $ */
/*-
* Copyright (c) 1991, 1993
printf("eonattach()\n");
}
#endif
- ifp->if_unit = 0;
- ifp->if_name = "eon";
+ sprintf(ifp->if_xname, "eon%d", 0);
ifp->if_mtu = ETHERMTU;
+ ifp->if_softc = NULL;
/* since everything will go out over ether or token ring */
ifp->if_ioctl = eonioctl;
-/* $OpenBSD: iso_snpac.c,v 1.3 1996/04/21 22:29:32 deraadt Exp $ */
-/* $NetBSD: iso_snpac.c,v 1.12 1996/04/13 01:35:00 cgd Exp $ */
+/* $OpenBSD: iso_snpac.c,v 1.4 1996/05/10 12:31:22 deraadt Exp $ */
+/* $NetBSD: iso_snpac.c,v 1.13 1996/05/07 02:45:16 thorpej Exp $ */
/*-
* Copyright (c) 1991, 1993
}
if (doreset) {
if (ifp->if_reset)
- (*ifp->if_reset) (ifp->if_unit);
+ (*ifp->if_reset) (ifp);
else
- printf("iso_setmcasts: %s%d needs reseting to receive iso mcasts\n",
- ifp->if_name, ifp->if_unit);
+ printf("iso_setmcasts: %s needs reseting to receive iso mcasts\n",
+ ifp->if_xname);
}
}
-/* $OpenBSD: ns_ip.c,v 1.3 1996/04/24 08:46:19 mickey Exp $ */
-/* $NetBSD: ns_ip.c,v 1.14 1996/02/13 22:13:58 christos Exp $ */
+/* $OpenBSD: ns_ip.c,v 1.4 1996/05/10 12:31:23 deraadt Exp $ */
+/* $NetBSD: ns_ip.c,v 1.15 1996/05/07 02:48:08 thorpej Exp $ */
/*
* Copyright (c) 1984, 1985, 1986, 1987, 1993
void nsip_rtchange __P((register struct in_addr *dst));
#define LOMTU (1024+512);
+int nsipif_unit; /* XXX */
struct ifnet nsipif;
struct ifnet_en *nsip_list; /* list of all hosts and gateways or
broadcast addrs */
if (nsipif.if_mtu == 0) {
ifp = &nsipif;
- ifp->if_name = "nsip";
+ sprintf(ifp->if_xname, "nsip%d", nsipif_unit);
ifp->if_mtu = LOMTU;
ifp->if_ioctl = nsipioctl;
ifp->if_output = nsipoutput;
nsip_list = m;
ifp = &m->ifen_ifnet;
- ifp->if_name = "nsip";
+ sprintf(ifp->if_xname, "nsip%d", nsipif_unit++);
ifp->if_mtu = LOMTU;
ifp->if_ioctl = nsipioctl;
ifp->if_output = nsipoutput;
ifp->if_start = nsipstart;
ifp->if_flags = IFF_POINTOPOINT;
- ifp->if_unit = nsipif.if_unit++;
if_attach(ifp);
+ /*
+ * XXX Emulate the side effect of incrementing nsipif.if_unit
+ * XXX in the days before if_xname.
+ */
+ bzero(nsipif.if_xname, sizeof(nsipif.if_xname))
+ sprintf(nsipif.if_xname, "nsip%d", nsipif_unit);
+
return (m);
}
panic("nsip_start called\n");
}
-struct ifreq ifr = {"nsip0"};
+struct ifreq ifr = {"nsip0"}; /* XXX */
nsip_route(m)
register struct mbuf *m;
/*
* now configure this as a point to point link
*/
- ifr.ifr_name[4] = '0' + nsipif.if_unit - 1;
+ bzero(ifr.ifr_name, sizeof(ifr.ifr_name));
+ sprintf(ifr.ifr_name, "nsip%d", nsipif_unit - 1);
ifr.ifr_dstaddr = *snstosa(ns_dst);
(void)ns_control((struct socket *)0, SIOCSIFDSTADDR, (caddr_t)&ifr,
(struct ifnet *)ifn);
-/* $OpenBSD: nfs_boot.c,v 1.4 1996/03/31 13:15:34 mickey Exp $ */
-/* $NetBSD: nfs_boot.c,v 1.25 1996/02/18 11:53:41 fvdl Exp $ */
+/* $OpenBSD: nfs_boot.c,v 1.5 1996/05/10 12:31:01 deraadt Exp $ */
+/* $NetBSD: nfs_boot.c,v 1.26 1996/05/07 02:51:25 thorpej Exp $ */
/*
* Copyright (c) 1995 Adam Glass, Gordon Ross
break;
if (ifp == NULL)
panic("nfs_boot: no suitable interface");
- sprintf(ireq.ifr_name, "%s%d", ifp->if_name, ifp->if_unit);
+ bcopy(ifp->if_xname, ireq.ifr_name, IFNAMSIZ);
printf("nfs_boot: using network interface '%s'\n",
ireq.ifr_name);