Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Rename u to udst, .dst to .sa and .dst4 to sin.



details:   https://anonhg.NetBSD.org/src/rev/f2f2fcfa8bb7
branches:  trunk
changeset: 354931:f2f2fcfa8bb7
user:      roy <roy%NetBSD.org@localhost>
date:      Tue Jul 04 10:25:45 2017 +0000

description:
Rename u to udst, .dst to .sa and .dst4 to sin.
Create sockaddr for the source address in usrc so it won't stamp on udst.

This fixes a regression caused in r1.280

diffstat:

 sys/netinet/ip_output.c |  28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diffs (77 lines):

diff -r 91b6b928f760 -r f2f2fcfa8bb7 sys/netinet/ip_output.c
--- a/sys/netinet/ip_output.c   Tue Jul 04 09:32:20 2017 +0000
+++ b/sys/netinet/ip_output.c   Tue Jul 04 10:25:45 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_output.c,v 1.281 2017/07/03 18:54:11 khorben Exp $  */
+/*     $NetBSD: ip_output.c,v 1.282 2017/07/04 10:25:45 roy Exp $      */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.281 2017/07/03 18:54:11 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.282 2017/07/04 10:25:45 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -243,12 +243,12 @@
        bool natt_frag = false;
        bool rtmtu_nolock;
        union {
-               struct sockaddr         dst;
-               struct sockaddr_in      dst4;
-       } u;
-       struct sockaddr *rdst = &u.dst; /* real IP destination, as opposed
-                                        * to the nexthop
-                                        */
+               struct sockaddr         sa;
+               struct sockaddr_in      sin;
+       } udst, usrc;
+       struct sockaddr *rdst = &udst.sa;       /* real IP destination, as
+                                                * opposed to the nexthop
+                                                */
        struct psref psref, psref_ia;
        int bound;
        bool bind_need_restore = false;
@@ -289,7 +289,7 @@
                memset(&iproute, 0, sizeof(iproute));
                ro = &iproute;
        }
-       sockaddr_in_init(&u.dst4, &ip->ip_dst, 0);
+       sockaddr_in_init(&udst.sin, &ip->ip_dst, 0);
        dst = satocsin(rtcache_getdst(ro));
 
        /*
@@ -304,8 +304,8 @@
 
        if ((rt = rtcache_validate(ro)) == NULL &&
            (rt = rtcache_update(ro, 1)) == NULL) {
-               dst = &u.dst4;
-               error = rtcache_setdst(ro, &u.dst);
+               dst = &udst.sin;
+               error = rtcache_setdst(ro, &udst.sa);
                if (error != 0)
                        goto bad;
        }
@@ -447,7 +447,7 @@
                         * on the outgoing interface, and the caller did not
                         * forbid loopback, loop back a copy.
                         */
-                       ip_mloopback(ifp, m, &u.dst4);
+                       ip_mloopback(ifp, m, &udst.sin);
                }
 #ifdef MROUTING
                else {
@@ -611,8 +611,8 @@
         * validity
         */
        KASSERT(ia == NULL);
-       sockaddr_in_init(&u.dst4, &ip->ip_src, 0);
-       ifa = ifaof_ifpforaddr_psref(&u.dst, ifp, &psref_ia);
+       sockaddr_in_init(&usrc.sin, &ip->ip_src, 0);
+       ifa = ifaof_ifpforaddr_psref(&usrc.sa, ifp, &psref_ia);
        if (ifa != NULL)
                ia = ifatoia(ifa);
 



Home | Main Index | Thread Index | Old Index