summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2001-03-22 05:26:36 +0000
committerJason Wright <jason@cvs.openbsd.org>2001-03-22 05:26:36 +0000
commitf5fc3ce8b195f8959f6d308d752f1a98d5963440 (patch)
tree8040992e0880ea89381663fd7d947eb54d1de13a /sys
parent0bc5993a89be95ce9ca6c671804ce9e8eb5f2e7b (diff)
remove vlan_proto variable, replace with ETHERTYPE_8021Q
define if_type for vlan interfaces (IFT_8021_VLAN) #ifdef DEBUG some debugging printf's protect against other uses of M_PROTO1
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_ethersubr.c4
-rw-r--r--sys/net/if_types.h3
-rw-r--r--sys/net/if_vlan.c21
-rw-r--r--sys/net/if_vlan_var.h4
4 files changed, 17 insertions, 15 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 662ea4c6498..448da1d8e46 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.42 2001/02/20 19:39:27 mickey Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.43 2001/03/22 05:26:35 jason Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -615,7 +615,7 @@ decapsulate:
etype = ntohs(eh->ether_type);
#if NVLAN > 0
- if (etype == vlan_proto) {
+ if (etype == ETHERTYPE_8021Q) {
if (vlan_input(eh, m) < 0)
ifp->if_data.ifi_noproto++;
return;
diff --git a/sys/net/if_types.h b/sys/net/if_types.h
index db45933482c..2c90897c4b5 100644
--- a/sys/net/if_types.h
+++ b/sys/net/if_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_types.h,v 1.6 2000/10/18 19:00:13 jason Exp $ */
+/* $OpenBSD: if_types.h,v 1.7 2001/03/22 05:26:35 jason Exp $ */
/* $NetBSD: if_types.h,v 1.7 1995/02/27 09:10:24 glass Exp $ */
/*
@@ -100,6 +100,7 @@
/* private usage... how should we define these? */
#define IFT_BRIDGE 0xe8 /* bridge interfaces */
+#define IFT_8021_VLAN 0xe9 /* vlan interfaces */
#define IFT_GIF 0xf0
#define IFT_DUMMY 0xf1
#define IFT_PVC 0xf2
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 2147c62541e..c64e9c96f7d 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.8 2001/02/20 19:39:48 mickey Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.9 2001/03/22 05:26:35 jason Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
*
@@ -87,8 +87,6 @@
struct ifaddr **ifnet_addrs;
-u_int vlan_proto = ETHERTYPE_8021Q;
-
struct ifvlan ifv_softc[NVLAN];
extern int ifqmaxlen;
@@ -190,7 +188,7 @@ vlan_start(struct ifnet *ifp)
ifp->if_flags |= IFF_OACTIVE;
for (;;) {
IF_DEQUEUE(&ifp->if_snd, m);
- if (m == 0)
+ if (m == NULL)
break;
if ((p->if_flags & (IFF_UP|IFF_RUNNING)) !=
@@ -229,9 +227,13 @@ vlan_start(struct ifnet *ifp)
m->m_pkthdr.rcvif = ifp;
m->m_flags |= M_PROTO1;
} else {
+ m->m_flags &= ~M_PROTO1;
M_PREPEND(m, EVL_ENCAPLEN, M_DONTWAIT);
if (m == NULL) {
- printf("%s: M_PREPEND failed", ifv->ifv_p->if_xname);
+#ifdef DEBUG
+ printf("%s: M_PREPEND failed\n",
+ ifv->ifv_p->if_xname);
+#endif
ifp->if_ierrors++;
continue;
}
@@ -239,7 +241,10 @@ vlan_start(struct ifnet *ifp)
m = m_pullup(m, ETHER_HDR_LEN + EVL_ENCAPLEN);
if (m == NULL) {
- printf("%s: m_pullup failed", ifv->ifv_p->if_xname);
+#ifdef DEBUG
+ printf("%s: m_pullup failed\n",
+ ifv->ifv_p->if_xname);
+#endif
ifp->if_ierrors++;
continue;
}
@@ -252,7 +257,7 @@ vlan_start(struct ifnet *ifp)
sizeof(struct ether_header));
evl = mtod(m, struct ether_vlan_header *);
evl->evl_proto = evl->evl_encap_proto;
- evl->evl_encap_proto = htons(vlan_proto);
+ evl->evl_encap_proto = htons(ETHERTYPE_8021Q);
evl->evl_tag = htons(ifv->ifv_tag);
#ifdef DEBUG
printf("vlan_start: %*D\n", sizeof *evl,
@@ -541,7 +546,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
}
pr = ifunit(vlr.vlr_parent);
- if (pr == 0) {
+ if (pr == NULL) {
error = ENOENT;
break;
}
diff --git a/sys/net/if_vlan_var.h b/sys/net/if_vlan_var.h
index 5b83e54924b..57731911a5c 100644
--- a/sys/net/if_vlan_var.h
+++ b/sys/net/if_vlan_var.h
@@ -64,9 +64,6 @@ struct ether_vlan_header {
#define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7)
#define EVL_ENCAPLEN 4 /* length in octets of encapsulation */
-/* When these sorts of interfaces get their own identifier... */
-#define IFT_8021_VLAN IFT_PROPVIRTUAL
-
/* sysctl(3) tags, for compatibility purposes */
#define VLANCTL_PROTO 1
#define VLANCTL_MAX 2
@@ -82,7 +79,6 @@ struct vlanreq {
#define SIOCGETVLAN SIOCGIFGENERIC
#ifdef _KERNEL
-extern u_int vlan_proto;
extern int vlan_input(register struct ether_header *eh, struct mbuf *m);
extern int vlan_input_tag(struct ether_header *eh,
struct mbuf *m, u_int16_t t);