summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormcbride <mcbride@openbsd.org>2004-09-18 16:15:53 +0000
committermcbride <mcbride@openbsd.org>2004-09-18 16:15:53 +0000
commit2dbca002b9abbe86311f30dd9056fc1fe95278fd (patch)
tree7cc033c4c732eb490cf41f7a0db088354a8de487
parentframework to be able to distinguish packages installed manually (and thus (diff)
downloadwireguard-openbsd-2dbca002b9abbe86311f30dd9056fc1fe95278fd.tar.xz
wireguard-openbsd-2dbca002b9abbe86311f30dd9056fc1fe95278fd.zip
Oops, copy a pointer to ac_if, not the first bytes of the struct itself.
Actually this doesn't matter right now, as the first bytes of struct ifnet are a pointer to the softc, which has ac_if at the beginning and thus by fluke the pointer is correct. This also makes the sc to ifp conversion for carp_macmatch6().
-rw-r--r--sys/netinet/ip_carp.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 96044f31de9..f28eccd1ca3 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.64 2004/09/18 06:51:49 mcbride Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.65 2004/09/18 16:15:53 mcbride Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -749,6 +749,7 @@ int
carp_prepare_ad(struct mbuf *m, struct carp_softc *sc, struct carp_header *ch)
{
struct m_tag *mtag;
+ struct ifnet *ifp = &sc->sc_ac.ac_if;
if (sc->sc_init_counter) {
/* this could also be seconds since unix epoch */
@@ -770,7 +771,7 @@ carp_prepare_ad(struct mbuf *m, struct carp_softc *sc, struct carp_header *ch)
sc->sc_ac.ac_if.if_oerrors++;
return (ENOMEM);
}
- bcopy(&sc->sc_ac.ac_if, (caddr_t)(mtag + 1), sizeof(struct ifnet *));
+ bcopy(&ifp, (caddr_t)(mtag + 1), sizeof(struct ifnet *));
m_tag_prepend(m, mtag);
return (0);
@@ -1140,14 +1141,16 @@ carp_macmatch6(void *v, struct mbuf *m, struct in6_addr *taddr)
&ifatoia6(ifa)->ia_addr.sin6_addr) &&
((sc->sc_ac.ac_if.if_flags &
(IFF_UP|IFF_RUNNING)) == (IFF_UP|IFF_RUNNING))) {
+ struct ifnet *ifp = &sc->sc_ac.ac_if;
+
mtag = m_tag_get(PACKET_TAG_CARP,
- sizeof(struct carp_softc *), M_NOWAIT);
+ sizeof(struct ifnet *), M_NOWAIT);
if (mtag == NULL) {
/* better a bit than nothing */
return (sc->sc_ac.ac_enaddr);
}
- bcopy(&sc, (caddr_t)(mtag + 1),
- sizeof(struct carp_softc *));
+ bcopy(&ifp, (caddr_t)(mtag + 1),
+ sizeof(struct ifnet *));
m_tag_prepend(m, mtag);
return (sc->sc_ac.ac_enaddr);