aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/ip_carp.c
diff options
context:
space:
mode:
authorKevin Lo <kevlo@FreeBSD.org>2014-08-08 01:57:15 +0000
committerKevin Lo <kevlo@FreeBSD.org>2014-08-08 01:57:15 +0000
commit8f5a8818f57e31278b4bbd415c2cfa498306f91f (patch)
treeb8a22569ba8e281cdf06effd47986cf8fb592118 /sys/netinet/ip_carp.c
parent9ce4512ccdfba4d81df33f159791681418c82b0a (diff)
downloadsrc-8f5a8818f57e31278b4bbd415c2cfa498306f91f.tar.gz
src-8f5a8818f57e31278b4bbd415c2cfa498306f91f.zip
Merge 'struct ip6protosw' and 'struct protosw' into one. Now we have
only one protocol switch structure that is shared between ipv4 and ipv6. Phabric: D476 Reviewed by: jhb
Notes
Notes: svn path=/head/; revision=269699
Diffstat (limited to 'sys/netinet/ip_carp.c')
-rw-r--r--sys/netinet/ip_carp.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index c6499bce85bf..1600f8c022ad 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -78,7 +78,6 @@ __FBSDID("$FreeBSD$");
#ifdef INET6
#include <netinet/icmp6.h>
#include <netinet/ip6.h>
-#include <netinet6/ip6protosw.h>
#include <netinet6/in6_var.h>
#include <netinet6/ip6_var.h>
#include <netinet6/scope6_var.h>
@@ -435,18 +434,22 @@ carp_hmac_verify(struct carp_softc *sc, uint32_t counter[2],
* but it seems more efficient this way or not possible otherwise.
*/
#ifdef INET
-void
-carp_input(struct mbuf *m, int hlen)
+int
+carp_input(struct mbuf **mp, int *offp, int proto)
{
+ struct mbuf *m = *mp;
struct ip *ip = mtod(m, struct ip *);
struct carp_header *ch;
int iplen, len;
+ iplen = *offp;
+ *mp = NULL;
+
CARPSTATS_INC(carps_ipackets);
if (!V_carp_allow) {
m_freem(m);
- return;
+ return (IPPROTO_DONE);
}
/* verify that the IP TTL is 255. */
@@ -456,7 +459,7 @@ carp_input(struct mbuf *m, int hlen)
ip->ip_ttl,
m->m_pkthdr.rcvif->if_xname);
m_freem(m);
- return;
+ return (IPPROTO_DONE);
}
iplen = ip->ip_hl << 2;
@@ -467,14 +470,14 @@ carp_input(struct mbuf *m, int hlen)
"on %s\n", __func__, m->m_len - sizeof(struct ip),
m->m_pkthdr.rcvif->if_xname);
m_freem(m);
- return;
+ return (IPPROTO_DONE);
}
if (iplen + sizeof(*ch) < m->m_len) {
if ((m = m_pullup(m, iplen + sizeof(*ch))) == NULL) {
CARPSTATS_INC(carps_hdrops);
CARP_DEBUG("%s: pullup failed\n", __func__);
- return;
+ return (IPPROTO_DONE);
}
ip = mtod(m, struct ip *);
}
@@ -491,12 +494,12 @@ carp_input(struct mbuf *m, int hlen)
m->m_pkthdr.len,
m->m_pkthdr.rcvif->if_xname);
m_freem(m);
- return;
+ return (IPPROTO_DONE);
}
if ((m = m_pullup(m, len)) == NULL) {
CARPSTATS_INC(carps_hdrops);
- return;
+ return (IPPROTO_DONE);
}
ip = mtod(m, struct ip *);
ch = (struct carp_header *)((char *)ip + iplen);
@@ -508,11 +511,12 @@ carp_input(struct mbuf *m, int hlen)
CARP_DEBUG("%s: checksum failed on %s\n", __func__,
m->m_pkthdr.rcvif->if_xname);
m_freem(m);
- return;
+ return (IPPROTO_DONE);
}
m->m_data -= iplen;
carp_input_c(m, ch, AF_INET);
+ return (IPPROTO_DONE);
}
#endif
@@ -2058,13 +2062,13 @@ static struct protosw in_carp_protosw = {
#ifdef INET6
extern struct domain inet6domain;
-static struct ip6protosw in6_carp_protosw = {
+static struct protosw in6_carp_protosw = {
.pr_type = SOCK_RAW,
.pr_domain = &inet6domain,
.pr_protocol = IPPROTO_CARP,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = carp6_input,
- .pr_output = rip6_output,
+ .pr_output = (pr_output_t *)rip6_output,
.pr_ctloutput = rip6_ctloutput,
.pr_usrreqs = &rip6_usrreqs
};