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 mrg i...



details:   https://anonhg.NetBSD.org/src/rev/b9c44d5ff4d9
branches:  netbsd-8
changeset: 434695:b9c44d5ff4d9
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Feb 28 18:54:43 2018 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #595):
        sys/net/if.c: revision 1.398
        sys/net/rtsock.c: revision 1.231
remove useless cast, initialize family.
Avoid using a zero family mask.

diffstat:

 sys/net/if.c     |   7 ++++---
 sys/net/rtsock.c |  11 ++++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diffs (67 lines):

diff -r 4acdab938d80 -r b9c44d5ff4d9 sys/net/if.c
--- a/sys/net/if.c      Wed Feb 28 18:53:06 2018 +0000
+++ b/sys/net/if.c      Wed Feb 28 18:54:43 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.394.2.8 2018/02/11 21:17:34 snj Exp $ */
+/*     $NetBSD: if.c,v 1.394.2.9 2018/02/28 18:54:43 martin Exp $      */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.8 2018/02/11 21:17:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.9 2018/02/28 18:54:43 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -450,13 +450,14 @@
        addrlen = ifp->if_addrlen;
        socksize = roundup(sockaddr_dl_measure(namelen, addrlen), sizeof(long));
        ifasize = sizeof(*ifa) + 2 * socksize;
-       ifa = (struct ifaddr *)malloc(ifasize, M_IFADDR, M_WAITOK|M_ZERO);
+       ifa = malloc(ifasize, M_IFADDR, M_WAITOK|M_ZERO);
 
        sdl = (struct sockaddr_dl *)(ifa + 1);
        mask = (struct sockaddr_dl *)(socksize + (char *)sdl);
 
        sockaddr_dl_init(sdl, socksize, ifp->if_index, ifp->if_type,
            ifp->if_xname, namelen, NULL, addrlen);
+       mask->sdl_family = AF_LINK;
        mask->sdl_len = sockaddr_dl_measure(namelen, 0);
        memset(&mask->sdl_data[0], 0xff, namelen);
        ifa->ifa_rtrequest = link_rtrequest;
diff -r 4acdab938d80 -r b9c44d5ff4d9 sys/net/rtsock.c
--- a/sys/net/rtsock.c  Wed Feb 28 18:53:06 2018 +0000
+++ b/sys/net/rtsock.c  Wed Feb 28 18:54:43 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock.c,v 1.213.2.6 2018/02/03 22:07:26 snj Exp $     */
+/*     $NetBSD: rtsock.c,v 1.213.2.7 2018/02/28 18:54:43 martin 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.2.6 2018/02/03 22:07:26 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.213.2.7 2018/02/28 18:54:43 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -836,8 +836,13 @@
         * (padded with 0's). We keep the original length of the sockaddr.
         */
        if (info.rti_info[RTAX_NETMASK]) {
+               /*
+                * Use the family of RTAX_DST, because RTAX_NETMASK
+                * can have a zero family if it comes from the radix
+                * tree via rt_mask().
+                */
                socklen_t sa_len = sockaddr_getsize_by_family(
-                   info.rti_info[RTAX_NETMASK]->sa_family);
+                   info.rti_info[RTAX_DST]->sa_family);
                socklen_t masklen = sockaddr_getlen(
                    info.rti_info[RTAX_NETMASK]);
                if (sa_len != 0 && sa_len > masklen) {



Home | Main Index | Thread Index | Old Index