summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bpf.c33
-rw-r--r--sys/net/bpf_filter.c94
-rw-r--r--sys/net/bpfdesc.h4
-rw-r--r--sys/net/bridge.c23
-rw-r--r--sys/net/bridge.h2
-rw-r--r--sys/net/if.c56
-rw-r--r--sys/net/if_atmsubr.c6
-rw-r--r--sys/net/if_disc.c30
-rw-r--r--sys/net/if_ethersubr.c23
-rw-r--r--sys/net/if_mib.c5
-rw-r--r--sys/net/if_sppp.h21
-rw-r--r--sys/net/if_spppsubr.c333
-rw-r--r--sys/net/if_tun.c36
-rw-r--r--sys/net/if_tunvar.h4
-rw-r--r--sys/net/if_var.h7
-rw-r--r--sys/net/if_vlan.c6
-rw-r--r--sys/net/ppp_tty.c11
17 files changed, 270 insertions, 424 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 001d797fed4af..f9a217b5e3343 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -37,7 +37,7 @@
*
* @(#)bpf.c 8.2 (Berkeley) 3/28/94
*
- * $Id: bpf.c,v 1.45 1998/11/11 10:04:09 truckman Exp $
+ * $Id: bpf.c,v 1.43 1998/10/04 23:04:48 alex Exp $
*/
#include "bpfilter.h"
@@ -61,7 +61,6 @@
#include <sys/filio.h>
#include <sys/sockio.h>
#include <sys/ttycom.h>
-#include <sys/filedesc.h>
#if defined(sparc) && BSD < 199103
#include <sys/stream.h>
@@ -380,7 +379,6 @@ bpfclose(dev, flags, fmt, p)
register struct bpf_d *d = &bpf_dtab[minor(dev)];
register int s;
- funsetown(d->bd_sigio);
s = splimp();
if (d->bd_bif)
bpf_detachd(d);
@@ -536,9 +534,14 @@ static inline void
bpf_wakeup(d)
register struct bpf_d *d;
{
+ struct proc *p;
+
wakeup((caddr_t)d);
- if (d->bd_async && d->bd_sig && d->bd_sigio)
- pgsigio(d->bd_sigio, d->bd_sig, 0);
+ if (d->bd_async && d->bd_sig)
+ if (d->bd_pgid > 0)
+ gsignal (d->bd_pgid, d->bd_sig);
+ else if (p = pfind (-d->bd_pgid))
+ psignal (p, d->bd_sig);
#if BSD >= 199103
selwakeup(&d->bd_sel);
@@ -831,22 +834,18 @@ bpfioctl(dev, cmd, addr, flags, p)
d->bd_async = *(int *)addr;
break;
- case FIOSETOWN:
- error = fsetown(*(int *)addr, &d->bd_sigio);
- break;
-
- case FIOGETOWN:
- *(int *)addr = fgetown(d->bd_sigio);
- break;
+/* N.B. ioctl (FIOSETOWN) and fcntl (F_SETOWN) both end up doing the
+ equivalent of a TIOCSPGRP and hence end up here. *However* TIOCSPGRP's arg
+ is a process group if it's positive and a process id if it's negative. This
+ is exactly the opposite of what the other two functions want! Therefore
+ there is code in ioctl and fcntl to negate the arg before calling here. */
- /* This is deprecated, FIOSETOWN should be used instead. */
- case TIOCSPGRP:
- error = fsetown(-(*(int *)addr), &d->bd_sigio);
+ case TIOCSPGRP: /* Process or group to send signals to */
+ d->bd_pgid = *(int *)addr;
break;
- /* This is deprecated, FIOGETOWN should be used instead. */
case TIOCGPGRP:
- *(int *)addr = -fgetown(d->bd_sigio);
+ *(int *)addr = d->bd_pgid;
break;
case BIOCSRSIG: /* Set receive signal */
diff --git a/sys/net/bpf_filter.c b/sys/net/bpf_filter.c
index a452448390341..63f78f8e889d7 100644
--- a/sys/net/bpf_filter.c
+++ b/sys/net/bpf_filter.c
@@ -37,7 +37,7 @@
*
* @(#)bpf_filter.c 8.1 (Berkeley) 6/10/93
*
- * $Id: bpf_filter.c,v 1.11 1998/12/07 03:26:34 eivind Exp $
+ * $Id: bpf_filter.c,v 1.8 1997/02/22 09:40:57 peter Exp $
*/
#include <sys/param.h>
@@ -46,30 +46,27 @@
#include <netinet/in.h>
#endif
-#if defined(sparc) || defined(mips) || defined(ibm032) || defined(__alpha__)
+#if defined(sparc) || defined(mips) || defined(ibm032)
#define BPF_ALIGN
#endif
#ifndef BPF_ALIGN
-#define EXTRACT_SHORT(p) ((u_int16_t)ntohs(*(u_int16_t *)p))
-#define EXTRACT_LONG(p) (ntohl(*(u_int32_t *)p))
+#define EXTRACT_SHORT(p) ((u_short)ntohs(*(u_short *)p))
+#define EXTRACT_LONG(p) (ntohl(*(u_long *)p))
#else
#define EXTRACT_SHORT(p)\
- ((u_int16_t)\
- ((u_int16_t)*((u_char *)p+0)<<8|\
- (u_int16_t)*((u_char *)p+1)<<0))
+ ((u_short)\
+ ((u_short)*((u_char *)p+0)<<8|\
+ (u_short)*((u_char *)p+1)<<0))
#define EXTRACT_LONG(p)\
- ((u_int32_t)*((u_char *)p+0)<<24|\
- (u_int32_t)*((u_char *)p+1)<<16|\
- (u_int32_t)*((u_char *)p+2)<<8|\
- (u_int32_t)*((u_char *)p+3)<<0)
+ ((u_long)*((u_char *)p+0)<<24|\
+ (u_long)*((u_char *)p+1)<<16|\
+ (u_long)*((u_char *)p+2)<<8|\
+ (u_long)*((u_char *)p+3)<<0)
#endif
#ifdef KERNEL
#include <sys/mbuf.h>
-#endif
-#include <net/bpf.h>
-#ifdef KERNEL
#define MINDEX(m, k) \
{ \
register int len = m->m_len; \
@@ -83,16 +80,15 @@
} \
}
-static u_int16_t m_xhalf __P((struct mbuf *m, bpf_u_int32 k, int *err));
-static u_int32_t m_xword __P((struct mbuf *m, bpf_u_int32 k, int *err));
+static int m_xhalf __P((struct mbuf *m, int k, int *err));
+static int m_xword __P((struct mbuf *m, int k, int *err));
-static u_int32_t
+static int
m_xword(m, k, err)
register struct mbuf *m;
- register bpf_u_int32 k;
- register int *err;
+ register int k, *err;
{
- register size_t len;
+ register int len;
register u_char *cp, *np;
register struct mbuf *m0;
@@ -117,38 +113,27 @@ m_xword(m, k, err)
switch (len - k) {
case 1:
- return
- ((u_int32_t)cp[0] << 24) |
- ((u_int32_t)np[0] << 16) |
- ((u_int32_t)np[1] << 8) |
- (u_int32_t)np[2];
+ return (cp[0] << 24) | (np[0] << 16) | (np[1] << 8) | np[2];
case 2:
- return
- ((u_int32_t)cp[0] << 24) |
- ((u_int32_t)cp[1] << 16) |
- ((u_int32_t)np[0] << 8) |
- (u_int32_t)np[1];
+ return (cp[0] << 24) | (cp[1] << 16) | (np[0] << 8) |
+ np[1];
default:
- return
- ((u_int32_t)cp[0] << 24) |
- ((u_int32_t)cp[1] << 16) |
- ((u_int32_t)cp[2] << 8) |
- (u_int32_t)np[0];
+ return (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) |
+ np[0];
}
bad:
*err = 1;
return 0;
}
-static u_int16_t
+static int
m_xhalf(m, k, err)
register struct mbuf *m;
- register bpf_u_int32 k;
- register int *err;
+ register int k, *err;
{
- register size_t len;
+ register int len;
register u_char *cp;
register struct mbuf *m0;
@@ -176,6 +161,7 @@ m_xhalf(m, k, err)
}
#endif
+#include <net/bpf.h>
/*
* Execute the filter program starting at pc on the packet p
* wirelen is the length of the original packet
@@ -188,9 +174,9 @@ bpf_filter(pc, p, wirelen, buflen)
u_int wirelen;
register u_int buflen;
{
- register u_int32_t A = 0, X = 0;
- register bpf_u_int32 k;
- int32_t mem[BPF_MEMWORDS];
+ register u_long A = 0, X = 0;
+ register int k;
+ long mem[BPF_MEMWORDS];
if (pc == 0)
/*
@@ -217,7 +203,7 @@ bpf_filter(pc, p, wirelen, buflen)
case BPF_LD|BPF_W|BPF_ABS:
k = pc->k;
- if (k > buflen || sizeof(int32_t) > buflen - k) {
+ if (k + sizeof(long) > buflen) {
#ifdef KERNEL
int merr;
@@ -232,16 +218,16 @@ bpf_filter(pc, p, wirelen, buflen)
#endif
}
#ifdef BPF_ALIGN
- if (((intptr_t)(p + k) & 3) != 0)
+ if (((int)(p + k) & 3) != 0)
A = EXTRACT_LONG(&p[k]);
else
#endif
- A = ntohl(*(int32_t *)(p + k));
+ A = ntohl(*(long *)(p + k));
continue;
case BPF_LD|BPF_H|BPF_ABS:
k = pc->k;
- if (k > buflen || sizeof(int16_t) > buflen - k) {
+ if (k + sizeof(short) > buflen) {
#ifdef KERNEL
int merr;
@@ -285,7 +271,7 @@ bpf_filter(pc, p, wirelen, buflen)
case BPF_LD|BPF_W|BPF_IND:
k = X + pc->k;
- if (pc->k > buflen || X > buflen - pc->k || sizeof(int32_t) > buflen - k) {
+ if (k + sizeof(long) > buflen) {
#ifdef KERNEL
int merr;
@@ -300,16 +286,16 @@ bpf_filter(pc, p, wirelen, buflen)
#endif
}
#ifdef BPF_ALIGN
- if (((intptr_t)(p + k) & 3) != 0)
+ if (((int)(p + k) & 3) != 0)
A = EXTRACT_LONG(&p[k]);
else
#endif
- A = ntohl(*(int32_t *)(p + k));
+ A = ntohl(*(long *)(p + k));
continue;
case BPF_LD|BPF_H|BPF_IND:
k = X + pc->k;
- if (X > buflen || pc->k > buflen - X || sizeof(int16_t) > buflen - k) {
+ if (k + sizeof(short) > buflen) {
#ifdef KERNEL
int merr;
@@ -328,7 +314,7 @@ bpf_filter(pc, p, wirelen, buflen)
case BPF_LD|BPF_B|BPF_IND:
k = X + pc->k;
- if (pc->k >= buflen || X >= buflen - k) {
+ if (k >= buflen) {
#ifdef KERNEL
register struct mbuf *m;
@@ -534,10 +520,10 @@ bpf_validate(f, len)
register int from = i + 1;
if (BPF_OP(p->code) == BPF_JA) {
- if (from >= len || p->k >= len - from)
+ if (from + p->k >= len)
return 0;
}
- else if (from >= len || p->jt >= len - from || p->jf >= len - from)
+ else if (from + p->jt >= len || from + p->jf >= len)
return 0;
}
/*
@@ -546,7 +532,7 @@ bpf_validate(f, len)
if ((BPF_CLASS(p->code) == BPF_ST ||
(BPF_CLASS(p->code) == BPF_LD &&
(p->code & 0xe0) == BPF_MEM)) &&
- p->k >= BPF_MEMWORDS)
+ (p->k >= BPF_MEMWORDS || p->k < 0))
return 0;
/*
* Check for constant division by 0.
diff --git a/sys/net/bpfdesc.h b/sys/net/bpfdesc.h
index 39ac4897915ff..aa7f4622816c4 100644
--- a/sys/net/bpfdesc.h
+++ b/sys/net/bpfdesc.h
@@ -37,7 +37,7 @@
*
* @(#)bpfdesc.h 8.1 (Berkeley) 6/10/93
*
- * $Id: bpfdesc.h,v 1.11 1998/11/11 10:04:09 truckman Exp $
+ * $Id$
*/
#ifndef _NET_BPFDESC_H_
@@ -78,7 +78,7 @@ struct bpf_d {
u_char bd_immediate; /* true to return on packet arrival */
int bd_async; /* non-zero if packet reception should generate signal */
int bd_sig; /* signal to send upon packet reception */
- struct sigio * bd_sigio; /* information for async I/O */
+ pid_t bd_pgid; /* process or group id for signal */
#if BSD < 199103
u_char bd_selcoll; /* true if selects collide */
int bd_timedout;
diff --git a/sys/net/bridge.c b/sys/net/bridge.c
index 745eaa2fca0de..7c2e0f23508f2 100644
--- a/sys/net/bridge.c
+++ b/sys/net/bridge.c
@@ -77,7 +77,6 @@
#include <sys/param.h>
#include <sys/mbuf.h>
-#include <sys/malloc.h>
#include <sys/systm.h>
#include <sys/socket.h> /* for net/if.h */
#include <sys/kernel.h>
@@ -90,11 +89,9 @@
#include <netinet/if_ether.h> /* for struct arpcom */
#include "opt_ipfw.h"
-#include "opt_ipdn.h"
#if defined(IPFIREWALL) && defined(DUMMYNET)
#include <net/route.h>
-#include <netinet/ip_fw.h>
#include <netinet/ip_dummynet.h>
#endif
@@ -239,10 +236,11 @@ bdg_timeout(void *dummy)
if (--slowtimer <= 0 ) {
slowtimer = 5 ;
- for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_link.tqe_next) {
+ for (ifp = ifnet; ifp; ifp = ifp->if_next) {
if (ifp->if_type != IFT_ETHER)
continue ;
if ( 0 == ( ifp->if_flags & IFF_UP) ) {
+ int ret ;
s = splimp();
if_up(ifp);
splx(s);
@@ -281,7 +279,7 @@ static void
bdginit(dummy)
void *dummy;
{
- int i ;
+ int s, i ;
struct ifnet *ifp;
struct arpcom *ac ;
u_char *eth_addr ;
@@ -301,9 +299,8 @@ bdginit(dummy)
bdg_ports = 0 ;
eth_addr = bdg_addresses ;
- printf("BRIDGE 981214, have %d interfaces\n", if_index);
- for (i = 0 , ifp = ifnet.tqh_first ; i < if_index ;
- i++, ifp = ifp->if_link.tqe_next)
+ printf("BRIDGE 980911, have %d interfaces\n", if_index);
+ for (i = 0 , ifp = ifnet ; i < if_index ; i++, ifp = ifp->if_next)
if (ifp->if_type == IFT_ETHER) { /* ethernet ? */
ac = (struct arpcom *)ifp;
sprintf(bdg_stats.s[ifp->if_index].name,
@@ -325,7 +322,7 @@ bdginit(dummy)
bdg_ports ++ ;
}
bdg_timeout(0);
- do_bridge=0;
+ do_bridge=1;
}
/*
@@ -467,7 +464,7 @@ bdg_forward (struct mbuf **m0, struct ifnet *dst)
return 0;
}
if (dst == BDG_BCAST || dst == BDG_MCAST || dst == BDG_UNKNOWN) {
- ifp = ifnet.tqh_first ;
+ ifp = ifnet ;
once = 0 ;
if (dst != BDG_UNKNOWN)
canfree = 0 ;
@@ -518,7 +515,7 @@ bdg_forward (struct mbuf **m0, struct ifnet *dst)
}
dummy = 0 ;
- off= (*ip_fw_chk_ptr)(NULL, 0, src, &dummy, &m, &rule, NULL /*next hop */ ) ;
+ off=(*ip_fw_chk_ptr)(NULL, 0, src, &dummy, &m, &rule) ;
if (m == NULL) { /* pkt discarded by firewall */
printf("-- bdg: firewall discarded pkt\n");
if (canfree)
@@ -559,12 +556,12 @@ forward:
else
m = NULL ;
- for ( ; ifp ; ifp = ifp->if_link.tqe_next ) {
+ for ( ; ifp ; ifp = ifp->if_next ) {
if (ifp != src && ifp->if_type == IFT_ETHER &&
(ifp->if_flags & (IFF_UP|IFF_RUNNING)) == (IFF_UP|IFF_RUNNING) &&
SAMEGROUP(ifp, src) && !MUTED(ifp) ) {
if (m == NULL) { /* do i need to make a copy ? */
- if (canfree && ifp->if_link.tqe_next == NULL) /* last one! */
+ if (canfree && ifp->if_next == NULL) /* last one! */
m = *m0 ;
else /* on a P5-90, m_packetcopy takes 540 ticks */
m = m_copypacket(*m0, M_DONTWAIT);
diff --git a/sys/net/bridge.h b/sys/net/bridge.h
index e151e4e6ac7d8..8dcee07a3c51e 100644
--- a/sys/net/bridge.h
+++ b/sys/net/bridge.h
@@ -108,7 +108,7 @@ struct bdg_stats {
* BDG_DROP must be dropped
* other ifp of the dest. interface (incl.self)
*/
-static __inline
+static inline
struct ifnet *
bridge_dst_lookup(struct mbuf *m)
{
diff --git a/sys/net/if.c b/sys/net/if.c
index b0c7be766cee3..295ae4d230587 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if.c 8.3 (Berkeley) 1/4/94
- * $Id: if.c,v 1.63 1998/12/04 22:54:52 archie Exp $
+ * $Id: if.c,v 1.61 1998/07/20 13:21:56 dfr Exp $
*/
#include "opt_compat.h"
@@ -143,8 +143,7 @@ if_attach(ifp)
/*
* create a Link Level name for this device
*/
- namelen = snprintf(workbuf, sizeof(workbuf),
- "%s%d", ifp->if_name, ifp->if_unit);
+ namelen = sprintf(workbuf, "%s%d", ifp->if_name, ifp->if_unit);
#define _offsetof(t, m) ((int)((caddr_t)&((t *)0)->m))
masklen = _offsetof(struct sockaddr_dl, sdl_data[0]) + namelen;
socksize = masklen + ifp->if_addrlen;
@@ -401,17 +400,16 @@ link_rtrequest(cmd, rt, sa)
* NOTE: must be called at splnet or eqivalent.
*/
void
-if_unroute(ifp, flag, fam)
+if_down(ifp)
register struct ifnet *ifp;
- int flag, fam;
{
register struct ifaddr *ifa;
- ifp->if_flags &= ~flag;
+ ifp->if_flags &= ~IFF_UP;
getmicrotime(&ifp->if_lastchange);
- TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
- if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family))
- pfctlinput(PRC_IFDOWN, ifa->ifa_addr);
+ for (ifa = ifp->if_addrhead.tqh_first; ifa;
+ ifa = ifa->ifa_link.tqe_next)
+ pfctlinput(PRC_IFDOWN, ifa->ifa_addr);
if_qflush(&ifp->if_snd);
rt_ifmsg(ifp);
}
@@ -422,47 +420,20 @@ if_unroute(ifp, flag, fam)
* NOTE: must be called at splnet or eqivalent.
*/
void
-if_route(ifp, flag, fam)
+if_up(ifp)
register struct ifnet *ifp;
- int flag, fam;
{
register struct ifaddr *ifa;
- ifp->if_flags |= flag;
+ ifp->if_flags |= IFF_UP;
getmicrotime(&ifp->if_lastchange);
- TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
- if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family))
- pfctlinput(PRC_IFUP, ifa->ifa_addr);
+ for (ifa = ifp->if_addrhead.tqh_first; ifa;
+ ifa = ifa->ifa_link.tqe_next)
+ pfctlinput(PRC_IFUP, ifa->ifa_addr);
rt_ifmsg(ifp);
}
/*
- * Mark an interface down and notify protocols of
- * the transition.
- * NOTE: must be called at splnet or eqivalent.
- */
-void
-if_down(ifp)
- register struct ifnet *ifp;
-{
-
- if_unroute(ifp, IFF_UP, AF_UNSPEC);
-}
-
-/*
- * Mark an interface up and notify protocols of
- * the transition.
- * NOTE: must be called at splnet or eqivalent.
- */
-void
-if_up(ifp)
- register struct ifnet *ifp;
-{
-
- if_route(ifp, IFF_UP, AF_UNSPEC);
-}
-
-/*
* Flush an interface queue.
*/
static void
@@ -821,8 +792,7 @@ ifconf(cmd, data)
char workbuf[64];
int ifnlen;
- ifnlen = snprintf(workbuf, sizeof(workbuf),
- "%s%d", ifp->if_name, ifp->if_unit);
+ ifnlen = sprintf(workbuf, "%s%d", ifp->if_name, ifp->if_unit);
if(ifnlen + 1 > sizeof ifr.ifr_name) {
error = ENAMETOOLONG;
} else {
diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c
index 9f56a9b610ffc..a41bfaf8548dd 100644
--- a/sys/net/if_atmsubr.c
+++ b/sys/net/if_atmsubr.c
@@ -521,16 +521,14 @@ pvc_ioctl(shadow, cmd, data)
*/
switch (cmd) {
case SIOCGPVCSIF:
- snprintf(ifr->ifr_name, sizeof(ifr->ifr_name),
- "%s%d", ifp->if_name, ifp->if_unit);
+ sprintf(ifr->ifr_name, "%s%d", ifp->if_name, ifp->if_unit);
return (0);
case SIOCGPVCTX:
do {
struct pvctxreq *pvcreq = (struct pvctxreq *)data;
- snprintf(pvcreq->pvc_ifname,
- sizeof(pvcreq->pvc_ifname), "%s%d",
+ sprintf(pvcreq->pvc_ifname, "%s%d",
ifp->if_name, ifp->if_unit);
pvcreq->pvc_aph = pvcsif->sif_aph;
} while (0);
diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c
index 8e7b99e862a4e..796061e978a0a 100644
--- a/sys/net/if_disc.c
+++ b/sys/net/if_disc.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)if_loop.c 8.1 (Berkeley) 6/10/93
- * $Id: if_disc.c,v 1.20 1998/06/07 17:12:03 dfr Exp $
+ * $Id: if_disc.c,v 1.19 1998/01/08 23:41:21 eivind Exp $
*/
/*
@@ -63,24 +63,24 @@
static void discattach __P((void *dummy));
PSEUDO_SET(discattach, if_disc);
-static struct ifnet discif;
-static int discoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
+static struct ifnet dsif;
+static int dsoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *);
-static void discrtrequest(int cmd, struct rtentry *rt, struct sockaddr *sa);
-static int discioctl(struct ifnet *, u_long, caddr_t);
+static void dsrtrequest(int cmd, struct rtentry *rt, struct sockaddr *sa);
+static int dsioctl(struct ifnet *, u_long, caddr_t);
/* ARGSUSED */
static void
discattach(dummy)
void *dummy;
{
- register struct ifnet *ifp = &discif;
+ register struct ifnet *ifp = &dsif;
ifp->if_name = "ds";
ifp->if_mtu = DSMTU;
ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST;
- ifp->if_ioctl = discioctl;
- ifp->if_output = discoutput;
+ ifp->if_ioctl = dsioctl;
+ ifp->if_output = dsoutput;
ifp->if_type = IFT_LOOP;
ifp->if_hdrlen = 0;
ifp->if_addrlen = 0;
@@ -91,14 +91,14 @@ discattach(dummy)
}
static int
-discoutput(ifp, m, dst, rt)
+dsoutput(ifp, m, dst, rt)
struct ifnet *ifp;
register struct mbuf *m;
struct sockaddr *dst;
register struct rtentry *rt;
{
if ((m->m_flags & M_PKTHDR) == 0)
- panic("discoutput no HDR");
+ panic("dsoutput no HDR");
#if NBPFILTER > 0
/* BPF write needs to be handled specially */
if (dst->sa_family == AF_UNSPEC) {
@@ -108,7 +108,7 @@ discoutput(ifp, m, dst, rt)
m->m_data += sizeof(int);
}
- if (discif.if_bpf) {
+ if (dsif.if_bpf) {
/*
* We need to prepend the address family as
* a four byte field. Cons up a dummy header
@@ -123,7 +123,7 @@ discoutput(ifp, m, dst, rt)
m0.m_len = 4;
m0.m_data = (char *)&af;
- bpf_mtap(&discif, &m0);
+ bpf_mtap(&dsif, &m0);
}
#endif
m->m_pkthdr.rcvif = ifp;
@@ -137,7 +137,7 @@ discoutput(ifp, m, dst, rt)
/* ARGSUSED */
static void
-discrtrequest(cmd, rt, sa)
+dsrtrequest(cmd, rt, sa)
int cmd;
struct rtentry *rt;
struct sockaddr *sa;
@@ -151,7 +151,7 @@ discrtrequest(cmd, rt, sa)
*/
/* ARGSUSED */
static int
-discioctl(ifp, cmd, data)
+dsioctl(ifp, cmd, data)
register struct ifnet *ifp;
u_long cmd;
caddr_t data;
@@ -166,7 +166,7 @@ discioctl(ifp, cmd, data)
ifp->if_flags |= IFF_UP;
ifa = (struct ifaddr *)data;
if (ifa != 0)
- ifa->ifa_rtrequest = discrtrequest;
+ ifa->ifa_rtrequest = dsrtrequest;
/*
* Everything else is done at a higher level.
*/
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 1485c27665462..ca66eb0dc9068 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -31,13 +31,12 @@
* SUCH DAMAGE.
*
* @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93
- * $Id: if_ethersubr.c,v 1.53 1998/12/14 17:58:05 luigi Exp $
+ * $Id: if_ethersubr.c,v 1.51 1998/06/14 20:58:14 julian Exp $
*/
#include "opt_atalk.h"
#include "opt_inet.h"
#include "opt_ipx.h"
-#include "opt_bdg.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -102,10 +101,6 @@ extern u_char at_org_code[3];
extern u_char aarp_org_code[3];
#endif /* NETATALK */
-#ifdef BRIDGE
-#include <net/bridge.h>
-#endif
-
#include "vlan.h"
#if NVLAN > 0
#include <net/if_vlan_var.h>
@@ -374,22 +369,10 @@ ether_output(ifp, m0, dst, rt0)
} else if (bcmp(eh->ether_dhost,
eh->ether_shost, ETHER_ADDR_LEN) == 0) {
(void) if_simloop(ifp, m, dst, hlen);
- return (0); /* XXX */
+ return(0); /* XXX */
}
}
-#ifdef BRIDGE
- if (do_bridge) {
- struct mbuf *m0 = m ;
-
- if (m->m_pkthdr.rcvif)
- m->m_pkthdr.rcvif = NULL ;
- ifp = bridge_dst_lookup(m);
- bdg_forward(&m0, ifp);
- if (m0)
- m_freem(m0);
- return (0);
- }
-#endif
+
s = splimp();
/*
* Queue message on interface, and start output if interface
diff --git a/sys/net/if_mib.c b/sys/net/if_mib.c
index 2e8f331cfdfcd..268669d36922e 100644
--- a/sys/net/if_mib.c
+++ b/sys/net/if_mib.c
@@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_mib.c,v 1.5 1997/08/02 14:32:38 bde Exp $
+ * $Id: if_mib.c,v 1.4 1997/02/22 09:41:02 peter Exp $
*/
#include <sys/param.h>
@@ -89,8 +89,7 @@ sysctl_ifdata SYSCTL_HANDLER_ARGS /* XXX bad syntax! */
return ENOENT;
case IFDATA_GENERAL:
- ifnlen = snprintf(workbuf, sizeof(workbuf),
- "%s%d", ifp->if_name, ifp->if_unit);
+ ifnlen = sprintf(workbuf, "%s%d", ifp->if_name, ifp->if_unit);
if(ifnlen + 1 > sizeof ifmd.ifmd_name) {
return ENAMETOOLONG;
} else {
diff --git a/sys/net/if_sppp.h b/sys/net/if_sppp.h
index 67a63ae0472ff..41e5d8e427cb1 100644
--- a/sys/net/if_sppp.h
+++ b/sys/net/if_sppp.h
@@ -16,11 +16,11 @@
*
* From: Version 2.0, Fri Oct 6 20:39:21 MSK 1995
*
- * $Id: if_sppp.h,v 1.12 1998/12/20 19:06:22 phk Exp $
+ * $Id: if_sppp.h,v 1.8 1997/10/11 11:25:20 joerg Exp $
*/
-#ifndef _NET_IF_SPPP_H_
-#define _NET_IF_SPPP_H_ 1
+#ifndef _NET_IF_HDLC_H_
+#define _NET_IF_HDLC_H_ 1
#define IDX_LCP 0 /* idx into state table */
@@ -45,7 +45,6 @@ struct sipcp {
u_int flags;
#define IPCP_HISADDR_SEEN 1 /* have seen his address already */
#define IPCP_MYADDR_DYN 2 /* my address is dynamically assigned */
-#define IPCP_MYADDR_SEEN 4 /* have seen his address already */
};
#define AUTHNAMELEN 32
@@ -117,18 +116,6 @@ struct sppp {
*/
void (*pp_tls)(struct sppp *sp);
void (*pp_tlf)(struct sppp *sp);
- /*
- * These (optional) functions may be filled by the hardware
- * driver if any notification of established connections
- * (currently: IPCP up) is desired (pp_con) or any internal
- * state change of the interface state machine should be
- * signaled for monitoring purposes (pp_chg).
- */
- void (*pp_con)(struct sppp *sp);
- void (*pp_chg)(struct sppp *sp, int new_state);
- /* These two fields are for use by the lower layer */
- void *pp_lowerp;
- int pp_loweri;
};
#define PP_KEEPALIVE 0x01 /* use keepalive protocol */
@@ -172,4 +159,4 @@ int sppp_isempty (struct ifnet *ifp);
void sppp_flush (struct ifnet *ifp);
#endif
-#endif /* _NET_IF_SPPP_H_ */
+#endif /* _NET_IF_HDLC_H_ */
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index 4f3e17afdecb8..e5b040debdfa5 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -17,12 +17,12 @@
*
* From: Version 2.4, Thu Apr 30 17:17:21 MSD 1997
*
- * $Id: if_spppsubr.c,v 1.51 1998/12/26 13:14:45 phk Exp $
+ * $Id: if_spppsubr.c,v 1.44 1998/10/06 20:47:53 joerg Exp $
*/
#include <sys/param.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
#include "opt_inet.h"
#include "opt_ipx.h"
#endif
@@ -39,9 +39,6 @@
#include <sys/sockio.h>
#include <sys/socket.h>
#include <sys/syslog.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-#include <machine/random.h>
-#endif
#include <sys/malloc.h>
#include <sys/mbuf.h>
@@ -54,15 +51,13 @@
#include <net/if.h>
#include <net/netisr.h>
#include <net/if_types.h>
-#include <net/route.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
#include <machine/random.h>
#endif
#if defined (__NetBSD__) || defined (__OpenBSD__)
#include <machine/cpu.h> /* XXX for softnet */
#endif
-
#include <machine/stdarg.h>
#ifdef INET
@@ -99,16 +94,13 @@
#include <net/if_sppp.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-# define UNTIMEOUT(fun, arg, handle) untimeout(fun, arg, handle)
-# define TIMEOUT(fun, arg1, arg2, handle) handle = timeout(fun, arg1, arg2)
-# define IOCTL_CMD_T u_long
+#if defined (__FreeBSD__)
+# define UNTIMEOUT(fun, arg, handle) \
+ untimeout(fun, arg, handle)
#else
-# define UNTIMEOUT(fun, arg, handle) untimeout(fun, arg)
-# define TIMEOUT(fun, arg1, arg2, handle) timeout(fun, arg1, arg2)
-# define IOCTL_CMD_T int
+# define UNTIMEOUT(fun, arg, handle) \
+ untimeout(fun, arg)
#endif
-
#define MAXALIVECNT 3 /* max. alive packets */
/*
@@ -258,11 +250,11 @@ struct cp {
};
static struct sppp *spppq;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
static struct callout_handle keepalive_ch;
#endif
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
#define SPP_FMT "%s%d: "
#define SPP_ARGS(ifp) (ifp)->if_name, (ifp)->if_unit
#else
@@ -299,11 +291,13 @@ static void sppp_cp_input(const struct cp *cp, struct sppp *sp,
struct mbuf *m);
static void sppp_cp_send(struct sppp *sp, u_short proto, u_char type,
u_char ident, u_short len, void *data);
-/* static void sppp_cp_timeout(void *arg); */
+#ifdef notyet
+static void sppp_cp_timeout(void *arg);
+#endif
static void sppp_cp_change_state(const struct cp *cp, struct sppp *sp,
int newstate);
static void sppp_auth_send(const struct cp *cp,
- struct sppp *sp, unsigned int type, unsigned int id,
+ struct sppp *sp, u_char type, u_char id,
...);
static void sppp_up_event(const struct cp *cp, struct sppp *sp);
@@ -625,7 +619,6 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
struct ppp_header *h;
struct ifqueue *ifq;
int s, rv = 0;
- int debug = ifp->if_flags & IFF_DEBUG;
s = splimp();
@@ -649,47 +642,21 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
ifq = &ifp->if_snd;
#ifdef INET
+ /*
+ * Put low delay, telnet, rlogin and ftp control packets
+ * in front of the queue.
+ */
if (dst->sa_family == AF_INET) {
/* XXX Check mbuf length here? */
struct ip *ip = mtod (m, struct ip*);
struct tcphdr *tcp = (struct tcphdr*) ((long*)ip + ip->ip_hl);
- /*
- * When using dynamic local IP address assignment by using
- * 0.0.0.0 as a local address, the first TCP session will
- * not connect because the local TCP checksum is computed
- * using 0.0.0.0 which will later become our real IP address
- * so the TCP checksum computed at the remote end will
- * become invalid. So we
- * - don't let packets with src ip addr 0 thru
- * - we flag TCP packets with src ip 0 as an error
- */
-
- if(ip->ip_src.s_addr == INADDR_ANY) /* -hm */
- {
- m_freem(m);
- splx(s);
- if(ip->ip_p == IPPROTO_TCP)
- return(EADDRNOTAVAIL);
- else
- return(0);
- }
-
- /*
- * Put low delay, telnet, rlogin and ftp control packets
- * in front of the queue.
- */
- if (IF_QFULL (&sp->pp_fastq))
- ;
- else if (ip->ip_tos & IPTOS_LOWDELAY)
- ifq = &sp->pp_fastq;
- else if (m->m_len < sizeof *ip + sizeof *tcp)
- ;
- else if (ip->ip_p != IPPROTO_TCP)
- ;
- else if (INTERACTIVE (ntohs (tcp->th_sport)))
- ifq = &sp->pp_fastq;
- else if (INTERACTIVE (ntohs (tcp->th_dport)))
+ if (! IF_QFULL (&sp->pp_fastq) &&
+ ((ip->ip_tos & IPTOS_LOWDELAY) ||
+ ((ip->ip_p == IPPROTO_TCP &&
+ m->m_len >= sizeof (struct ip) + sizeof (struct tcphdr) &&
+ (INTERACTIVE (ntohs (tcp->th_sport)))) ||
+ INTERACTIVE (ntohs (tcp->th_dport)))))
ifq = &sp->pp_fastq;
}
#endif
@@ -699,7 +666,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
*/
M_PREPEND (m, PPP_HEADER_LEN, M_DONTWAIT);
if (! m) {
- if (debug)
+ if (ifp->if_flags & IFF_DEBUG)
log(LOG_DEBUG, SPP_FMT "no memory for transmit header\n",
SPP_ARGS(ifp));
++ifp->if_oerrors;
@@ -799,19 +766,17 @@ sppp_attach(struct ifnet *ifp)
/* Initialize keepalive handler. */
if (! spppq)
- TIMEOUT(sppp_keepalive, 0, hz * 10, keepalive_ch);
+#if defined (__FreeBSD__)
+ keepalive_ch =
+#endif
+ timeout(sppp_keepalive, 0, hz * 10);
/* Insert new entry into the keepalive list. */
sp->pp_next = spppq;
spppq = sp;
- sp->pp_if.if_mtu = PP_MTU;
- sp->pp_if.if_flags = IFF_POINTOPOINT | IFF_MULTICAST;
sp->pp_if.if_type = IFT_PPP;
sp->pp_if.if_output = sppp_output;
-#if 0
- sp->pp_flags = PP_KEEPALIVE;
-#endif
sp->pp_fastq.ifq_maxlen = 32;
sp->pp_cpq.ifq_maxlen = 20;
sp->pp_loopcnt = 0;
@@ -933,7 +898,7 @@ sppp_pick(struct ifnet *ifp)
* Process an ioctl request. Called on low priority level.
*/
int
-sppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, void *data)
+sppp_ioctl(struct ifnet *ifp, u_long cmd, void *data)
{
struct ifreq *ifr = (struct ifreq*) data;
struct sppp *sp = (struct sppp*) ifp;
@@ -1076,7 +1041,7 @@ sppp_cisco_input(struct sppp *sp, struct mbuf *m)
++sp->pp_loopcnt;
/* Generate new local sequence number */
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
sp->pp_seq = random();
#else
sp->pp_seq ^= time.tv_sec ^ time.tv_usec;
@@ -1108,13 +1073,13 @@ sppp_cisco_send(struct sppp *sp, int type, long par1, long par2)
struct ppp_header *h;
struct cisco_packet *ch;
struct mbuf *m;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
struct timeval tv;
#else
u_long t = (time.tv_sec - boottime.tv_sec) * 1000;
#endif
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
getmicrouptime(&tv);
#endif
@@ -1135,7 +1100,7 @@ sppp_cisco_send(struct sppp *sp, int type, long par1, long par2)
ch->par2 = htonl (par2);
ch->rel = -1;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
ch->time0 = htons ((u_short) (tv.tv_sec >> 16));
ch->time1 = htons ((u_short) tv.tv_sec);
#else
@@ -1435,12 +1400,12 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m)
case STATE_ACK_SENT:
break;
case STATE_CLOSING:
- sppp_cp_change_state(cp, sp, STATE_CLOSED);
(cp->tlf)(sp);
+ sppp_cp_change_state(cp, sp, STATE_CLOSED);
break;
case STATE_STOPPING:
- sppp_cp_change_state(cp, sp, STATE_STOPPED);
(cp->tlf)(sp);
+ sppp_cp_change_state(cp, sp, STATE_STOPPED);
break;
case STATE_ACK_RCVD:
sppp_cp_change_state(cp, sp, STATE_REQ_SENT);
@@ -1605,9 +1570,8 @@ sppp_down_event(const struct cp *cp, struct sppp *sp)
sppp_cp_change_state(cp, sp, STATE_INITIAL);
break;
case STATE_STOPPED:
- sppp_cp_change_state(cp, sp, STATE_STARTING);
(cp->tls)(sp);
- break;
+ /* fall through */
case STATE_STOPPING:
case STATE_REQ_SENT:
case STATE_ACK_RCVD:
@@ -1638,8 +1602,8 @@ sppp_open_event(const struct cp *cp, struct sppp *sp)
switch (sp->state[cp->protoidx]) {
case STATE_INITIAL:
- sppp_cp_change_state(cp, sp, STATE_STARTING);
(cp->tls)(sp);
+ sppp_cp_change_state(cp, sp, STATE_STARTING);
break;
case STATE_STARTING:
break;
@@ -1678,8 +1642,8 @@ sppp_close_event(const struct cp *cp, struct sppp *sp)
case STATE_CLOSING:
break;
case STATE_STARTING:
- sppp_cp_change_state(cp, sp, STATE_INITIAL);
(cp->tlf)(sp);
+ sppp_cp_change_state(cp, sp, STATE_INITIAL);
break;
case STATE_STOPPED:
sppp_cp_change_state(cp, sp, STATE_CLOSED);
@@ -1717,18 +1681,18 @@ sppp_to_event(const struct cp *cp, struct sppp *sp)
/* TO- event */
switch (sp->state[cp->protoidx]) {
case STATE_CLOSING:
- sppp_cp_change_state(cp, sp, STATE_CLOSED);
(cp->tlf)(sp);
+ sppp_cp_change_state(cp, sp, STATE_CLOSED);
break;
case STATE_STOPPING:
- sppp_cp_change_state(cp, sp, STATE_STOPPED);
(cp->tlf)(sp);
+ sppp_cp_change_state(cp, sp, STATE_STOPPED);
break;
case STATE_REQ_SENT:
case STATE_ACK_RCVD:
case STATE_ACK_SENT:
- sppp_cp_change_state(cp, sp, STATE_STOPPED);
(cp->tlf)(sp);
+ sppp_cp_change_state(cp, sp, STATE_STOPPED);
break;
}
else
@@ -1738,8 +1702,10 @@ sppp_to_event(const struct cp *cp, struct sppp *sp)
case STATE_STOPPING:
sppp_cp_send(sp, cp->proto, TERM_REQ, ++sp->pp_seq,
0, 0);
- TIMEOUT(cp->TO, (void *)sp, sp->lcp.timeout,
- sp->ch[cp->protoidx]);
+#if defined (__FreeBSD__)
+ sp->ch[cp->protoidx] =
+#endif
+ timeout(cp->TO, (void *)sp, sp->lcp.timeout);
break;
case STATE_REQ_SENT:
case STATE_ACK_RCVD:
@@ -1749,8 +1715,10 @@ sppp_to_event(const struct cp *cp, struct sppp *sp)
break;
case STATE_ACK_SENT:
(cp->scr)(sp);
- TIMEOUT(cp->TO, (void *)sp, sp->lcp.timeout,
- sp->ch[cp->protoidx]);
+#if defined (__FreeBSD__)
+ sp->ch[cp->protoidx] =
+#endif
+ timeout(cp->TO, (void *)sp, sp->lcp.timeout);
break;
}
@@ -1779,8 +1747,10 @@ sppp_cp_change_state(const struct cp *cp, struct sppp *sp, int newstate)
case STATE_REQ_SENT:
case STATE_ACK_RCVD:
case STATE_ACK_SENT:
- TIMEOUT(cp->TO, (void *)sp, sp->lcp.timeout,
- sp->ch[cp->protoidx]);
+#if defined (__FreeBSD__)
+ sp->ch[cp->protoidx] =
+#endif
+ timeout(cp->TO, (void *)sp, sp->lcp.timeout);
break;
}
}
@@ -1812,7 +1782,7 @@ sppp_lcp_init(struct sppp *sp)
sp->lcp.max_terminate = 2;
sp->lcp.max_configure = 10;
sp->lcp.max_failure = 10;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
callout_handle_init(&sp->ch[IDX_LCP]);
#endif
}
@@ -1860,7 +1830,7 @@ sppp_lcp_down(struct sppp *sp)
*/
if ((ifp->if_flags & (IFF_AUTO | IFF_PASSIVE)) == 0) {
log(LOG_INFO,
- SPP_FMT "Down event, taking interface down.\n",
+ SPP_FMT "Down event (carrier loss), taking interface down.\n",
SPP_ARGS(ifp));
if_down(ifp);
} else {
@@ -2222,7 +2192,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
if (magic == ~sp->lcp.magic) {
if (debug)
addlog("magic glitch ");
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
sp->lcp.magic = random();
#else
sp->lcp.magic = time.tv_sec + time.tv_usec;
@@ -2270,7 +2240,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
static void
sppp_lcp_tlu(struct sppp *sp)
{
- STDDCL;
+ struct ifnet *ifp = &sp->pp_if;
int i;
u_long mask;
@@ -2292,9 +2262,8 @@ sppp_lcp_tlu(struct sppp *sp)
else
sp->pp_phase = PHASE_NETWORK;
- if (debug)
- log(LOG_DEBUG, SPP_FMT "phase %s\n", SPP_ARGS(ifp),
- sppp_phase_name(sp->pp_phase));
+ log(LOG_INFO, SPP_FMT "phase %s\n", SPP_ARGS(ifp),
+ sppp_phase_name(sp->pp_phase));
/*
* Open all authentication protocols. This is even required
@@ -2319,10 +2288,6 @@ sppp_lcp_tlu(struct sppp *sp)
if (sp->lcp.protos & mask && ((cps[i])->flags & CP_LCP) == 0)
(cps[i])->Up(sp);
- /* notify low-level driver of state change */
- if (sp->pp_chg)
- sp->pp_chg(sp, (int)sp->pp_phase);
-
if (sp->pp_phase == PHASE_NETWORK)
/* if no NCP is starting, close down */
sppp_lcp_check_and_close(sp);
@@ -2331,15 +2296,14 @@ sppp_lcp_tlu(struct sppp *sp)
static void
sppp_lcp_tld(struct sppp *sp)
{
- STDDCL;
+ struct ifnet *ifp = &sp->pp_if;
int i;
u_long mask;
sp->pp_phase = PHASE_TERMINATE;
- if (debug)
- log(LOG_DEBUG, SPP_FMT "phase %s\n", SPP_ARGS(ifp),
- sppp_phase_name(sp->pp_phase));
+ log(LOG_INFO, SPP_FMT "phase %s\n", SPP_ARGS(ifp),
+ sppp_phase_name(sp->pp_phase));
/*
* Take upper layers down. We send the Down event first and
@@ -2357,36 +2321,30 @@ sppp_lcp_tld(struct sppp *sp)
static void
sppp_lcp_tls(struct sppp *sp)
{
- STDDCL;
+ struct ifnet *ifp = &sp->pp_if;
sp->pp_phase = PHASE_ESTABLISH;
- if (debug)
- log(LOG_DEBUG, SPP_FMT "phase %s\n", SPP_ARGS(ifp),
- sppp_phase_name(sp->pp_phase));
+ log(LOG_INFO, SPP_FMT "phase %s\n", SPP_ARGS(ifp),
+ sppp_phase_name(sp->pp_phase));
/* Notify lower layer if desired. */
if (sp->pp_tls)
(sp->pp_tls)(sp);
- else
- (sp->pp_up)(sp);
}
static void
sppp_lcp_tlf(struct sppp *sp)
{
- STDDCL;
+ struct ifnet *ifp = &sp->pp_if;
sp->pp_phase = PHASE_DEAD;
- if (debug)
- log(LOG_DEBUG, SPP_FMT "phase %s\n", SPP_ARGS(ifp),
- sppp_phase_name(sp->pp_phase));
+ log(LOG_INFO, SPP_FMT "phase %s\n", SPP_ARGS(ifp),
+ sppp_phase_name(sp->pp_phase));
/* Notify lower layer if desired. */
if (sp->pp_tlf)
(sp->pp_tlf)(sp);
- else
- (sp->pp_down)(sp);
}
static void
@@ -2398,7 +2356,7 @@ sppp_lcp_scr(struct sppp *sp)
if (sp->lcp.opts & (1 << LCP_OPT_MAGIC)) {
if (! sp->lcp.magic)
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
sp->lcp.magic = random();
#else
sp->lcp.magic = time.tv_sec + time.tv_usec;
@@ -2478,7 +2436,7 @@ sppp_ipcp_init(struct sppp *sp)
sp->ipcp.flags = 0;
sp->state[IDX_IPCP] = STATE_INITIAL;
sp->fail_counter[IDX_IPCP] = 0;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
callout_handle_init(&sp->ch[IDX_IPCP]);
#endif
}
@@ -2501,8 +2459,6 @@ sppp_ipcp_open(struct sppp *sp)
STDDCL;
u_long myaddr, hisaddr;
- sp->ipcp.flags &= ~(IPCP_HISADDR_SEEN|IPCP_MYADDR_SEEN|IPCP_MYADDR_DYN);
-
sppp_get_ip_addrs(sp, &myaddr, &hisaddr, 0);
/*
* If we don't have his address, this probably means our
@@ -2525,8 +2481,7 @@ sppp_ipcp_open(struct sppp *sp)
*/
sp->ipcp.flags |= IPCP_MYADDR_DYN;
sp->ipcp.opts |= (1 << IPCP_OPT_ADDRESS);
- } else
- sp->ipcp.flags |= IPCP_MYADDR_SEEN;
+ }
sppp_open_event(&ipcp, sp);
}
@@ -2560,7 +2515,6 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
struct ifnet *ifp = &sp->pp_if;
int rlen, origlen, debug = ifp->if_flags & IFF_DEBUG;
u_long hisaddr, desiredaddr;
- int gotmyaddr = 0;
len -= 4;
origlen = len;
@@ -2634,11 +2588,10 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
continue;
#endif
case IPCP_OPT_ADDRESS:
- /* This is the address he wants in his end */
desiredaddr = p[2] << 24 | p[3] << 16 |
p[4] << 8 | p[5];
if (desiredaddr == hisaddr ||
- (hisaddr == 1 && desiredaddr != 0)) {
+ hisaddr == 1 && desiredaddr != 0) {
/*
* Peer's address is same as our value,
* or we have set it to 0.0.0.1 to
@@ -2648,7 +2601,7 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
*/
if (debug)
addlog("%s [ack] ",
- sppp_dotted_quad(hisaddr));
+ sppp_dotted_quad(desiredaddr));
/* record that we've seen it already */
sp->ipcp.flags |= IPCP_HISADDR_SEEN;
continue;
@@ -2659,14 +2612,13 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
* address, or he send us another address not
* matching our value. Either case, we gonna
* conf-nak it with our value.
- * XXX: we should "rej" if hisaddr == 0
*/
if (debug) {
if (desiredaddr == 0)
addlog("[addr requested] ");
else
addlog("%s [not agreed] ",
- sppp_dotted_quad(desiredaddr));
+ sppp_dotted_quad(desiredaddr));
p[2] = hisaddr >> 24;
p[3] = hisaddr >> 16;
@@ -2691,7 +2643,7 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
* doesn't want to send us his address. Q: What should we do
* about it? XXX A: implement the max-failure counter.
*/
- if (rlen == 0 && !(sp->ipcp.flags & IPCP_HISADDR_SEEN) && !gotmyaddr) {
+ if (rlen == 0 && !(sp->ipcp.flags & IPCP_HISADDR_SEEN)) {
buf[0] = IPCP_OPT_ADDRESS;
buf[1] = 6;
buf[2] = hisaddr >> 24;
@@ -2747,7 +2699,6 @@ sppp_ipcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len)
/*
* Peer doesn't grok address option. This is
* bad. XXX Should we better give up here?
- * XXX We could try old "addresses" option...
*/
sp->ipcp.opts &= ~(1 << IPCP_OPT_ADDRESS);
break;
@@ -2808,14 +2759,11 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
* we accept his offer. Otherwise, we
* ignore it and thus continue to negotiate
* our already existing value.
- * XXX: Bogus, if he said no once, he'll
- * just say no again, might as well die.
*/
if (sp->ipcp.flags & IPCP_MYADDR_DYN) {
sppp_set_ip_addr(sp, wantaddr);
if (debug)
addlog("[agree] ");
- sp->ipcp.flags |= IPCP_MYADDR_SEEN;
}
}
break;
@@ -2837,9 +2785,6 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
static void
sppp_ipcp_tlu(struct sppp *sp)
{
- /* we are up - notify isdn daemon */
- if (sp->pp_con)
- sp->pp_con(sp);
}
static void
@@ -3213,7 +3158,7 @@ sppp_chap_init(struct sppp *sp)
/* Chap doesn't have STATE_INITIAL at all. */
sp->state[IDX_CHAP] = STATE_CLOSED;
sp->fail_counter[IDX_CHAP] = 0;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
callout_handle_init(&sp->ch[IDX_CHAP]);
#endif
}
@@ -3298,7 +3243,11 @@ sppp_chap_tlu(struct sppp *sp)
* a number between 300 and 810 seconds.
*/
i = 300 + ((unsigned)(random() & 0xff00) >> 7);
- TIMEOUT(chap.TO, (void *)sp, i * hz, sp->ch[IDX_CHAP]);
+
+#if defined (__FreeBSD__)
+ sp->ch[IDX_CHAP] =
+#endif
+ timeout(chap.TO, (void *)sp, i * hz);
}
if (debug) {
@@ -3353,17 +3302,17 @@ sppp_chap_scr(struct sppp *sp)
{
u_long *ch, seed;
u_char clen;
+#if defined (__NetBSD__) || defined (__OpenBSD__)
+ struct timeval tv;
+#endif
/* Compute random challenge. */
ch = (u_long *)sp->myauth.challenge;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
read_random(&seed, sizeof seed);
#else
- {
- struct timeval tv;
microtime(&tv);
seed = tv.tv_sec ^ tv.tv_usec;
- }
#endif
ch[0] = seed ^ random();
ch[1] = seed ^ random();
@@ -3545,7 +3494,7 @@ sppp_pap_init(struct sppp *sp)
/* PAP doesn't have STATE_INITIAL at all. */
sp->state[IDX_PAP] = STATE_CLOSED;
sp->fail_counter[IDX_PAP] = 0;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#if defined (__FreeBSD__)
callout_handle_init(&sp->ch[IDX_PAP]);
callout_handle_init(&sp->pap_my_to_ch);
#endif
@@ -3563,8 +3512,10 @@ sppp_pap_open(struct sppp *sp)
if (sp->myauth.proto == PPP_PAP) {
/* we are peer, send a request, and start a timer */
pap.scr(sp);
- TIMEOUT(sppp_pap_my_TO, (void *)sp, sp->lcp.timeout,
- sp->pap_my_to_ch);
+#if defined (__FreeBSD__)
+ sp->pap_my_to_ch =
+#endif
+ timeout(sppp_pap_my_TO, (void *)sp, sp->lcp.timeout);
}
}
@@ -3700,14 +3651,10 @@ sppp_pap_scr(struct sppp *sp)
* Varadic function, each of the elements for the ellipsis is of type
* ``size_t mlen, const u_char *msg''. Processing will stop iff
* mlen == 0.
- * NOTE: never declare variadic functions with types subject to type
- * promotion (i.e. u_char). This is asking for big trouble depending
- * on the architecture you are on...
*/
static void
-sppp_auth_send(const struct cp *cp, struct sppp *sp,
- unsigned int type, unsigned int id,
+sppp_auth_send(const struct cp *cp, struct sppp *sp, u_char type, u_char id,
...)
{
STDDCL;
@@ -3716,7 +3663,7 @@ sppp_auth_send(const struct cp *cp, struct sppp *sp,
struct mbuf *m;
u_char *p;
int len;
- unsigned int mlen;
+ size_t mlen;
const char *msg;
va_list ap;
@@ -3738,7 +3685,7 @@ sppp_auth_send(const struct cp *cp, struct sppp *sp,
va_start(ap, id);
len = 0;
- while ((mlen = (unsigned int)va_arg(ap, size_t)) != 0) {
+ while ((mlen = va_arg(ap, size_t)) != 0) {
msg = va_arg(ap, const char *);
len += mlen;
if (len > MHLEN - PPP_HEADER_LEN - LCP_HEADER_LEN) {
@@ -3843,7 +3790,10 @@ sppp_keepalive(void *dummy)
}
}
splx(s);
- TIMEOUT(sppp_keepalive, 0, hz * 10, keepalive_ch);
+#if defined (__FreeBSD__)
+ keepalive_ch =
+#endif
+ timeout(sppp_keepalive, 0, hz * 10);
}
/*
@@ -3863,17 +3813,14 @@ sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask)
* Pick the first AF_INET address from the list,
* aliases don't make any sense on a p2p link anyway.
*/
- si = 0;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
-#elif defined(__NetBSD__) || defined (__OpenBSD__)
- for (ifa = ifp->if_addrlist.tqh_first;
+#if defined (__FreeBSD__)
+ for (ifa = ifp->if_addrhead.tqh_first, si = 0;
ifa;
- ifa = ifa->ifa_list.tqe_next)
+ ifa = ifa->ifa_link.tqe_next)
#else
- for (ifa = ifp->if_addrlist;
+ for (ifa = ifp->if_addrlist.tqh_first, si = 0;
ifa;
- ifa = ifa->ifa_next)
+ ifa = ifa->ifa_list.tqe_next)
#endif
if (ifa->ifa_addr->sa_family == AF_INET) {
si = (struct sockaddr_in *)ifa->ifa_addr;
@@ -3903,7 +3850,7 @@ sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask)
static void
sppp_set_ip_addr(struct sppp *sp, u_long src)
{
- STDDCL;
+ struct ifnet *ifp = &sp->pp_if;
struct ifaddr *ifa;
struct sockaddr_in *si;
@@ -3911,17 +3858,15 @@ sppp_set_ip_addr(struct sppp *sp, u_long src)
* Pick the first AF_INET address from the list,
* aliases don't make any sense on a p2p link anyway.
*/
- si = 0;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
-#elif defined(__NetBSD__) || defined (__OpenBSD__)
- for (ifa = ifp->if_addrlist.tqh_first;
+
+#if defined (__FreeBSD__)
+ for (ifa = ifp->if_addrhead.tqh_first, si = 0;
ifa;
- ifa = ifa->ifa_list.tqe_next)
+ ifa = ifa->ifa_link.tqe_next)
#else
- for (ifa = ifp->if_addrlist;
+ for (ifa = ifp->if_addrlist.tqh_first, si = 0;
ifa;
- ifa = ifa->ifa_next)
+ ifa = ifa->ifa_list.tqe_next)
#endif
{
if (ifa->ifa_addr->sa_family == AF_INET)
@@ -3933,40 +3878,8 @@ sppp_set_ip_addr(struct sppp *sp, u_long src)
}
if (ifa && si)
- {
- int error;
-#if __NetBSD_Version__ >= 103080000
- struct sockaddr_in new_sin = *si;
-
- new_sin.sin_addr.s_addr = htonl(src);
- error = in_ifinit(ifp, ifatoia(ifa), &new_sin, 1);
- if(debug && error)
- {
- log(LOG_DEBUG, SPP_FMT "sppp_set_ip_addr: in_ifinit "
- " failed, error=%d\n", SPP_ARGS(ifp), error);
- }
-#else
- /* delete old route */
- error = rtinit(ifa, (int)RTM_DELETE, RTF_HOST);
- if(debug && error)
- {
- log(LOG_DEBUG, SPP_FMT "sppp_set_ip_addr: rtinit DEL failed, error=%d\n",
- SPP_ARGS(ifp), error);
- }
-
- /* set new address */
si->sin_addr.s_addr = htonl(src);
-
- /* add new route */
- error = rtinit(ifa, (int)RTM_ADD, RTF_HOST);
- if (debug && error)
- {
- log(LOG_DEBUG, SPP_FMT "sppp_set_ip_addr: rtinit ADD failed, error=%d",
- SPP_ARGS(ifp), error);
- }
-#endif
- }
-}
+}
static int
sppp_params(struct sppp *sp, u_long cmd, void *data)
@@ -4075,15 +3988,14 @@ sppp_params(struct sppp *sp, u_long cmd, void *data)
static void
sppp_phase_network(struct sppp *sp)
{
- STDDCL;
+ struct ifnet *ifp = &sp->pp_if;
int i;
u_long mask;
sp->pp_phase = PHASE_NETWORK;
- if (debug)
- log(LOG_DEBUG, SPP_FMT "phase %s\n", SPP_ARGS(ifp),
- sppp_phase_name(sp->pp_phase));
+ log(LOG_INFO, SPP_FMT "phase %s\n", SPP_ARGS(ifp),
+ sppp_phase_name(sp->pp_phase));
/* Notify NCPs now. */
for (i = 0; i < IDX_COUNT; i++)
@@ -4117,7 +4029,7 @@ sppp_cp_type_name(u_char type)
case ECHO_REPLY: return "echo-reply";
case DISC_REQ: return "discard-req";
}
- snprintf (buf, sizeof(buf), "0x%x", type);
+ sprintf (buf, "0x%x", type);
return buf;
}
@@ -4140,7 +4052,7 @@ sppp_auth_type_name(u_short proto, u_char type)
case PAP_NAK: return "nak";
}
}
- snprintf (buf, sizeof(buf), "0x%x", type);
+ sprintf (buf, "0x%x", type);
return buf;
}
@@ -4157,7 +4069,7 @@ sppp_lcp_opt_name(u_char opt)
case LCP_OPT_PROTO_COMP: return "proto-comp";
case LCP_OPT_ADDR_COMP: return "addr-comp";
}
- snprintf (buf, sizeof(buf), "0x%x", opt);
+ sprintf (buf, "0x%x", opt);
return buf;
}
@@ -4170,7 +4082,7 @@ sppp_ipcp_opt_name(u_char opt)
case IPCP_OPT_COMPRESSION: return "compression";
case IPCP_OPT_ADDRESS: return "address";
}
- snprintf (buf, sizeof(buf), "0x%x", opt);
+ sprintf (buf, "0x%x", opt);
return buf;
}
@@ -4215,7 +4127,7 @@ sppp_proto_name(u_short proto)
case PPP_PAP: return "pap";
case PPP_CHAP: return "chap";
}
- snprintf(buf, sizeof(buf), "0x%x", (unsigned)proto);
+ sprintf(buf, "0x%x", (unsigned)proto);
return buf;
}
@@ -4272,3 +4184,10 @@ sppp_null(struct sppp *unused)
{
/* do just nothing */
}
+/*
+ * This file is large. Tell emacs to highlight it nevertheless.
+ *
+ * Local Variables:
+ * hilit-auto-highlight-maxout: 120000
+ * End:
+ */
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index ed98e6c0a539a..e00ce0c5bd3d0 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -30,7 +30,6 @@
#include <sys/ttycom.h>
#include <sys/poll.h>
#include <sys/signalvar.h>
-#include <sys/filedesc.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
#ifdef DEVFS
@@ -38,7 +37,13 @@
#endif /*DEVFS*/
#include <sys/conf.h>
#include <sys/uio.h>
+/*
+ * XXX stop <sys/vnode.h> from including <vnode_if.h>. <vnode_if.h> doesn't
+ * exist if we are an LKM.
+ */
+#undef KERNEL
#include <sys/vnode.h>
+#define KERNEL
#include <net/if.h>
#include <net/netisr.h>
@@ -210,7 +215,7 @@ tunclose(dev, foo, bar, p)
}
splx(s);
}
- funsetown(tp->tun_sigio);
+ tp->tun_pgrp = 0;
selwakeup(&tp->tun_rsel);
TUNDEBUG ("%s%d: closed\n", ifp->if_name, ifp->if_unit);
@@ -301,6 +306,7 @@ tunoutput(ifp, m0, dst, rt)
struct rtentry *rt;
{
struct tun_softc *tp = &tunctl[ifp->if_unit];
+ struct proc *p;
int s;
TUNDEBUG ("%s%d: tunoutput\n", ifp->if_name, ifp->if_unit);
@@ -366,8 +372,12 @@ tunoutput(ifp, m0, dst, rt)
tp->tun_flags &= ~TUN_RWAIT;
wakeup((caddr_t)tp);
}
- if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio)
- pgsigio(tp->tun_sigio, SIGIO, 0);
+ if (tp->tun_flags & TUN_ASYNC && tp->tun_pgrp) {
+ if (tp->tun_pgrp > 0)
+ gsignal(tp->tun_pgrp, SIGIO);
+ else if ((p = pfind(-tp->tun_pgrp)) != 0)
+ psignal(p, SIGIO);
+ }
selwakeup(&tp->tun_rsel);
return 0;
}
@@ -424,22 +434,12 @@ tunioctl(dev, cmd, data, flag, p)
*(int *)data = 0;
splx(s);
break;
- case FIOSETOWN:
- return (fsetown(*(int *)data, &tp->tun_sigio));
-
- case FIOGETOWN:
- *(int *)data = fgetown(tp->tun_sigio);
- return (0);
-
- /* This is deprecated, FIOSETOWN should be used instead. */
case TIOCSPGRP:
- return (fsetown(-(*(int *)data), &tp->tun_sigio));
-
- /* This is deprecated, FIOGETOWN should be used instead. */
+ tp->tun_pgrp = *(int *)data;
+ break;
case TIOCGPGRP:
- *(int *)data = -fgetown(tp->tun_sigio);
- return (0);
-
+ *(int *)data = tp->tun_pgrp;
+ break;
default:
return (ENOTTY);
}
diff --git a/sys/net/if_tunvar.h b/sys/net/if_tunvar.h
index 9e537d3abef83..c44911bcc15c2 100644
--- a/sys/net/if_tunvar.h
+++ b/sys/net/if_tunvar.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_tunvar.h,v 1.2 1998/11/11 10:04:10 truckman Exp $
+ * $Id:$
*/
#ifndef _NET_IF_TUNVAR_H_
@@ -42,7 +42,7 @@ struct tun_softc {
#define TUN_READY (TUN_OPEN | TUN_INITED)
struct ifnet tun_if; /* the interface */
- struct sigio *tun_sigio; /* information for async I/O */
+ int tun_pgrp; /* the process group - if any */
struct selinfo tun_rsel; /* read select */
struct selinfo tun_wsel; /* write select (not used) */
};
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 31ce8f63c15d7..0feaf2322d29b 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)if.h 8.1 (Berkeley) 6/10/93
- * $Id: if_var.h,v 1.9 1998/06/12 03:48:09 julian Exp $
+ * $Id: if_var.h,v 1.8 1998/06/07 17:12:06 dfr Exp $
*/
#ifndef _NET_IF_VAR_H_
@@ -300,9 +300,10 @@ int if_allmulti __P((struct ifnet *, int));
void if_attach __P((struct ifnet *));
int if_delmulti __P((struct ifnet *, struct sockaddr *));
void if_down __P((struct ifnet *));
-void if_route __P((struct ifnet *, int flag, int fam));
-void if_unroute __P((struct ifnet *, int flag, int fam));
void if_up __P((struct ifnet *));
+#ifdef vax
+void ifubareset __P((int));
+#endif
/*void ifinit __P((void));*/ /* declared in systm.h for main() */
int ifioctl __P((struct socket *, u_long, caddr_t, struct proc *));
int ifpromisc __P((struct ifnet *, int));
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 2488b31a1a363..d6149e9175e1d 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_vlan.c,v 1.3 1998/08/23 03:07:10 wollman Exp $
+ * $Id: if_vlan.c,v 1.2 1998/05/15 20:02:47 wollman Exp $
*/
/*
@@ -334,8 +334,8 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
case SIOCGETVLAN:
bzero(&vlr, sizeof vlr);
if (ifv->ifv_p) {
- snprintf(vlr.vlr_parent, sizeof(vlr.vlr_parent),
- "%s%d", ifv->ifv_p->if_name, ifv->ifv_p->if_unit);
+ sprintf(vlr.vlr_parent, "%s%d", ifv->ifv_p->if_name,
+ ifv->ifv_p->if_unit);
vlr.vlr_tag = ifv->ifv_tag;
}
error = copyout(&vlr, ifr->ifr_data, sizeof vlr);
diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c
index 74e7172f960ce..dc48c8f2b4100 100644
--- a/sys/net/ppp_tty.c
+++ b/sys/net/ppp_tty.c
@@ -70,7 +70,7 @@
* Paul Mackerras (paulus@cs.anu.edu.au).
*/
-/* $Id: ppp_tty.c,v 1.37 1998/06/20 16:39:35 peter Exp $ */
+/* $Id: ppp_tty.c,v 1.36 1998/06/07 17:12:07 dfr Exp $ */
#include "ppp.h"
#if NPPP > 0
@@ -89,7 +89,14 @@
#include <sys/tty.h>
#include <sys/conf.h>
#include <sys/uio.h>
-#include <sys/vnode.h>
+
+/*
+ * XXX stop <sys/vnode.h> from including <vnode_if.h>. <vnode_if.h> doesn't
+ * exist if we are an LKM.
+ */
+#undef KERNEL
+# include <sys/vnode.h>
+#define KERNEL
#ifdef __i386__
#include <i386/isa/intr_machdep.h>