summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_ethersubr.c9
-rw-r--r--sys/net/if_fddisubr.c9
-rw-r--r--sys/net/if_tokensubr.c11
-rw-r--r--sys/netinet/ip_carp.c145
-rw-r--r--sys/netinet/ip_carp.h5
-rw-r--r--sys/netinet6/nd6_nbr.c10
-rw-r--r--sys/sys/mbuf.h5
7 files changed, 21 insertions, 173 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index c89daabab6e..2a832916b5c 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.87 2004/12/19 03:25:36 mcbride Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.88 2005/01/18 23:26:52 mpf Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -494,10 +494,9 @@ ether_output(ifp0, m0, dst, rt0)
sizeof(eh->ether_shost));
#if NCARP > 0
- if (ifp->if_carp) {
- error = carp_fix_lladdr(ifp0, m, dst, NULL);
- if (error)
- goto bad;
+ if (ifp0 != ifp && ifp0->if_type == IFT_CARP) {
+ bcopy((caddr_t)((struct arpcom *)ifp0)->ac_enaddr,
+ (caddr_t)eh->ether_shost, sizeof(eh->ether_shost));
}
#endif
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index 1d9715919c3..9a8a67d0a41 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_fddisubr.c,v 1.43 2004/12/19 03:25:36 mcbride Exp $ */
+/* $OpenBSD: if_fddisubr.c,v 1.44 2005/01/18 23:26:52 mpf Exp $ */
/* $NetBSD: if_fddisubr.c,v 1.5 1996/05/07 23:20:21 christos Exp $ */
/*
@@ -414,10 +414,9 @@ fddi_output(ifp0, m0, dst, rt0)
bcopy((caddr_t)ac->ac_enaddr, (caddr_t)fh->fddi_shost,
sizeof(fh->fddi_shost));
#if NCARP > 0
- if (ifp->if_carp) {
- error = carp_fix_lladdr(ifp0, m, dst, NULL);
- if (error)
- goto bad;
+ if (ifp0 != ifp && ifp0->if_type == IFT_CARP) {
+ bcopy((caddr_t)((struct arpcom *)ifp0)->ac_enaddr,
+ (caddr_t)fh->fddi_shost, sizeof(fh->fddi_shost));
}
#endif
mflags = m->m_flags;
diff --git a/sys/net/if_tokensubr.c b/sys/net/if_tokensubr.c
index e815b80ed9a..23d74acc58c 100644
--- a/sys/net/if_tokensubr.c
+++ b/sys/net/if_tokensubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tokensubr.c,v 1.17 2004/12/19 03:25:36 mcbride Exp $ */
+/* $OpenBSD: if_tokensubr.c,v 1.18 2005/01/18 23:26:52 mpf Exp $ */
/* $NetBSD: if_tokensubr.c,v 1.7 1999/05/30 00:39:07 bad Exp $ */
/*
@@ -409,15 +409,14 @@ token_output(ifp0, m0, dst, rt0)
#if 0
send:
#endif /* 0 */
+
#if NCARP > 0
- if (ifp->if_carp) {
- error = carp_fix_lladdr(ifp0, m, dst, NULL);
- if (error)
- goto bad;
+ if (ifp0 != ifp && ifp0->if_type == IFT_CARP) {
+ bcopy((caddr_t)((struct arpcom *)ifp0)->ac_enaddr,
+ (caddr_t)trh->token_shost, sizeof(trh->token_shost));
}
#endif
-
mflags = m->m_flags;
len = m->m_pkthdr.len;
s = splimp();
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 0343a12c402..ff29ed9991a 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.93 2005/01/06 21:45:35 deraadt Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.94 2005/01/18 23:26:52 mpf Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -803,9 +803,6 @@ carp_ifdetach(struct ifnet *ifp)
int
carp_prepare_ad(struct mbuf *m, struct carp_softc *sc, struct carp_header *ch)
{
- struct m_tag *mtag;
- struct ifnet *ifp = &sc->sc_if;
-
if (sc->sc_init_counter) {
/* this could also be seconds since unix epoch */
sc->sc_counter = arc4random();
@@ -819,17 +816,6 @@ carp_prepare_ad(struct mbuf *m, struct carp_softc *sc, struct carp_header *ch)
carp_hmac_generate(sc, ch->carp_counter, ch->carp_md);
- /* Tag packet for carp_fix_lladdr */
- mtag = m_tag_get(PACKET_TAG_CARP, sizeof(struct ifnet *), M_NOWAIT);
- if (mtag == NULL) {
- m_freem(m);
- sc->sc_if.if_oerrors++;
- carpstats.carps_onomem++;
- return (ENOMEM);
- }
- bcopy(&ifp, (caddr_t)(mtag + 1), sizeof(struct ifnet *));
- m_tag_prepend(m, mtag);
-
return (0);
}
@@ -1217,41 +1203,6 @@ carp_iamatch6(void *v, struct in6_addr *taddr)
return (NULL);
}
-
-void *
-carp_macmatch6(void *v, struct mbuf *m, struct in6_addr *taddr)
-{
- struct m_tag *mtag;
- struct carp_if *cif = v;
- struct carp_softc *sc;
- struct ifaddr *ifa;
-
-
- TAILQ_FOREACH(sc, &cif->vhif_vrs, sc_list) {
- TAILQ_FOREACH(ifa, &sc->sc_if.if_addrlist, ifa_list) {
- if (IN6_ARE_ADDR_EQUAL(taddr,
- &ifatoia6(ifa)->ia_addr.sin6_addr) &&
- ((sc->sc_if.if_flags & (IFF_UP|IFF_RUNNING)) ==
- (IFF_UP|IFF_RUNNING))) {
- struct ifnet *ifp = &sc->sc_if;
-
- mtag = m_tag_get(PACKET_TAG_CARP,
- sizeof(struct ifnet *), M_NOWAIT);
- if (mtag == NULL) {
- /* better a bit than nothing */
- return (sc->sc_ac.ac_enaddr);
- }
- bcopy(&ifp, (caddr_t)(mtag + 1),
- sizeof(struct ifnet *));
- m_tag_prepend(m, mtag);
-
- return (sc->sc_ac.ac_enaddr);
- }
- }
- }
-
- return (NULL);
-}
#endif /* INET6 */
struct ifnet *
@@ -2011,103 +1962,15 @@ carp_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa,
struct rtentry *rt)
{
struct ifnet *ifp0 = ((struct carp_softc *)ifp->if_softc)->sc_carpdev;
- if (ifp0) {
- struct m_tag *mtag;
-
- /* Tag packet for carp_fix_lladdr if not already tagged */
- mtag = m_tag_find(m, PACKET_TAG_CARP, NULL);
- if (mtag == NULL) {
- mtag = m_tag_get(PACKET_TAG_CARP,
- sizeof(struct ifnet *), M_NOWAIT);
- if (mtag == NULL) {
- m_freem(m);
- ((struct carp_softc *)ifp->if_softc
- )->sc_if.if_oerrors++;
- carpstats.carps_onomem++;
- return (ENOBUFS);
- }
- bcopy(&ifp, (caddr_t)(mtag + 1),
- sizeof(struct ifnet *));
- m_tag_prepend(m, mtag);
- }
+
+ if (ifp0 != NULL)
return (ifp0->if_output(ifp, m, sa, rt));
- } else {
+ else {
m_freem(m);
return (EINVAL);
}
}
-int
-carp_fix_lladdr(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa,
- struct rtentry *rt)
-{
- struct m_tag *mtag;
- struct carp_softc *sc;
- struct ifnet *carp_ifp;
-
- if (!sa)
- return (0);
-
- switch (sa->sa_family) {
-#ifdef INET
- case AF_INET:
- break;
-#endif /* INET */
-#ifdef INET6
- case AF_INET6:
- break;
-#endif /* INET6 */
- default:
- return (0);
- }
-
- mtag = m_tag_find(m, PACKET_TAG_CARP, NULL);
- if (mtag == NULL)
- return (0);
- bcopy(mtag + 1, &carp_ifp, sizeof(struct ifnet *));
- sc = carp_ifp->if_softc;
-
- /* Set the source MAC address to Virtual Router MAC Address */
- switch (sc->sc_carpdev->if_type) {
-#if NETHER > 0
- case IFT_ETHER: {
- struct ether_header *eh;
-
- eh = mtod(m, struct ether_header *);
- bcopy(&sc->sc_ac.ac_enaddr, eh->ether_shost,
- sizeof(eh->ether_shost));
- }
- break;
-#endif
-#if NFDDI > 0
- case IFT_FDDI: {
- struct fddi_header *fh;
-
- fh = mtod(m, struct fddi_header *);
- bcopy(&sc->sc_ac.ac_enaddr, fh->fddi_shost,
- sizeof(fh->fddi_shost));
- }
- break;
-#endif
-#if NTOKEN > 0
- case IFT_ISO88025: {
- struct token_header *th;
-
- th = mtod(m, struct token_header *);
- bcopy(&sc->sc_ac.ac_enaddr, fh->token_shost,
- sizeof(th->token_shost));
- }
- break;
-#endif
- default:
- printf("%s: carp is not supported for this interface type\n",
- sc->sc_carpdev->if_xname);
- return (EOPNOTSUPP);
- }
-
- return (0);
-}
-
void
carp_set_state(struct carp_softc *sc, int state)
{
diff --git a/sys/netinet/ip_carp.h b/sys/netinet/ip_carp.h
index 452afb05c4d..baca99a16db 100644
--- a/sys/netinet/ip_carp.h
+++ b/sys/netinet/ip_carp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.h,v 1.15 2004/12/19 03:25:37 mcbride Exp $ */
+/* $OpenBSD: ip_carp.h,v 1.16 2005/01/18 23:26:52 mpf Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -156,12 +156,9 @@ void carp_ifdetach (struct ifnet *);
void carp_proto_input (struct mbuf *, ...);
void carp_carpdev_state(struct ifnet *);
int carp6_proto_input(struct mbuf **, int *, int);
-int carp_fix_lladdr(struct ifnet *, struct mbuf *,
- struct sockaddr *, struct rtentry *);
int carp_iamatch(void *, struct in_ifaddr *, struct in_addr *,
u_int8_t **);
struct ifaddr *carp_iamatch6(void *, struct in6_addr *);
-void *carp_macmatch6(void *, struct mbuf *, struct in6_addr *);
struct ifnet *carp_ourether(void *, struct ether_header *, u_char, int);
int carp_input(struct mbuf *, u_int8_t *, u_int8_t *, u_int16_t);
int carp_output(struct ifnet *, struct mbuf *, struct sockaddr *,
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index a955650ac5e..a9a824f1dc6 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_nbr.c,v 1.35 2004/12/21 10:28:35 mcbride Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.36 2005/01/18 23:26:52 mpf Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -938,15 +938,7 @@ nd6_na_output(ifp, daddr6, taddr6, flags, tlladdr, sdl0)
* my address) use lladdr configured for the interface.
*/
if (sdl0 == NULL) {
-#if NCARP > 0
- if (ifp->if_carp && ifp->if_type != IFT_CARP)
- mac = carp_macmatch6(ifp->if_carp, m, taddr6);
- if (mac == NULL)
- mac = nd6_ifptomac(ifp);
-#else
-
mac = nd6_ifptomac(ifp);
-#endif
} else if (sdl0->sa_family == AF_LINK) {
struct sockaddr_dl *sdl;
sdl = (struct sockaddr_dl *)sdl0;
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 937e69e6de6..d32c67d6b72 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbuf.h,v 1.78 2004/11/25 21:54:54 markus Exp $ */
+/* $OpenBSD: mbuf.h,v 1.79 2005/01/18 23:26:51 mpf Exp $ */
/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
/*
@@ -594,8 +594,7 @@ struct m_tag *m_tag_next(struct mbuf *, struct m_tag *);
#define PACKET_TAG_PF_FRAGCACHE 13 /* PF fragment cached */
#define PACKET_TAG_PF_QID 14 /* PF queue id */
#define PACKET_TAG_PF_TAG 15 /* PF tags */
-#define PACKET_TAG_CARP 16 /* CARP info */
-#define PACKET_TAG_PF_TRANSLATE_LOCALHOST 17 /* translated to localhost */
+#define PACKET_TAG_PF_TRANSLATE_LOCALHOST 16 /* translated to localhost */
#ifdef MBTYPES
int mbtypes[] = { /* XXX */