summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorChristopher Pascoe <pascoe@cvs.openbsd.org>2004-12-17 12:42:03 +0000
committerChristopher Pascoe <pascoe@cvs.openbsd.org>2004-12-17 12:42:03 +0000
commit00cabea6fcdbcf8569fba0e1263ab451f1cdf325 (patch)
treeaf618745f40973d7af5d616f304616ed17c64d0e /sys/net
parent4b8b00a64383f5942e6ec2170da2236e0ad29722 (diff)
Reorder code in the ethernet output path, and enhance unicast address
matching in the bridge receive path to make CARP operate correctly on physical interfaces that are participating in a bridge. ok mcbride@ henning@ dlg@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_bridge.c21
-rw-r--r--sys/net/if_ethersubr.c18
2 files changed, 27 insertions, 12 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index a99466c4d5c..8936febc198 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.138 2004/10/09 19:55:28 brad Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.139 2004/12/17 12:42:02 pascoe Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -35,6 +35,7 @@
#include "gif.h"
#include "pf.h"
#include "vlan.h"
+#include "carp.h"
#include <sys/param.h>
#include <sys/proc.h>
@@ -90,6 +91,10 @@
#include <net/if_vlan_var.h>
#endif
+#if NCARP > 0
+#include <netinet/ip_carp.h>
+#endif
+
#include <net/if_bridge.h>
#ifndef BRIDGE_RTABLE_SIZE
@@ -1387,7 +1392,12 @@ bridge_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
if (ifl->ifp->if_type != IFT_ETHER)
continue;
ac = (struct arpcom *)ifl->ifp;
- if (bcmp(ac->ac_enaddr, eh->ether_dhost, ETHER_ADDR_LEN) == 0) {
+ if (bcmp(ac->ac_enaddr, eh->ether_dhost, ETHER_ADDR_LEN) == 0
+#if NCARP > 0
+ || (ifl->ifp->if_carp && carp_ourether(ifl->ifp->if_carp,
+ eh, 0) != NULL)
+#endif
+ ) {
if (srcifl->bif_flags & IFBIF_LEARNING)
bridge_rtupdate(sc,
(struct ether_addr *)&eh->ether_shost,
@@ -1405,7 +1415,12 @@ bridge_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
}
return (m);
}
- if (bcmp(ac->ac_enaddr, eh->ether_shost, ETHER_ADDR_LEN) == 0) {
+ if (bcmp(ac->ac_enaddr, eh->ether_shost, ETHER_ADDR_LEN) == 0
+#if NCARP > 0
+ || (ifl->ifp->if_carp && carp_ourether(ifl->ifp->if_carp,
+ eh, 1) != NULL)
+#endif
+ ) {
m_freem(m);
return (NULL);
}
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index dee823be08c..cfc6fbc5cc5 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.85 2004/12/10 22:35:17 mcbride Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.86 2004/12/17 12:42:02 pascoe Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -493,6 +493,14 @@ ether_output(ifp0, m0, dst, rt0)
bcopy((caddr_t)ac->ac_enaddr, (caddr_t)eh->ether_shost,
sizeof(eh->ether_shost));
+#if NCARP > 0
+ if (ifp->if_carp) {
+ error = carp_fix_lladdr(ifp0, m, dst, NULL);
+ if (error)
+ goto bad;
+ }
+#endif
+
#if NBRIDGE > 0
/*
* Interfaces that are bridge members need special handling
@@ -534,14 +542,6 @@ ether_output(ifp0, m0, dst, rt0)
}
#endif
-#if NCARP > 0
- if (ifp->if_carp) {
- error = carp_fix_lladdr(ifp0, m, dst, NULL);
- if (error)
- goto bad;
- }
-#endif
-
mflags = m->m_flags;
len = m->m_pkthdr.len;
s = splimp();