Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/net Pull up following revision(s) (requested by rin i...



details:   https://anonhg.NetBSD.org/src/rev/c937674f3d66
branches:  netbsd-8
changeset: 455019:c937674f3d66
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Oct 04 11:26:35 2019 +0000

description:
Pull up following revision(s) (requested by rin in ticket #1398):

        sys/net/route.c: revision 1.222

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

XXX
pullup to netbsd-9

diffstat:

 sys/net/route.c |  35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

diffs (90 lines):

diff -r 0f4a2a153db5 -r c937674f3d66 sys/net/route.c
--- a/sys/net/route.c   Mon Sep 30 15:50:49 2019 +0000
+++ b/sys/net/route.c   Fri Oct 04 11:26:35 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.194.6.14 2019/09/24 18:27:09 martin Exp $  */
+/*     $NetBSD: route.c,v 1.194.6.15 2019/10/04 11:26:35 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.194.6.14 2019/09/24 18:27:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.194.6.15 2019/10/04 11:26:35 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)
+               if (info->rti_info[RTAX_IFA] == NULL &&
+                   info->rti_info[RTAX_GATEWAY] == NULL)
                        goto next;
                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