summaryrefslogtreecommitdiff
path: root/sys/netinet6/frag6.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-12-08 10:51:01 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-12-08 10:51:01 +0000
commit289b5d92df74fa66f52fd6e6c1007523f9e1f37c (patch)
treedaa0f07283549c98d26ef3e64739f46fa8528374 /sys/netinet6/frag6.c
parentf76ca90c7214ed1dd62ada0fb63dea7beb7bf8ec (diff)
Do not use a "struct route" when a "struct rtentry" is enough.
ok millert@, bluhm@
Diffstat (limited to 'sys/netinet6/frag6.c')
-rw-r--r--sys/netinet6/frag6.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c
index 3ca2fa6e228..bff3dc8da94 100644
--- a/sys/netinet6/frag6.c
+++ b/sys/netinet6/frag6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frag6.c,v 1.58 2014/12/05 15:50:04 mpi Exp $ */
+/* $OpenBSD: frag6.c,v 1.59 2014/12/08 10:51:00 mpi Exp $ */
/* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */
/*
@@ -173,8 +173,8 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
int fragoff, frgpartlen; /* must be larger than u_int16_t */
struct ifnet *dstifp;
#ifdef IN6_IFSTAT_STRICT
- struct route_in6 ro;
- struct sockaddr_in6 *dst;
+ struct sockaddr_in6 dst;
+ struct rtentry *rt;
#endif
u_int8_t ecn, ecn0;
@@ -186,21 +186,19 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
dstifp = NULL;
#ifdef IN6_IFSTAT_STRICT
/* find the destination interface of the packet. */
- bzero(&ro, sizeof(ro));
- ro.ro_tableid = m->m_pkthdr.ph_rtableid;
- dst = &ro.ro_dst;
- dst->sin6_family = AF_INET6;
- dst->sin6_len = sizeof(struct sockaddr_in6);
- dst->sin6_addr = ip6->ip6_dst;
-
- ro.ro_rt = rtalloc_mpath(sin6tosa(&ro.ro_dst),
- &ip6->ip6_src.s6_addr32[0], ro.ro_tableid);
-
- if (ro.ro_rt != NULL && ro.ro_rt->rt_ifa != NULL)
- dstifp = ifatoia6(ro.ro_rt->rt_ifa)->ia_ifp;
- if (ro.ro_rt != NULL) {
- rtfree(ro.ro_rt);
- ro.ro_rt = NULL;
+ memset(&dst, 0, sizeof(dst));
+ dst.sin6_family = AF_INET6;
+ dst.sin6_len = sizeof(struct sockaddr_in6);
+ dst.sin6_addr = ip6->ip6_dst;
+
+ rt = rtalloc_mpath(sin6tosa(&dst), &ip6->ip6_src.s6_addr32[0],
+ m->m_pkthdr.ph_rtableid);
+
+ if (rt != NULL) {
+ if (rt->rt_ifa != NULL)
+ dstifp = ifatoia6(rt->rt_ifa)->ia_ifp;
+ rtfree(rt);
+ rt = NULL;
}
#else
/* we are violating the spec, this is not the destination interface */