summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/netinet6/route6.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/netinet6/route6.c')
-rw-r--r--freebsd/sys/netinet6/route6.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/freebsd/sys/netinet6/route6.c b/freebsd/sys/netinet6/route6.c
index 7014daa6..908a5479 100644
--- a/freebsd/sys/netinet6/route6.c
+++ b/freebsd/sys/netinet6/route6.c
@@ -64,12 +64,16 @@ int
route6_input(struct mbuf **mp, int *offp, int proto)
{
struct ip6_hdr *ip6;
- struct mbuf *m = *mp;
+ struct mbuf *m;
struct ip6_rthdr *rh;
int off = *offp, rhlen;
#ifdef __notyet__
struct ip6aux *ip6a;
+#endif
+
+ m = *mp;
+#ifdef __notyet__
ip6a = ip6_findaux(m);
if (ip6a) {
/* XXX reject home-address option before rthdr */
@@ -81,18 +85,16 @@ route6_input(struct mbuf **mp, int *offp, int proto)
}
#endif
-#ifndef PULLDOWN_TEST
- IP6_EXTHDR_CHECK(m, off, sizeof(*rh), IPPROTO_DONE);
+ if (m->m_len < off + sizeof(*rh)) {
+ m = m_pullup(m, off + sizeof(*rh));
+ if (m == NULL) {
+ IP6STAT_INC(ip6s_exthdrtoolong);
+ *mp = NULL;
+ return (IPPROTO_DONE);
+ }
+ }
ip6 = mtod(m, struct ip6_hdr *);
rh = (struct ip6_rthdr *)((caddr_t)ip6 + off);
-#else
- ip6 = mtod(m, struct ip6_hdr *);
- IP6_EXTHDR_GET(rh, struct ip6_rthdr *, m, off, sizeof(*rh));
- if (rh == NULL) {
- IP6STAT_INC(ip6s_tooshort);
- return IPPROTO_DONE;
- }
-#endif
/*
* While this switch may look gratuitous, leave it in
@@ -108,9 +110,11 @@ route6_input(struct mbuf **mp, int *offp, int proto)
IP6STAT_INC(ip6s_badoptions);
icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
(caddr_t)&rh->ip6r_type - (caddr_t)ip6);
+ *mp = NULL;
return (IPPROTO_DONE);
}
*offp += rhlen;
+ *mp = m;
return (rh->ip6r_nxt);
}