diff options
| author | 2008-12-14 23:04:06 +0000 | |
|---|---|---|
| committer | 2008-12-14 23:04:06 +0000 | |
| commit | 9f114d0326c4d00e4a5a741c8799b9d6be2bd9f9 (patch) | |
| tree | d8f430c4da37f66ed2a2424485aa3c2e136ef7c6 | |
| parent | Make sure the low water mark for cluster pools isn't 0 such that network (diff) | |
| download | wireguard-openbsd-9f114d0326c4d00e4a5a741c8799b9d6be2bd9f9.tar.xz wireguard-openbsd-9f114d0326c4d00e4a5a741c8799b9d6be2bd9f9.zip | |
Since trunk_hashmbuf() and thus trunk_lb_gethdr() are no longer specific
to the loadbalance code rename trunk_lb_gethdr() to just trunk_gethr().
ok mpf@
| -rw-r--r-- | sys/net/if_trunk.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c index 36e4bf3319e..9da4c3853fe 100644 --- a/sys/net/if_trunk.c +++ b/sys/net/if_trunk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.c,v 1.61 2008/11/28 02:44:18 brad Exp $ */ +/* $OpenBSD: if_trunk.c,v 1.62 2008/12/14 23:04:06 brad Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -91,6 +91,7 @@ int trunk_media_change(struct ifnet *); void trunk_media_status(struct ifnet *, struct ifmediareq *); struct trunk_port *trunk_link_active(struct trunk_softc *, struct trunk_port *); +const void *trunk_gethdr(struct mbuf *, u_int, u_int, void *); struct if_clone trunk_cloner = IF_CLONE_INITIALIZER("trunk", trunk_clone_create, trunk_clone_destroy); @@ -119,7 +120,6 @@ int trunk_lb_start(struct trunk_softc *, struct mbuf *); int trunk_lb_input(struct trunk_softc *, struct trunk_port *, struct ether_header *, struct mbuf *); int trunk_lb_porttable(struct trunk_softc *, struct trunk_port *); -const void *trunk_lb_gethdr(struct mbuf *, u_int, u_int, void *); /* Broadcast mode */ int trunk_bcast_attach(struct trunk_softc *); @@ -1001,7 +1001,7 @@ trunk_hashmbuf(struct mbuf *m, u_int32_t key) /* Special handling for encapsulating VLAN frames */ if (etype == ETHERTYPE_VLAN) { if ((vlan = (u_int16_t *) - trunk_lb_gethdr(m, off, EVL_ENCAPLEN, &vlanbuf)) == NULL) + trunk_gethdr(m, off, EVL_ENCAPLEN, &vlanbuf)) == NULL) return (p); p = hash32_buf(vlan, sizeof(*vlan), p); etype = ntohs(vlan[1]); @@ -1012,7 +1012,7 @@ trunk_hashmbuf(struct mbuf *m, u_int32_t key) #ifdef INET case ETHERTYPE_IP: if ((ip = (struct ip *) - trunk_lb_gethdr(m, off, sizeof(*ip), &ipbuf)) == NULL) + trunk_gethdr(m, off, sizeof(*ip), &ipbuf)) == NULL) return (p); p = hash32_buf(&ip->ip_src, sizeof(struct in_addr), p); p = hash32_buf(&ip->ip_dst, sizeof(struct in_addr), p); @@ -1021,7 +1021,7 @@ trunk_hashmbuf(struct mbuf *m, u_int32_t key) #ifdef INET6 case ETHERTYPE_IPV6: if ((ip6 = (struct ip6_hdr *) - trunk_lb_gethdr(m, off, sizeof(*ip6), &ip6buf)) == NULL) + trunk_gethdr(m, off, sizeof(*ip6), &ip6buf)) == NULL) return (p); p = hash32_buf(&ip6->ip6_src, sizeof(struct in6_addr), p); p = hash32_buf(&ip6->ip6_dst, sizeof(struct in6_addr), p); @@ -1219,6 +1219,18 @@ trunk_link_active(struct trunk_softc *tr, struct trunk_port *tp) return (rval); } +const void * +trunk_gethdr(struct mbuf *m, u_int off, u_int len, void *buf) +{ + if (m->m_pkthdr.len < (off + len)) + return (NULL); + else if (m->m_len < (off + len)) { + m_copydata(m, off, len, buf); + return (buf); + } + return (mtod(m, const void *) + off); +} + /* * Simple round robin trunking */ @@ -1443,18 +1455,6 @@ trunk_lb_port_destroy(struct trunk_port *tp) trunk_lb_porttable(tr, tp); } -const void * -trunk_lb_gethdr(struct mbuf *m, u_int off, u_int len, void *buf) -{ - if (m->m_pkthdr.len < (off + len)) { - return (NULL); - } else if (m->m_len < (off + len)) { - m_copydata(m, off, len, buf); - return (buf); - } - return (mtod(m, const void *) + off); -} - int trunk_lb_start(struct trunk_softc *tr, struct mbuf *m) { |
