Module Name: src
Committed By: roy
Date: Tue Jul 4 10:25:46 UTC 2017
Modified Files:
src/sys/netinet: ip_output.c
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.281 -r1.282 src/sys/netinet/ip_output.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.281 src/sys/netinet/ip_output.c:1.282
--- src/sys/netinet/ip_output.c:1.281 Mon Jul 3 18:54:11 2017
+++ src/sys/netinet/ip_output.c Tue Jul 4 10:25:45 2017
@@ -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 @@ ip_output(struct mbuf *m0, struct mbuf *
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 @@ ip_output(struct mbuf *m0, struct mbuf *
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 @@ ip_output(struct mbuf *m0, struct mbuf *
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 @@ ip_output(struct mbuf *m0, struct mbuf *
* 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 @@ sendit:
* 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);