Allow bridge and carp to play nicely together by returning the packet if its

destined for a carp interface.

Obtained from:	OpenBSD
MFC after:	2 weeks
This commit is contained in:
Andrew Thompson 2006-06-08 23:40:16 +00:00
parent 1773f77821
commit b3a1f9373a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159446
2 changed files with 17 additions and 3 deletions

View File

@ -4,7 +4,7 @@
.PATH: ${.CURDIR}/../../net
KMOD= if_bridge
SRCS= if_bridge.c bridgestp.c opt_inet.h opt_inet6.h
SRCS= if_bridge.c bridgestp.c opt_inet.h opt_inet6.h opt_carp.h
.if !defined(KERNBUILDDIR)
opt_inet.h:

View File

@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_carp.h"
#include <sys/param.h>
#include <sys/mbuf.h>
@ -120,6 +121,9 @@ __FBSDID("$FreeBSD$");
#include <netinet/ip6.h>
#include <netinet6/ip6_var.h>
#endif
#ifdef DEV_CARP
#include <netinet/ip_carp.h>
#endif
#include <machine/in_cksum.h>
#include <netinet/if_ether.h> /* for struct arpcom */
#include <net/if_bridgevar.h>
@ -2039,7 +2043,12 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
continue;
/* It is destined for us. */
if (memcmp(IF_LLADDR(bif->bif_ifp), eh->ether_dhost,
ETHER_ADDR_LEN) == 0) {
ETHER_ADDR_LEN) == 0
#ifdef DEV_CARP
|| (bif->bif_ifp->if_carp
&& carp_forus(bif->bif_ifp->if_carp, eh->ether_dhost))
#endif
) {
if (bif->bif_flags & IFBIF_LEARNING)
(void) bridge_rtupdate(sc,
eh->ether_shost, ifp, 0, IFBAF_DYNAMIC);
@ -2050,7 +2059,12 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
/* We just received a packet that we sent out. */
if (memcmp(IF_LLADDR(bif->bif_ifp), eh->ether_shost,
ETHER_ADDR_LEN) == 0) {
ETHER_ADDR_LEN) == 0
#ifdef DEV_CARP
|| (bif->bif_ifp->if_carp
&& carp_forus(bif->bif_ifp->if_carp, eh->ether_shost))
#endif
) {
BRIDGE_UNLOCK(sc);
m_freem(m);
return (NULL);