From a946c2f0dd56cfa78609e124680672606a4f4930 Mon Sep 17 00:00:00 2001 From: mpi Date: Wed, 15 Apr 2015 15:16:17 +0000 Subject: [PATCH] Add the necessary glue to keep carp(4) working while other pseudo-drivers are converted to if_input(). ok dlg@, claudio@ --- sys/netinet/ip_carp.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index a77dc3824be..0684ee07198 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.250 2015/04/15 15:14:37 mpi Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.251 2015/04/15 15:16:17 mpi Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -1416,11 +1416,15 @@ carp_our_mcastaddr(struct ifnet *ifp, u_int8_t *d_enaddr) int carp_input(struct ifnet *ifp0, struct ether_header *eh0, struct mbuf *m) { - struct ether_header eh; + struct ether_header *eh; struct carp_if *cif = (struct carp_if *)ifp0->if_carp; struct ifnet *ifp; - memcpy(&eh, eh0, sizeof(eh)); + M_PREPEND(m, sizeof(*eh), M_DONTWAIT); + if (m == NULL) + return (-1); + eh = mtod(m, struct ether_header *); + memmove(eh, eh0, sizeof(*eh)); if ((ifp = carp_ourether(cif, eh0->ether_dhost))) ; @@ -1441,11 +1445,11 @@ carp_input(struct ifnet *ifp0, struct ether_header *eh0, struct mbuf *m) m0->m_pkthdr.rcvif = &vh->sc_if; #if NBPFILTER > 0 if (vh->sc_if.if_bpf) - bpf_mtap_hdr(vh->sc_if.if_bpf, (char *)&eh, - ETHER_HDR_LEN, m0, BPF_DIRECTION_IN, NULL); + bpf_mtap_ether(vh->sc_if.if_bpf, m, + BPF_DIRECTION_IN); #endif vh->sc_if.if_ipackets++; - ether_input(m0, &eh); + ether_input_mbuf(&vh->sc_if, m0); } return (1); } @@ -1457,11 +1461,10 @@ carp_input(struct ifnet *ifp0, struct ether_header *eh0, struct mbuf *m) #if NBPFILTER > 0 if (ifp->if_bpf) - bpf_mtap_hdr(ifp->if_bpf, (char *)&eh, ETHER_HDR_LEN, m, - BPF_DIRECTION_IN, NULL); + bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_IN); #endif ifp->if_ipackets++; - ether_input(m, &eh); + ether_input_mbuf(ifp, m); return (0); } -- 2.20.1