Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/net Pull up following revision(s) (requested by knaka...
details: https://anonhg.NetBSD.org/src/rev/42069476dbcd
branches: netbsd-9
changeset: 1000932:42069476dbcd
user: martin <martin%NetBSD.org@localhost>
date: Thu Oct 03 17:12:53 2019 +0000
description:
Pull up following revision(s) (requested by knakahara in ticket #272):
sys/net/route.c: revision 1.222
sys/net/route.c: revision 1.224
sys/net/route.c: revision 1.225
Stop passing a large const structure by value, in order to avoid
possible kernel stack overflow; const pointer is suffice here.
Pointed out by the lgtm bot and kamil.
OK ozaki-r
-
Fix a ifa_release() leak for a specific struct rt_addrinfo.
ok by ozaki-r@n.o
-
Revert route.c:r1.224 to fix net/arp/t_arp and net/ndp/t_ndp failure.
And refactor a little. Discussed with ozaki-r@n.o.
diffstat:
sys/net/route.c | 37 +++++++++++++++++++------------------
1 files changed, 19 insertions(+), 18 deletions(-)
diffs (91 lines):
diff -r 3acd31906556 -r 42069476dbcd sys/net/route.c
--- a/sys/net/route.c Thu Oct 03 17:07:51 2019 +0000
+++ b/sys/net/route.c Thu Oct 03 17:12:53 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.219.2.1 2019/09/24 03:10:35 martin Exp $ */
+/* $NetBSD: route.c,v 1.219.2.2 2019/10/03 17:12:53 martin Exp $ */
/*-
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.219.2.1 2019/09/24 03:10:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.219.2.2 2019/10/03 17:12:53 martin Exp $");
#include <sys/param.h>
#ifdef RTFLUSH_DEBUG
@@ -1387,47 +1387,48 @@
}
static struct ifaddr *
-rt_update_get_ifa(const struct rt_addrinfo info, const struct rtentry *rt,
+rt_update_get_ifa(const struct rt_addrinfo *info, const struct rtentry *rt,
struct ifnet **ifp, struct psref *psref_ifp, struct psref *psref)
{
struct ifaddr *ifa = NULL;
*ifp = NULL;
- if (info.rti_info[RTAX_IFP] != NULL) {
- ifa = ifa_ifwithnet_psref(info.rti_info[RTAX_IFP], psref);
+ if (info->rti_info[RTAX_IFP] != NULL) {
+ ifa = ifa_ifwithnet_psref(info->rti_info[RTAX_IFP], psref);
if (ifa == NULL)
goto next;
*ifp = ifa->ifa_ifp;
if_acquire(*ifp, psref_ifp);
- if (info.rti_info[RTAX_IFA] == NULL &&
- info.rti_info[RTAX_GATEWAY] == NULL)
- goto next;
+ if (info->rti_info[RTAX_IFA] == NULL &&
+ info->rti_info[RTAX_GATEWAY] == NULL)
+ goto out;
ifa_release(ifa, psref);
- if (info.rti_info[RTAX_IFA] == NULL) {
+ if (info->rti_info[RTAX_IFA] == NULL) {
/* route change <dst> <gw> -ifp <if> */
- ifa = ifaof_ifpforaddr_psref(info.rti_info[RTAX_GATEWAY],
- *ifp, psref);
+ ifa = ifaof_ifpforaddr_psref(
+ info->rti_info[RTAX_GATEWAY], *ifp, psref);
} else {
/* route change <dst> -ifp <if> -ifa <addr> */
- ifa = ifa_ifwithaddr_psref(info.rti_info[RTAX_IFA], psref);
+ ifa = ifa_ifwithaddr_psref(info->rti_info[RTAX_IFA],
+ psref);
if (ifa != NULL)
goto out;
- ifa = ifaof_ifpforaddr_psref(info.rti_info[RTAX_IFA],
+ ifa = ifaof_ifpforaddr_psref(info->rti_info[RTAX_IFA],
*ifp, psref);
}
goto out;
}
next:
- if (info.rti_info[RTAX_IFA] != NULL) {
+ if (info->rti_info[RTAX_IFA] != NULL) {
/* route change <dst> <gw> -ifa <addr> */
- ifa = ifa_ifwithaddr_psref(info.rti_info[RTAX_IFA], psref);
+ ifa = ifa_ifwithaddr_psref(info->rti_info[RTAX_IFA], psref);
if (ifa != NULL)
goto out;
}
- if (info.rti_info[RTAX_GATEWAY] != NULL) {
+ if (info->rti_info[RTAX_GATEWAY] != NULL) {
/* route change <dst> <gw> */
ifa = ifa_ifwithroute_psref(rt->rt_flags, rt_getkey(rt),
- info.rti_info[RTAX_GATEWAY], psref);
+ info->rti_info[RTAX_GATEWAY], psref);
}
out:
if (ifa != NULL && *ifp == NULL) {
@@ -1487,7 +1488,7 @@
* flags may also be different; ifp may be specified
* by ll sockaddr when protocol address is ambiguous
*/
- new_ifa = rt_update_get_ifa(*info, rt, &new_ifp, &psref_new_ifp,
+ new_ifa = rt_update_get_ifa(info, rt, &new_ifp, &psref_new_ifp,
&psref_new_ifa);
if (new_ifa != NULL) {
ifa_release(ifa, &psref_ifa);
Home |
Main Index |
Thread Index |
Old Index