| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: t_ipsec.sh,v 1.3 2018/02/01 05:22:01 ozaki-r Exp $ | | 1 | # $NetBSD: t_ipsec.sh,v 1.4 2018/03/13 03:50:26 knakahara Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 2017 Internet Initiative Japan Inc. | | 3 | # Copyright (c) 2017 Internet Initiative Japan Inc. |
4 | # All rights reserved. | | 4 | # All rights reserved. |
5 | # | | 5 | # |
6 | # Redistribution and use in source and binary forms, with or without | | 6 | # Redistribution and use in source and binary forms, with or without |
7 | # modification, are permitted provided that the following conditions | | 7 | # modification, are permitted provided that the following conditions |
8 | # are met: | | 8 | # are met: |
9 | # 1. Redistributions of source code must retain the above copyright | | 9 | # 1. Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. | | 10 | # notice, this list of conditions and the following disclaimer. |
11 | # 2. Redistributions in binary form must reproduce the above copyright | | 11 | # 2. Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the | | 12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. | | 13 | # documentation and/or other materials provided with the distribution. |
14 | # | | 14 | # |
| @@ -259,27 +259,29 @@ setup_if_ipsec_sa() | | | @@ -259,27 +259,29 @@ setup_if_ipsec_sa() |
259 | local mode=${4} | | 259 | local mode=${4} |
260 | local proto=${5} | | 260 | local proto=${5} |
261 | local algo=${6} | | 261 | local algo=${6} |
262 | local dir=${7} | | 262 | local dir=${7} |
263 | | | 263 | |
264 | local tmpfile=./tmp | | 264 | local tmpfile=./tmp |
265 | local inunique="" | | 265 | local inunique="" |
266 | local outunique="" | | 266 | local outunique="" |
267 | local inid="" | | 267 | local inid="" |
268 | local outid="" | | 268 | local outid="" |
269 | local algo_args="$(generate_algo_args $proto $algo)" | | 269 | local algo_args="$(generate_algo_args $proto $algo)" |
270 | | | 270 | |
271 | inunique=`get_if_ipsec_unique ${sock} ${dst} ${mode}` | | 271 | inunique=`get_if_ipsec_unique ${sock} ${dst} ${mode}` |
| | | 272 | atf_check -s exit:0 test "X$inunique" != "X" |
272 | outunique=`get_if_ipsec_unique ${sock} ${src} ${mode}` | | 273 | outunique=`get_if_ipsec_unique ${sock} ${src} ${mode}` |
| | | 274 | atf_check -s exit:0 test "X$outunique" != "X" |
273 | | | 275 | |
274 | if [ ${dir} = "1to2" ] ; then | | 276 | if [ ${dir} = "1to2" ] ; then |
275 | if [ ${mode} = "ipv6" ] ; then | | 277 | if [ ${mode} = "ipv6" ] ; then |
276 | inid="10010" | | 278 | inid="10010" |
277 | outid="10011" | | 279 | outid="10011" |
278 | else | | 280 | else |
279 | inid="10000" | | 281 | inid="10000" |
280 | outid="10001" | | 282 | outid="10001" |
281 | fi | | 283 | fi |
282 | else | | 284 | else |
283 | if [ ${mode} = "ipv6" ] ; then | | 285 | if [ ${mode} = "ipv6" ] ; then |
284 | inid="10011" | | 286 | inid="10011" |
285 | outid="10010" | | 287 | outid="10010" |
| @@ -436,27 +438,29 @@ setup_dummy_if_ipsec_sa() | | | @@ -436,27 +438,29 @@ setup_dummy_if_ipsec_sa() |
436 | local mode=${4} | | 438 | local mode=${4} |
437 | local proto=${5} | | 439 | local proto=${5} |
438 | local algo=${6} | | 440 | local algo=${6} |
439 | local dir=${7} | | 441 | local dir=${7} |
440 | | | 442 | |
441 | local tmpfile=./tmp | | 443 | local tmpfile=./tmp |
442 | local inunique="" | | 444 | local inunique="" |
443 | local outunique="" | | 445 | local outunique="" |
444 | local inid="" | | 446 | local inid="" |
445 | local outid="" | | 447 | local outid="" |
446 | local algo_args="$(generate_algo_args $proto $algo)" | | 448 | local algo_args="$(generate_algo_args $proto $algo)" |
447 | | | 449 | |
448 | inunique=`get_if_ipsec_unique ${sock} ${dst} ${mode}` | | 450 | inunique=`get_if_ipsec_unique ${sock} ${dst} ${mode}` |
| | | 451 | atf_check -s exit:0 test "X$inunique" != "X" |
449 | outunique=`get_if_ipsec_unique ${sock} ${src} ${mode}` | | 452 | outunique=`get_if_ipsec_unique ${sock} ${src} ${mode}` |
| | | 453 | atf_check -s exit:0 test "X$outunique" != "X" |
450 | | | 454 | |
451 | if [ ${dir} = "1to2" ] ; then | | 455 | if [ ${dir} = "1to2" ] ; then |
452 | inid="20000" | | 456 | inid="20000" |
453 | outid="20001" | | 457 | outid="20001" |
454 | else | | 458 | else |
455 | inid="20001" | | 459 | inid="20001" |
456 | outid="20000" | | 460 | outid="20000" |
457 | fi | | 461 | fi |
458 | | | 462 | |
459 | cat > $tmpfile <<-EOF | | 463 | cat > $tmpfile <<-EOF |
460 | add $dst $src $proto $inid -u $inunique $algo_args; | | 464 | add $dst $src $proto $inid -u $inunique $algo_args; |
461 | add $src $dst $proto $outid -u $outunique $algo_args; | | 465 | add $src $dst $proto $outid -u $outunique $algo_args; |
462 | EOF | | 466 | EOF |