diff options
author | Camiel Dobbelaar <camield@cvs.openbsd.org> | 2012-10-05 17:17:05 +0000 |
---|---|---|
committer | Camiel Dobbelaar <camield@cvs.openbsd.org> | 2012-10-05 17:17:05 +0000 |
commit | 97f361f45ba615c51d5ed3d199661695056d69fd (patch) | |
tree | d587043476b3011e4b9d407ae8f76b924f697564 /sys/netinet | |
parent | f9456dc1995e86224b952c3e98063ed528245036 (diff) |
Point an interface directly to its bridgeport configuration, instead
of to the bridge itself. This is ok, since an interface can only be part
of one bridge, and the parent bridge is easy to find from the bridgeport.
This way we can get rid of a lot of list walks, improving performance
and shortening the code.
ok henning stsp sthen reyk
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/if_ether.c | 17 | ||||
-rw-r--r-- | sys/netinet/ip_ether.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 12 |
3 files changed, 21 insertions, 12 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 9dd619da153..6b591c89f1a 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.94 2012/10/05 12:30:43 camield Exp $ */ +/* $OpenBSD: if_ether.c,v 1.95 2012/10/05 17:17:04 camield Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -63,6 +63,9 @@ #if NCARP > 0 #include <netinet/ip_carp.h> #endif +#if NBRIDGE > 0 +#include <net/if_bridge.h> +#endif #define SIN(s) ((struct sockaddr_in *)s) #define SDL(s) ((struct sockaddr_dl *)s) @@ -691,12 +694,18 @@ in_arpinput(struct mbuf *m) rt->rt_expire = 1; /* no longer static */ } } - } else if (rt->rt_ifp != &ac->ac_if && !(ac->ac_if.if_bridge && - (rt->rt_ifp->if_bridge == ac->ac_if.if_bridge)) && + } else if (rt->rt_ifp != &ac->ac_if && +#if NBRIDGE > 0 + !SAME_BRIDGE(ac->ac_if.if_bridgeport, + rt->rt_ifp->if_bridgeport) && +#endif +#if NCARP > 0 !(rt->rt_ifp->if_type == IFT_CARP && rt->rt_ifp->if_carpdev == &ac->ac_if) && !(ac->ac_if.if_type == IFT_CARP && - ac->ac_if.if_carpdev == rt->rt_ifp)) { + ac->ac_if.if_carpdev == rt->rt_ifp) && +#endif + 1) { log(LOG_WARNING, "arp: attempt to add entry for %s " "on %s by %s on %s\n", diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c index 15d91e4855c..4514bf29c0f 100644 --- a/sys/netinet/ip_ether.c +++ b/sys/netinet/ip_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ether.c,v 1.60 2012/10/05 12:29:15 camield Exp $ */ +/* $OpenBSD: ip_ether.c,v 1.61 2012/10/05 17:17:04 camield Exp $ */ /* * The author of this code is Angelos D. Keromytis (kermit@adk.gr) * @@ -233,7 +233,7 @@ etherip_decap(struct mbuf *m, int iphlen) sc = etherip_getgif(m); if (sc == NULL) return; - if (sc->gif_if.if_bridge == NULL) { + if (sc->gif_if.if_bridgeport == NULL) { DPRINTF(("etherip_input(): interface not part of bridge\n")); etheripstat.etherip_noifdrops++; m_freem(m); diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 742eb7dc666..10e04519fc7 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.231 2012/09/20 10:25:03 blambert Exp $ */ +/* $OpenBSD: ip_output.c,v 1.232 2012/10/05 17:17:04 camield Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -740,7 +740,7 @@ sendit: if (ntohs(ip->ip_len) <= mtu) { ip->ip_sum = 0; if ((ifp->if_capabilities & IFCAP_CSUM_IPv4) && - (ifp->if_bridge == NULL)) { + (ifp->if_bridgeport == NULL)) { m->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT; ipstat.ips_outhwcsum++; } else @@ -887,7 +887,7 @@ ip_fragment(struct mbuf *m, struct ifnet *ifp, u_long mtu) mhip->ip_sum = 0; if ((ifp != NULL) && (ifp->if_capabilities & IFCAP_CSUM_IPv4) && - (ifp->if_bridge == NULL)) { + (ifp->if_bridgeport == NULL)) { m->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT; ipstat.ips_outhwcsum++; } else @@ -907,7 +907,7 @@ ip_fragment(struct mbuf *m, struct ifnet *ifp, u_long mtu) ip->ip_sum = 0; if ((ifp != NULL) && (ifp->if_capabilities & IFCAP_CSUM_IPv4) && - (ifp->if_bridge == NULL)) { + (ifp->if_bridgeport == NULL)) { m->m_pkthdr.csum_flags |= M_IPV4_CSUM_OUT; ipstat.ips_outhwcsum++; } else @@ -2150,13 +2150,13 @@ in_proto_cksum_out(struct mbuf *m, struct ifnet *ifp) { if (m->m_pkthdr.csum_flags & M_TCP_CSUM_OUT) { if (!ifp || !(ifp->if_capabilities & IFCAP_CSUM_TCPv4) || - ifp->if_bridge != NULL) { + ifp->if_bridgeport != NULL) { in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~M_TCP_CSUM_OUT; /* Clear */ } } else if (m->m_pkthdr.csum_flags & M_UDP_CSUM_OUT) { if (!ifp || !(ifp->if_capabilities & IFCAP_CSUM_UDPv4) || - ifp->if_bridge != NULL) { + ifp->if_bridgeport != NULL) { in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~M_UDP_CSUM_OUT; /* Clear */ } |