Source-Changes-HG archive

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

[src/trunk]: src/sys/net NAT-T src and dst port in ipsec_variant should be ne...



details:   https://anonhg.NetBSD.org/src/rev/d0635add3a7b
branches:  trunk
changeset: 321285:d0635add3a7b
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Fri Mar 09 10:59:36 2018 +0000

description:
NAT-T src and dst port in ipsec_variant should be network byte order.

diffstat:

 sys/net/if_ipsec.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (63 lines):

diff -r e794528ea82d -r d0635add3a7b sys/net/if_ipsec.c
--- a/sys/net/if_ipsec.c        Fri Mar 09 08:49:32 2018 +0000
+++ b/sys/net/if_ipsec.c        Fri Mar 09 10:59:36 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ipsec.c,v 1.3 2018/01/31 07:33:18 mrg Exp $  */
+/*     $NetBSD: if_ipsec.c,v 1.4 2018/03/09 10:59:36 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3 2018/01/31 07:33:18 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.4 2018/03/09 10:59:36 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -892,7 +892,7 @@
        switch(nsrc->sa_family) {
 #ifdef INET
        case AF_INET:
-               nsport = ntohs(satosin(src)->sin_port);
+               nsport = satosin(src)->sin_port;
                /*
                 * avoid confuse SP when NAT-T disabled,
                 * e.g.
@@ -900,15 +900,15 @@
                 *     confuse : 10.0.1.2[600] 10.0.1.1[600] 4(ipv4)
                 */
                satosin(nsrc)->sin_port = 0;
-               ndport = ntohs(satosin(dst)->sin_port);
+               ndport = satosin(dst)->sin_port;
                satosin(ndst)->sin_port = 0;
                break;
 #endif /* INET */
 #ifdef INET6
        case AF_INET6:
-               nsport = ntohs(satosin6(src)->sin6_port);
+               nsport = satosin6(src)->sin6_port;
                satosin6(nsrc)->sin6_port = 0;
-               ndport = ntohs(satosin6(dst)->sin6_port);
+               ndport = satosin6(dst)->sin6_port;
                satosin6(ndst)->sin6_port = 0;
                break;
 #endif /* INET6 */
@@ -1459,14 +1459,14 @@
 #ifdef INET
        case AF_INET: {
                struct sockaddr_in *sin = satosin(addrport);
-               sin->sin_port = htons(port);
+               sin->sin_port = port;
                break;
        }
 #endif /* INET */
 #ifdef INET6
        case AF_INET6: {
                struct sockaddr_in6 *sin6 = satosin6(addrport);
-               sin6->sin6_port = htons(port);
+               sin6->sin6_port = port;
                break;
        }
 #endif /* INET6 */



Home | Main Index | Thread Index | Old Index