Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys remove unnecessary conversion.
details: https://anonhg.NetBSD.org/src/rev/c0262edb0ab1
branches: trunk
changeset: 350145:c0262edb0ab1
user: knakahara <knakahara%NetBSD.org@localhost>
date: Fri Jan 06 03:25:13 2017 +0000
description:
remove unnecessary conversion.
gif_softc->gif_pdst is already valid sockaddr.
diffstat:
sys/netinet/in_gif.c | 12 +++---------
sys/netinet6/in6_gif.c | 11 +++--------
2 files changed, 6 insertions(+), 17 deletions(-)
diffs (81 lines):
diff -r 6a33a4902e96 -r c0262edb0ab1 sys/netinet/in_gif.c
--- a/sys/netinet/in_gif.c Thu Jan 05 23:29:14 2017 +0000
+++ b/sys/netinet/in_gif.c Fri Jan 06 03:25:13 2017 +0000
@@ -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 @@
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 @@
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;
diff -r 6a33a4902e96 -r c0262edb0ab1 sys/netinet6/in6_gif.c
--- a/sys/netinet6/in6_gif.c Thu Jan 05 23:29:14 2017 +0000
+++ b/sys/netinet6/in6_gif.c Fri Jan 06 03:25:13 2017 +0000
@@ -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 @@
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 @@
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);
Home |
Main Index |
Thread Index |
Old Index