Module Name:    src
Committed By:   knakahara
Date:           Fri Jan  6 03:25:13 UTC 2017

Modified Files:
        src/sys/netinet: in_gif.c
        src/sys/netinet6: in6_gif.c

Log Message:
remove unnecessary conversion.

gif_softc->gif_pdst is already valid sockaddr.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/netinet/in_gif.c
cvs rdiff -u -r1.82 -r1.83 src/sys/netinet6/in6_gif.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/in_gif.c
diff -u src/sys/netinet/in_gif.c:1.86 src/sys/netinet/in_gif.c:1.87
--- src/sys/netinet/in_gif.c:1.86	Wed Dec 14 11:19:15 2016
+++ src/sys/netinet/in_gif.c	Fri Jan  6 03:25:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_gif.c,v 1.86 2016/12/14 11:19:15 knakahara Exp $	*/
+/*	$NetBSD: in_gif.c,v 1.87 2017/01/06 03:25:13 knakahara Exp $	*/
 /*	$KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.86 2016/12/14 11:19:15 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.87 2017/01/06 03:25:13 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -90,10 +90,6 @@ in_gif_output(struct ifnet *ifp, int fam
 	struct ip iphdr;	/* capsule IP header, host byte ordered */
 	int proto, error;
 	u_int8_t tos;
-	union {
-		struct sockaddr		dst;
-		struct sockaddr_in	dst4;
-	} u;
 
 	if (sin_src == NULL || sin_dst == NULL ||
 	    sin_src->sin_family != AF_INET ||
@@ -170,10 +166,8 @@ in_gif_output(struct ifnet *ifp, int fam
 		return ENOBUFS;
 	bcopy(&iphdr, mtod(m, struct ip *), sizeof(struct ip));
 
-	sockaddr_in_init(&u.dst4, &sin_dst->sin_addr, 0);
-
 	ro = percpu_getref(sc->gif_ro_percpu);
-	if ((rt = rtcache_lookup(ro, &u.dst)) == NULL) {
+	if ((rt = rtcache_lookup(ro, sc->gif_pdst)) == NULL) {
 		percpu_putref(sc->gif_ro_percpu);
 		m_freem(m);
 		return ENETUNREACH;

Index: src/sys/netinet6/in6_gif.c
diff -u src/sys/netinet6/in6_gif.c:1.82 src/sys/netinet6/in6_gif.c:1.83
--- src/sys/netinet6/in6_gif.c:1.82	Wed Dec 14 11:19:15 2016
+++ src/sys/netinet6/in6_gif.c	Fri Jan  6 03:25:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_gif.c,v 1.82 2016/12/14 11:19:15 knakahara Exp $	*/
+/*	$NetBSD: in6_gif.c,v 1.83 2017/01/06 03:25:13 knakahara Exp $	*/
 /*	$KAME: in6_gif.c,v 1.62 2001/07/29 04:27:25 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.82 2016/12/14 11:19:15 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_gif.c,v 1.83 2017/01/06 03:25:13 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -93,10 +93,6 @@ in6_gif_output(struct ifnet *ifp, int fa
 	struct ip6_hdr *ip6;
 	int proto, error;
 	u_int8_t itos, otos;
-	union {
-		struct sockaddr		dst;
-		struct sockaddr_in6	dst6;
-	} u;
 
 	if (sin6_src == NULL || sin6_dst == NULL ||
 	    sin6_src->sin6_family != AF_INET6 ||
@@ -176,9 +172,8 @@ in6_gif_output(struct ifnet *ifp, int fa
 	ip6->ip6_flow &= ~ntohl(0xff00000);
 	ip6->ip6_flow |= htonl((u_int32_t)otos << 20);
 
-	sockaddr_in6_init(&u.dst6, &sin6_dst->sin6_addr, 0, 0, 0);
 	ro = percpu_getref(sc->gif_ro_percpu);
-	rt = rtcache_lookup(ro, &u.dst);
+	rt = rtcache_lookup(ro, sc->gif_pdst);
 	if (rt == NULL) {
 		percpu_putref(sc->gif_ro_percpu);
 		m_freem(m);

Reply via email to