summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_carp.c145
-rw-r--r--sys/netinet/ip_carp.h5
2 files changed, 5 insertions, 145 deletions
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 *,