-/* $OpenBSD: route.c,v 1.246 2015/10/01 22:21:48 mpi Exp $ */
+/* $OpenBSD: route.c,v 1.247 2015/10/07 08:43:36 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
error = rtable_insert(tableid, ndst,
info->rti_info[RTAX_NETMASK],
rt->rt_priority, rt);
- }
+ }
rtfree(crt);
}
if (error != 0) {
if (ifa->ifa_rtrequest)
ifa->ifa_rtrequest(req, rt);
- if (ret_nrt) {
- *ret_nrt = rt;
- rt->rt_refcnt++;
- }
+
if ((rt->rt_flags & RTF_CLONING) != 0) {
/* clean up any cloned children */
rtflushclone(tableid, rt);
if_group_routechange(info->rti_info[RTAX_DST],
info->rti_info[RTAX_NETMASK]);
+
+ if (ret_nrt != NULL)
+ *ret_nrt = rt;
+ else
+ rtfree(rt);
break;
}
-/* $OpenBSD: rtable.c,v 1.8 2015/09/28 08:47:53 mpi Exp $ */
+/* $OpenBSD: rtable.c,v 1.9 2015/10/07 08:43:36 mpi Exp $ */
/*
* Copyright (c) 2014-2015 Martin Pieuchot
if (rn == NULL)
return (ESRCH);
+ rt = ((struct rtentry *)rn);
+ rtref(rt);
+
return (0);
}
rt->rt_mask = msk;
}
+ rtref(rt);
LIST_INSERT_HEAD(&an->an_rtlist, rt, rt_next);
#ifndef SMALL_KERNEL