Source-Changes-HG archive

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

[src/trunk]: src/sys/net Simplify



details:   https://anonhg.NetBSD.org/src/rev/188abedbb3d9
branches:  trunk
changeset: 354395:188abedbb3d9
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Thu Jun 15 02:51:45 2017 +0000

description:
Simplify

We can assume that rt_ifp is always non-NULL.

diffstat:

 sys/net/rtsock.c |  14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diffs (44 lines):

diff -r 5151abc5e737 -r 188abedbb3d9 sys/net/rtsock.c
--- a/sys/net/rtsock.c  Wed Jun 14 21:43:02 2017 +0000
+++ b/sys/net/rtsock.c  Thu Jun 15 02:51:45 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock.c,v 1.213 2017/06/01 02:45:14 chs Exp $ */
+/*     $NetBSD: rtsock.c,v 1.214 2017/06/15 02:51:45 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.213 2017/06/01 02:45:14 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.214 2017/06/15 02:51:45 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -536,12 +536,11 @@
     struct rt_xmsghdr *rtm, struct rt_xmsghdr **new_rtm)
 {
        int len;
-       struct ifnet *ifp;
 
-       if ((rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) == 0)
-               ;
-       else if ((ifp = rt->rt_ifp) != NULL) {
+       if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) {
                const struct ifaddr *rtifa;
+               const struct ifnet *ifp = rt->rt_ifp;
+
                info->rti_info[RTAX_IFP] = ifp->if_dl->ifa_addr;
                /* rtifa used to be simply rt->rt_ifa.
                 * If rt->rt_ifa != NULL, then
@@ -569,9 +568,6 @@
                else
                        info->rti_info[RTAX_BRD] = NULL;
                rtm->rtm_index = ifp->if_index;
-       } else {
-               info->rti_info[RTAX_IFP] = NULL;
-               info->rti_info[RTAX_IFA] = NULL;
        }
        (void)rt_msg2(rtm->rtm_type, info, NULL, NULL, &len);
        if (len > rtm->rtm_msglen) {



Home | Main Index | Thread Index | Old Index