aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if_ethersubr.c
diff options
context:
space:
mode:
authorGarrett Wollman <wollman@FreeBSD.org>1998-03-18 01:40:12 +0000
committerGarrett Wollman <wollman@FreeBSD.org>1998-03-18 01:40:12 +0000
commit2cc2df490e841a1bb427efd6d6bd35109f7326c4 (patch)
treeca3a3f519eab54ef68a0df25abf2d8df7c1235a6 /sys/net/if_ethersubr.c
parent4641c8ac1d4bc643813138a0cca42d1ece4cf87b (diff)
downloadsrc-2cc2df490e841a1bb427efd6d6bd35109f7326c4.tar.gz
src-2cc2df490e841a1bb427efd6d6bd35109f7326c4.zip
Add preliminary support for IEEE 802.1Q VLAN tagging. It doesn't actually
work reliably yet (I've had panics), but it does seem to occasionally be able to transmit and receive syntactically-correct packets. Also fixes one of if_ethersubr.c's legion style bugs, and removes the hostcache code from standard kernels---the code that depends on it is not going to happen any time soon, I'm afraid.
Notes
Notes: svn path=/head/; revision=34649
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r--sys/net/if_ethersubr.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 73c7cc27f79a..9b64a590016c 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93
- * $Id: if_ethersubr.c,v 1.44 1998/01/31 07:23:14 eivind Exp $
+ * $Id: if_ethersubr.c,v 1.45 1998/02/20 13:11:49 bde Exp $
*/
#include "opt_atalk.h"
@@ -97,9 +97,14 @@ extern struct ifqueue pkintrq;
#define llc_snap_org_code llc_un.type_snap.org_code
#define llc_snap_ether_type llc_un.type_snap.ether_type
-extern u_char at_org_code[ 3 ];
-extern u_char aarp_org_code[ 3 ];
-#endif NETATALK
+extern u_char at_org_code[3];
+extern u_char aarp_org_code[3];
+#endif /* NETATALK */
+
+#include "vlan.h"
+#if NVLAN > 0
+#include <net/if_vlan_var.h>
+#endif /* NVLAN > 0 */
static int ether_resolvemulti __P((struct ifnet *, struct sockaddr **,
struct sockaddr *));
@@ -473,16 +478,26 @@ ether_input(ifp, eh, m)
return;
}
ifp->if_ibytes += m->m_pkthdr.len + sizeof (*eh);
- if (bcmp((caddr_t)etherbroadcastaddr, (caddr_t)eh->ether_dhost,
- sizeof(etherbroadcastaddr)) == 0)
- m->m_flags |= M_BCAST;
- else if (eh->ether_dhost[0] & 1)
- m->m_flags |= M_MCAST;
+ if (eh->ether_dhost[0] & 1) {
+ if (bcmp((caddr_t)etherbroadcastaddr, (caddr_t)eh->ether_dhost,
+ sizeof(etherbroadcastaddr)) == 0)
+ m->m_flags |= M_BCAST;
+ else
+ m->m_flags |= M_MCAST;
+ }
if (m->m_flags & (M_BCAST|M_MCAST))
ifp->if_imcasts++;
ether_type = ntohs(eh->ether_type);
+#if NVLAN > 0
+ if (ether_type == vlan_proto) {
+ if (vlan_input(eh, m) < 0)
+ ifp->if_data.ifi_noproto++;
+ return;
+ }
+#endif /* NVLAN > 0 */
+
switch (ether_type) {
#ifdef INET
case ETHERTYPE_IP: