aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/ip_icmp.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_icmp.c
parent9ce4512ccdfba4d81df33f159791681418c82b0a (diff)
Notes
Diffstat (limited to 'sys/netinet/ip_icmp.c')
-rw-r--r--sys/netinet/ip_icmp.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 605060e68faec..007364375834b 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -358,19 +358,22 @@ freeit:
/*
* Process a received ICMP message.
*/
-void
-icmp_input(struct mbuf *m, int off)
+int
+icmp_input(struct mbuf **mp, int *offp, int proto)
{
struct icmp *icp;
struct in_ifaddr *ia;
+ struct mbuf *m = *mp;
struct ip *ip = mtod(m, struct ip *);
struct sockaddr_in icmpsrc, icmpdst, icmpgw;
- int hlen = off;
- int icmplen = ntohs(ip->ip_len) - off;
+ int hlen = *offp;
+ int icmplen = ntohs(ip->ip_len) - *offp;
int i, code;
void (*ctlfunc)(int, struct sockaddr *, void *);
int fibnum;
+ *mp = NULL;
+
/*
* Locate icmp structure in mbuf, and check
* that not corrupted and of at least minimum length.
@@ -390,7 +393,7 @@ icmp_input(struct mbuf *m, int off)
i = hlen + min(icmplen, ICMP_ADVLENMIN);
if (m->m_len < i && (m = m_pullup(m, i)) == NULL) {
ICMPSTAT_INC(icps_tooshort);
- return;
+ return (IPPROTO_DONE);
}
ip = mtod(m, struct ip *);
m->m_len -= hlen;
@@ -602,7 +605,7 @@ reflect:
ICMPSTAT_INC(icps_reflect);
ICMPSTAT_INC(icps_outhist[icp->icmp_type]);
icmp_reflect(m);
- return;
+ return (IPPROTO_DONE);
case ICMP_REDIRECT:
if (V_log_redirect) {
@@ -679,11 +682,13 @@ reflect:
}
raw:
- rip_input(m, off);
- return;
+ *mp = m;
+ rip_input(mp, offp, proto);
+ return (IPPROTO_DONE);
freeit:
m_freem(m);
+ return (IPPROTO_DONE);
}
/*