summaryrefslogtreecommitdiff
path: root/sys/net/if_bridge.c
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2000-10-18 16:30:29 +0000
committerJason Wright <jason@cvs.openbsd.org>2000-10-18 16:30:29 +0000
commit25080128cffe2c4c80173797b19693497692350f (patch)
tree7029b8072162cf553629ab94a86fd7e311c43bea /sys/net/if_bridge.c
parent860ea68721fb203121a3bff2752ccf5335bade23 (diff)
revamped llc handling using if_llc.h
removed unused structure
Diffstat (limited to 'sys/net/if_bridge.c')
-rw-r--r--sys/net/if_bridge.c63
1 files changed, 26 insertions, 37 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 5bac00dd22b..292d465b75c 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.37 2000/10/18 04:31:14 jason Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.38 2000/10/18 16:30:28 jason Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -142,15 +142,6 @@ struct bridge_softc {
LIST_HEAD(bridge_rthead, bridge_rtnode) *sc_rts;/* hash table */
};
-/* SNAP LLC header */
-struct snap {
- u_int8_t dsap;
- u_int8_t ssap;
- u_int8_t control;
- u_int8_t org[3];
- u_int16_t type;
-};
-
struct bridge_softc bridgectl[NBRIDGE];
void bridgeattach __P((int));
@@ -1666,7 +1657,7 @@ bridge_blocknonip(eh, m)
struct ether_header *eh;
struct mbuf *m;
{
- struct snap snap;
+ struct llc llc;
u_int16_t etype;
if (m->m_pkthdr.len < sizeof(struct ether_header))
@@ -1685,16 +1676,19 @@ bridge_blocknonip(eh, m)
return (1);
if (m->m_pkthdr.len <
- (sizeof(struct ether_header) + sizeof(struct snap)))
+ (sizeof(struct ether_header) + LLC_SNAPFRAMELEN))
return (1);
- m_copydata(m, sizeof(struct ether_header), sizeof(struct snap),
- (caddr_t)&snap);
+ m_copydata(m, sizeof(struct ether_header), LLC_SNAPFRAMELEN,
+ (caddr_t)&llc);
- etype = ntohs(snap.type);
- if (snap.dsap == LLC_SNAP_LSAP && snap.ssap == LLC_SNAP_LSAP &&
- snap.control == LLC_UI &&
- snap.org[0] == 0 && snap.org[1] == 0 && snap.org[2] == 0 &&
+ etype = ntohs(llc.llc_snap.ether_type);
+ if (llc.llc_dsap == LLC_SNAP_LSAP &&
+ llc.llc_ssap == LLC_SNAP_LSAP &&
+ llc.llc_control == LLC_UI &&
+ llc.llc_snap.org_code[0] == 0 &&
+ llc.llc_snap.org_code[1] == 0 &&
+ llc.llc_snap.org_code[2] == 0 &&
(etype == ETHERTYPE_ARP ||
etype == ETHERTYPE_REVARP ||
etype == ETHERTYPE_IP ||
@@ -1790,14 +1784,6 @@ bridge_flushrule(bif)
#if defined(INET) && (defined(IPFILTER) || defined(IPFILTER_LKM))
/*
- * Maximum sized IP header
- */
-union maxip {
- struct ip ip;
- u_int32_t _padding[16];
-};
-
-/*
* Filter IP packets by peeking into the ethernet frame. This violates
* the ISO model, but allows us to act as a IP filter at the data link
* layer. As a result, most of this code will look familiar to those
@@ -1810,7 +1796,7 @@ bridge_filter(sc, ifp, eh, m)
struct ether_header *eh;
struct mbuf *m;
{
- struct snap snap;
+ struct llc llc;
int hassnap = 0;
struct ip *ip;
int hlen;
@@ -1820,24 +1806,27 @@ bridge_filter(sc, ifp, eh, m)
if (eh->ether_type != htons(ETHERTYPE_IP)) {
if (eh->ether_type > ETHERMTU ||
- m->m_pkthdr.len < (sizeof(struct snap) +
+ m->m_pkthdr.len < (LLC_SNAPFRAMELEN +
sizeof(struct ether_header)))
return (m);
m_copydata(m, sizeof(struct ether_header),
- sizeof(struct snap), (caddr_t)&snap);
-
- if (snap.dsap != LLC_SNAP_LSAP || snap.ssap != LLC_SNAP_LSAP ||
- snap.control != LLC_UI ||
- snap.org[0] != 0 || snap.org[1] != 0 || snap.org[2] ||
- snap.type != htons(ETHERTYPE_IP))
+ LLC_SNAPFRAMELEN, (caddr_t)&llc);
+
+ if (llc.llc_dsap != LLC_SNAP_LSAP ||
+ llc.llc_ssap != LLC_SNAP_LSAP ||
+ llc.llc_control != LLC_UI ||
+ llc.llc_snap.org_code[0] ||
+ llc.llc_snap.org_code[1] ||
+ llc.llc_snap.org_code[2] ||
+ llc.llc_snap.ether_type != htons(ETHERTYPE_IP))
return (m);
hassnap = 1;
}
m_adj(m, sizeof(struct ether_header));
if (hassnap)
- m_adj(m, sizeof(struct snap));
+ m_adj(m, LLC_SNAPFRAMELEN);
if (m->m_pkthdr.len < sizeof(struct ip))
goto dropit;
@@ -1896,10 +1885,10 @@ bridge_filter(sc, ifp, eh, m)
/* Reattach SNAP header */
if (hassnap) {
- M_PREPEND(m, sizeof(snap), M_DONTWAIT);
+ M_PREPEND(m, LLC_SNAPFRAMELEN, M_DONTWAIT);
if (m == NULL)
goto dropit;
- bcopy(&snap, mtod(m, caddr_t), sizeof(snap));
+ bcopy(&llc, mtod(m, caddr_t), LLC_SNAPFRAMELEN);
}
/* Reattach ethernet header */