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:
parent
1773f77821
commit
b3a1f9373a
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
.PATH: ${.CURDIR}/../../net
|
.PATH: ${.CURDIR}/../../net
|
||||||
KMOD= if_bridge
|
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)
|
.if !defined(KERNBUILDDIR)
|
||||||
opt_inet.h:
|
opt_inet.h:
|
||||||
|
@ -84,6 +84,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include "opt_inet.h"
|
#include "opt_inet.h"
|
||||||
#include "opt_inet6.h"
|
#include "opt_inet6.h"
|
||||||
|
#include "opt_carp.h"
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/mbuf.h>
|
#include <sys/mbuf.h>
|
||||||
@ -120,6 +121,9 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <netinet/ip6.h>
|
#include <netinet/ip6.h>
|
||||||
#include <netinet6/ip6_var.h>
|
#include <netinet6/ip6_var.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DEV_CARP
|
||||||
|
#include <netinet/ip_carp.h>
|
||||||
|
#endif
|
||||||
#include <machine/in_cksum.h>
|
#include <machine/in_cksum.h>
|
||||||
#include <netinet/if_ether.h> /* for struct arpcom */
|
#include <netinet/if_ether.h> /* for struct arpcom */
|
||||||
#include <net/if_bridgevar.h>
|
#include <net/if_bridgevar.h>
|
||||||
@ -2039,7 +2043,12 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
|
|||||||
continue;
|
continue;
|
||||||
/* It is destined for us. */
|
/* It is destined for us. */
|
||||||
if (memcmp(IF_LLADDR(bif->bif_ifp), eh->ether_dhost,
|
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)
|
if (bif->bif_flags & IFBIF_LEARNING)
|
||||||
(void) bridge_rtupdate(sc,
|
(void) bridge_rtupdate(sc,
|
||||||
eh->ether_shost, ifp, 0, IFBAF_DYNAMIC);
|
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. */
|
/* We just received a packet that we sent out. */
|
||||||
if (memcmp(IF_LLADDR(bif->bif_ifp), eh->ether_shost,
|
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);
|
BRIDGE_UNLOCK(sc);
|
||||||
m_freem(m);
|
m_freem(m);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user