Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/net Refactor a little and follow new format of "npfctl...
details: https://anonhg.NetBSD.org/src/rev/9c96b20ac94d
branches: trunk
changeset: 934047:9c96b20ac94d
user: knakahara <knakahara%NetBSD.org@localhost>
date: Fri Jun 05 03:24:58 2020 +0000
description:
Refactor a little and follow new format of "npfctl list".
Fix the below ATF failures.
- net/if_ipsec/t_ipsec_natt:ipsecif_natt_transport_null
- net/if_ipsec/t_ipsec_natt:ipsecif_natt_transport_rijndaelcbc
- net/ipsec/t_ipsec_natt:ipsec_natt_transport_ipv4_null
- net/ipsec/t_ipsec_natt:ipsec_natt_transport_ipv4_rijndaelcbc
ok'ed by ozaki-r@n.o, thanks.
diffstat:
tests/net/if_ipsec/t_ipsec_natt.sh | 7 +++----
tests/net/ipsec/common.sh | 15 ++++++++++++++-
tests/net/ipsec/t_ipsec_natt.sh | 5 ++---
3 files changed, 19 insertions(+), 8 deletions(-)
diffs (94 lines):
diff -r ff8c566f521a -r 9c96b20ac94d tests/net/if_ipsec/t_ipsec_natt.sh
--- a/tests/net/if_ipsec/t_ipsec_natt.sh Fri Jun 05 02:30:54 2020 +0000
+++ b/tests/net/if_ipsec/t_ipsec_natt.sh Fri Jun 05 03:24:58 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ipsec_natt.sh,v 1.4 2020/06/01 04:38:37 martin Exp $
+# $NetBSD: t_ipsec_natt.sh,v 1.5 2020/06/05 03:24:58 knakahara Exp $
#
# Copyright (c) 2018 Internet Initiative Japan Inc.
# All rights reserved.
@@ -33,7 +33,6 @@
BUS_NAT=./bus_ipsec_natt_nat
DEBUG=${DEBUG:-false}
-HIJACKING_NPF="${HIJACKING},blanket=/dev/npf"
setup_servers()
{
@@ -386,7 +385,7 @@
export RUMP_SERVER=$SOCK_NAT
$DEBUG && $HIJACKING_NPF npfctl list
# 192.168.0.2:4500 10.0.0.2:4500 via shmif1:65248
- port_a=$($HIJACKING_NPF npfctl list | grep $ip_local_a | awk -F 'shmif1:' '/4500/ {print $2;}')
+ port_a=$(get_natt_port $ip_local_a $ip_nat_remote)
$DEBUG && echo port_a=$port_a
if [ -z "$port_a" ]; then
atf_fail "Failed to get a translated port on NAPT"
@@ -441,7 +440,7 @@
export RUMP_SERVER=$SOCK_NAT
$DEBUG && $HIJACKING_NPF npfctl list
# 192.168.0.2:4500 10.0.0.2:4500 via shmif1:65248
- port_b=$($HIJACKING_NPF npfctl list | grep $ip_local_b | awk -F 'shmif1:' '/4500/ {print $2;}')
+ port_b=$(get_natt_port $ip_local_b $ip_nat_remote)
$DEBUG && echo port_b=$port_b
if [ -z "$port_b" ]; then
atf_fail "Failed to get a translated port on NAPT"
diff -r ff8c566f521a -r 9c96b20ac94d tests/net/ipsec/common.sh
--- a/tests/net/ipsec/common.sh Fri Jun 05 02:30:54 2020 +0000
+++ b/tests/net/ipsec/common.sh Fri Jun 05 03:24:58 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: common.sh,v 1.7 2017/10/20 03:43:51 ozaki-r Exp $
+# $NetBSD: common.sh,v 1.8 2020/06/05 03:24:58 knakahara Exp $
#
# Copyright (c) 2017 Internet Initiative Japan Inc.
# All rights reserved.
@@ -25,6 +25,8 @@
# POSSIBILITY OF SUCH DAMAGE.
#
+HIJACKING_NPF="${HIJACKING},blanket=/dev/npf"
+
test_flush_entries()
{
local sock=$1
@@ -83,3 +85,14 @@
echo $proto | tr 'a-z' 'A-Z'
fi
}
+
+get_natt_port()
+{
+ local local_addr=$1
+ local remote_addr=$2
+ local port=""
+
+ # 10.0.1.2:4500 20.0.0.2:4500 shmif1 20.0.0.1:35574
+ port=$($HIJACKING_NPF npfctl list | grep $local_addr | awk -F "${remote_addr}:" '/4500/ {print $2;}')
+ echo $port
+}
diff -r ff8c566f521a -r 9c96b20ac94d tests/net/ipsec/t_ipsec_natt.sh
--- a/tests/net/ipsec/t_ipsec_natt.sh Fri Jun 05 02:30:54 2020 +0000
+++ b/tests/net/ipsec/t_ipsec_natt.sh Fri Jun 05 03:24:58 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ipsec_natt.sh,v 1.4 2020/06/01 04:38:37 martin Exp $
+# $NetBSD: t_ipsec_natt.sh,v 1.5 2020/06/05 03:24:58 knakahara Exp $
#
# Copyright (c) 2017 Internet Initiative Japan Inc.
# All rights reserved.
@@ -34,7 +34,6 @@
BUS_GLOBAL=./bus_ipsec_natt_global
DEBUG=${DEBUG:-false}
-HIJACKING_NPF="${HIJACKING},blanket=/dev/npf"
setup_servers_ipv4()
{
@@ -325,7 +324,7 @@
export RUMP_SERVER=$SOCK_NAT
$DEBUG && $HIJACKING_NPF npfctl list
# 10.0.1.2:4500 20.0.0.2:4500 via shmif1:9696
- port=$($HIJACKING_NPF npfctl list | awk -F 'shmif1:' '/4500/ {print $2;}')
+ port=$(get_natt_port $ip_local $ip_nat_remote)
$DEBUG && echo port=$port
if [ -z "$port" ]; then
atf_fail "Failed to get a translated port on NAPT"
Home |
Main Index |
Thread Index |
Old Index