summaryrefslogtreecommitdiff
path: root/sys/netinet6/icmp6.c
diff options
context:
space:
mode:
authormiko <miko@cvs.openbsd.org>2018-09-05 09:47:19 +0000
committermiko <miko@cvs.openbsd.org>2018-09-05 09:47:19 +0000
commit24e122d0f1c137254099dfaa0f0533ccac9decf1 (patch)
treefc5ec1db14c5487299890bd0a1c05b9b7d3ea2fd /sys/netinet6/icmp6.c
parentebd6c3426f83f49e4be297a3c7bf83a3d76ea33b (diff)
factor error code in icmp6_mtudisc_clone(); ok kn@ florian@
Diffstat (limited to 'sys/netinet6/icmp6.c')
-rw-r--r--sys/netinet6/icmp6.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 64a1d649a22..37e12ad7e5f 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.225 2018/07/11 13:06:16 claudio Exp $ */
+/* $OpenBSD: icmp6.c,v 1.226 2018/09/05 09:47:18 miko Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -1768,20 +1768,16 @@ icmp6_mtudisc_clone(struct sockaddr *dst, u_int rtableid)
rt = rtalloc(dst, RT_RESOLVE, rtableid);
/* Check if the route is actually usable */
- if (!rtisvalid(rt) || (rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE))) {
- rtfree(rt);
- return (NULL);
- }
+ if (!rtisvalid(rt) || (rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)))
+ goto bad;
/*
* No PMTU for local routes and permanent neighbors,
* ARP and NDP use the same expire timer as the route.
*/
if (ISSET(rt->rt_flags, RTF_LOCAL) ||
- (ISSET(rt->rt_flags, RTF_LLINFO) && rt->rt_expire == 0)) {
- rtfree(rt);
- return (NULL);
- }
+ (ISSET(rt->rt_flags, RTF_LLINFO) && rt->rt_expire == 0))
+ goto bad;
/* If we didn't get a host route, allocate one */
if ((rt->rt_flags & RTF_HOST) == 0) {
@@ -1799,10 +1795,8 @@ icmp6_mtudisc_clone(struct sockaddr *dst, u_int rtableid)
error = rtrequest(RTM_ADD, &info, rt->rt_priority, &nrt,
rtableid);
- if (error) {
- rtfree(rt);
- return (NULL);
- }
+ if (error)
+ goto bad;
nrt->rt_rmx = rt->rt_rmx;
rtfree(rt);
rt = nrt;
@@ -1810,12 +1804,13 @@ icmp6_mtudisc_clone(struct sockaddr *dst, u_int rtableid)
}
error = rt_timer_add(rt, icmp6_mtudisc_timeout, icmp6_mtudisc_timeout_q,
rtableid);
- if (error) {
- rtfree(rt);
- return (NULL);
- }
+ if (error)
+ goto bad;
return (rt);
+bad:
+ rtfree(rt);
+ return (NULL);
}
void