| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: t_lagg.sh,v 1.9 2023/10/16 07:57:40 yamaguchi Exp $ | | 1 | # $NetBSD: t_lagg.sh,v 1.10 2023/10/18 06:41:00 yamaguchi Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 2021 Internet Initiative Japan Inc. | | 3 | # Copyright (c) 2021 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 | # |
| @@ -357,92 +357,80 @@ lagg_ipv6lla_cleanup() | | | @@ -357,92 +357,80 @@ lagg_ipv6lla_cleanup() |
357 | cleanup | | 357 | cleanup |
358 | } | | 358 | } |
359 | | | 359 | |
360 | atf_test_case lagg_mtu cleanup | | 360 | atf_test_case lagg_mtu cleanup |
361 | lagg_mtu_head() | | 361 | lagg_mtu_head() |
362 | { | | 362 | { |
363 | atf_set "descr" "tests for MTU" | | 363 | atf_set "descr" "tests for MTU" |
364 | atf_set "require.progs" "rump_server" | | 364 | atf_set "require.progs" "rump_server" |
365 | } | | 365 | } |
366 | | | 366 | |
367 | lagg_mtu_body() | | 367 | lagg_mtu_body() |
368 | { | | 368 | { |
369 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" | | 369 | local atf_ifconfig="atf_check -s exit:0 rump.ifconfig" |
| | | 370 | local mtu_lagg=1500 |
370 | local mtu_1st=1450 | | 371 | local mtu_1st=1450 |
371 | local mtu_big=1460 | | 372 | local mtu_big=1460 |
372 | local mtu_small=1440 | | 373 | local mtu_small=1440 |
373 | | | 374 | |
374 | rump_server_start $SOCK_HOST0 lagg | | 375 | rump_server_start $SOCK_HOST0 lagg |
375 | | | 376 | |
376 | export RUMP_SERVER=$SOCK_HOST0 | | 377 | export RUMP_SERVER=$SOCK_HOST0 |
377 | rump_server_add_iface $SOCK_HOST0 shmif0 $BUS0 | | 378 | rump_server_add_iface $SOCK_HOST0 shmif0 $BUS0 |
378 | rump_server_add_iface $SOCK_HOST0 shmif1 $BUS1 | | 379 | rump_server_add_iface $SOCK_HOST0 shmif1 $BUS1 |
379 | rump_server_add_iface $SOCK_HOST0 shmif2 $BUS2 | | 380 | rump_server_add_iface $SOCK_HOST0 shmif2 $BUS2 |
380 | $atf_ifconfig lagg0 create | | 381 | $atf_ifconfig lagg0 create |
381 | $atf_ifconfig lagg0 laggproto lacp | | 382 | $atf_ifconfig lagg0 laggproto lacp |
| | | 383 | $atf_ifconfig lagg0 up |
382 | | | 384 | |
383 | $atf_ifconfig shmif0 mtu $mtu_1st | | 385 | $atf_ifconfig shmif0 mtu $mtu_1st |
384 | $atf_ifconfig shmif1 mtu $mtu_big | | 386 | $atf_ifconfig shmif1 mtu $mtu_big |
385 | $atf_ifconfig shmif2 mtu $mtu_small | | 387 | $atf_ifconfig shmif2 mtu $mtu_small |
386 | | | 388 | |
387 | atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0 | | 389 | # check initial MTU settings |
| | | 390 | atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0 |
388 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 | | 391 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 |
389 | atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1 | | 392 | atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1 |
390 | atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2 | | 393 | atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2 |
391 | | | 394 | |
392 | # copy MTU from 1st port | | 395 | # copy MTU from 1st port |
393 | $atf_ifconfig lagg0 laggport shmif0 | | 396 | $atf_ifconfig lagg0 laggport shmif0 |
394 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0 | | 397 | atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0 |
395 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 | | 398 | atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif0 |
396 | | | 399 | |
397 | # copy MTU to added port | | 400 | # copy MTU to added port |
398 | $atf_ifconfig lagg0 laggport shmif1 | | 401 | $atf_ifconfig lagg0 laggport shmif1 |
399 | $atf_ifconfig lagg0 laggport shmif2 | | 402 | $atf_ifconfig lagg0 laggport shmif2 |
400 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0 | | 403 | atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0 |
401 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 | | 404 | atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif0 |
402 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif1 | | 405 | atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif1 |
403 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif2 | | 406 | atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif2 |
404 | | | 407 | |
405 | # reset MTU after detaching from lagg0 | | 408 | # reset MTU after detaching from lagg0 |
406 | $atf_ifconfig lagg0 -laggport shmif2 | | 409 | $atf_ifconfig lagg0 -laggport shmif2 |
407 | atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2 | | 410 | atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2 |
408 | | | 411 | |
409 | # change MTU of lagg0 | | 412 | # change MTU of lagg0 |
410 | $atf_ifconfig lagg0 up | | 413 | mtu_lagg=1400 |
411 | $atf_ifconfig lagg0 mtu 1500 | | 414 | $atf_ifconfig lagg0 mtu $mtu_lagg |
412 | atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0 | | 415 | atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0 |
413 | atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig shmif0 | | 416 | atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif0 |
414 | atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig shmif1 | | 417 | atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif1 |
415 | | | 418 | |
416 | # reset MTU after detching from lagg0 | | 419 | # reset MTU after detching from lagg0 |
417 | $atf_ifconfig lagg0 -laggport shmif0 | | 420 | $atf_ifconfig lagg0 -laggport shmif0 |
418 | $atf_ifconfig lagg0 -laggport shmif1 | | 421 | $atf_ifconfig lagg0 -laggport shmif1 |
419 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 | | 422 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 |
420 | atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1 | | 423 | atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1 |
421 | | | | |
422 | # MTU should not be changed | | | |
423 | atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0 | | | |
424 | | | | |
425 | # copy MTU from 1st port even when MTU of lagg0 is changhed | | | |
426 | $atf_ifconfig lagg0 mtu 1400 | | | |
427 | atf_check -s exit:0 -o match:"mtu *1400" rump.ifconfig lagg0 | | | |
428 | $atf_ifconfig lagg0 laggport shmif0 | | | |
429 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0 | | | |
430 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 | | | |
431 | | | | |
432 | # MTU of lagg0 need not reset | | | |
433 | $atf_ifconfig lagg0 -laggport shmif0 | | | |
434 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0 | | | |
435 | atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0 | | | |
436 | } | | 424 | } |
437 | | | 425 | |
438 | lagg_mtu_cleanup() | | 426 | lagg_mtu_cleanup() |
439 | { | | 427 | { |
440 | | | 428 | |
441 | $DEBUG && dump | | 429 | $DEBUG && dump |
442 | cleanup | | 430 | cleanup |
443 | } | | 431 | } |
444 | | | 432 | |
445 | atf_test_case lagg_lacp_basic cleanup | | 433 | atf_test_case lagg_lacp_basic cleanup |
446 | lagg_lacp_basic_head() | | 434 | lagg_lacp_basic_head() |
447 | { | | 435 | { |
448 | | | 436 | |