Source-Changes-HG archive

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

[src/trunk]: src/sys/net Tweak and KNF some functions



details:   https://anonhg.NetBSD.org/src/rev/a92e65dd2ee6
branches:  trunk
changeset: 822485:a92e65dd2ee6
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Mar 22 07:14:18 2017 +0000

description:
Tweak and KNF some functions

diffstat:

 sys/net/route.c  |   7 ++++---
 sys/net/rtsock.c |  24 +++++++++++++-----------
 2 files changed, 17 insertions(+), 14 deletions(-)

diffs (96 lines):

diff -r 35412c28d45d -r a92e65dd2ee6 sys/net/route.c
--- a/sys/net/route.c   Wed Mar 22 06:30:00 2017 +0000
+++ b/sys/net/route.c   Wed Mar 22 07:14:18 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.192 2017/02/20 04:23:11 ozaki-r Exp $      */
+/*     $NetBSD: route.c,v 1.193 2017/03/22 07:14:18 ozaki-r 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.192 2017/02/20 04:23:11 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.193 2017/03/22 07:14:18 ozaki-r Exp $");
 
 #include <sys/param.h>
 #ifdef RTFLUSH_DEBUG
@@ -1186,7 +1186,7 @@
        int error = 0, rc;
        struct rtentry *rt;
        rtbl_t *rtbl;
-       struct ifaddr *ifa = NULL, *ifa2 = NULL;
+       struct ifaddr *ifa = NULL;
        struct sockaddr_storage maskeddst;
        const struct sockaddr *dst = info->rti_info[RTAX_DST];
        const struct sockaddr *gateway = info->rti_info[RTAX_GATEWAY];
@@ -1292,6 +1292,7 @@
 
                ss = pserialize_read_enter();
                if (info->rti_info[RTAX_IFP] != NULL) {
+                       struct ifaddr *ifa2;
                        ifa2 = ifa_ifwithnet(info->rti_info[RTAX_IFP]);
                        if (ifa2 != NULL)
                                rt->rt_ifp = ifa2->ifa_ifp;
diff -r 35412c28d45d -r a92e65dd2ee6 sys/net/rtsock.c
--- a/sys/net/rtsock.c  Wed Mar 22 06:30:00 2017 +0000
+++ b/sys/net/rtsock.c  Wed Mar 22 07:14:18 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock.c,v 1.209 2017/03/17 10:05:02 ozaki-r Exp $     */
+/*     $NetBSD: rtsock.c,v 1.210 2017/03/22 07:14:18 ozaki-r Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.209 2017/03/17 10:05:02 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.210 2017/03/22 07:14:18 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -604,7 +604,7 @@
        struct psref psref_ifa, psref_new_ifa, psref_ifp;
 
        /*
-        * new gateway could require new ifaddr, ifp;
+        * New gateway could require new ifaddr, ifp;
         * flags may also be different; ifp may be specified
         * by ll sockaddr when protocol address is ambiguous
         */
@@ -627,9 +627,11 @@
                        goto out;
                }
        }
-       /* new gateway could require new ifaddr, ifp;
-          flags may also be different; ifp may be specified
-          by ll sockaddr when protocol address is ambiguous */
+       /*
+        * New gateway could require new ifaddr, ifp;
+        * flags may also be different; ifp may be specified
+        * by ll sockaddr when protocol address is ambiguous
+        */
        new_ifa = route_output_get_ifa(*info, rt, &new_ifp, &psref_new_ifa);
        if (new_ifa != NULL) {
                ifa_release(ifa, &psref_ifa);
@@ -648,13 +650,13 @@
                        ifa_release(ifa, &psref_ifa);
        }
        ifa_release(new_ifa, &psref_new_ifa);
-       if (new_ifp && rt->rt_ifp != new_ifp
-           && !if_is_deactivated(new_ifp))
+       if (new_ifp && rt->rt_ifp != new_ifp && !if_is_deactivated(new_ifp))
                rt->rt_ifp = new_ifp;
        rt_setmetrics(rtm->rtm_inits, rtm, rt);
-       if (rt->rt_flags != info->rti_flags)
-               rt->rt_flags = (info->rti_flags & ~PRESERVED_RTF)
-                   | (rt->rt_flags & PRESERVED_RTF);
+       if (rt->rt_flags != info->rti_flags) {
+               rt->rt_flags = (info->rti_flags & ~PRESERVED_RTF) |
+                   (rt->rt_flags & PRESERVED_RTF);
+       }
        if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest)
                rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, info);
 out:



Home | Main Index | Thread Index | Old Index