-/* $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 $ */
/*
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) {
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;
}
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