diff options
author | glebius <glebius@FreeBSD.org> | 2011-11-07 14:22:18 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2011-11-07 14:22:18 +0000 |
commit | 599a401646fe914e6aca992bf3d53f0d7b937253 (patch) | |
tree | 3ac46bc9cfc230d3b12b860ed7bc94759dc1634b /sys | |
parent | 142b194b5f6e37104402f01475c0a0da5c2ed13b (diff) | |
download | FreeBSD-src-599a401646fe914e6aca992bf3d53f0d7b937253.zip FreeBSD-src-599a401646fe914e6aca992bf3d53f0d7b937253.tar.gz |
In icmp6_redirect_input:
- Assert that we got a valid mbuf with rcvif pointer. [1]
- Use __func__ in logging.
Submitted by: prabhakar lakhera <prabhakar.lakhera gmail.com> [1]
Submitted by: Kristof Provost <kristof sigsegv.be> [1]
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet6/icmp6.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index e8d7528..2114a0a 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -2360,14 +2360,11 @@ icmp6_redirect_input(struct mbuf *m, int off) union nd_opts ndopts; char ip6buf[INET6_ADDRSTRLEN]; - if (!m) - return; + M_ASSERTPKTHDR(m); + KASSERT(m->m_pkthdr.rcvif != NULL, ("%s: no rcvif", __func__)); ifp = m->m_pkthdr.rcvif; - if (!ifp) - return; - /* XXX if we are router, we don't update route by icmp6 redirect */ if (V_ip6_forwarding) goto freeit; @@ -2474,9 +2471,8 @@ icmp6_redirect_input(struct mbuf *m, int off) icmp6len -= sizeof(*nd_rd); nd6_option_init(nd_rd + 1, icmp6len, &ndopts); if (nd6_options(&ndopts) < 0) { - nd6log((LOG_INFO, "icmp6_redirect_input: " - "invalid ND option, rejected: %s\n", - icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); + nd6log((LOG_INFO, "%s: invalid ND option, rejected: %s\n", + __func__, icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); /* nd6_options have incremented stats */ goto freeit; } @@ -2487,10 +2483,9 @@ icmp6_redirect_input(struct mbuf *m, int off) } if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { - nd6log((LOG_INFO, - "icmp6_redirect_input: lladdrlen mismatch for %s " + nd6log((LOG_INFO, "%s: lladdrlen mismatch for %s " "(if %d, icmp6 packet %d): %s\n", - ip6_sprintf(ip6buf, &redtgt6), + __func__, ip6_sprintf(ip6buf, &redtgt6), ifp->if_addrlen, lladdrlen - 2, icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); goto bad; |