On Fri, Dec 01, 2023 at 01:56:51PM +0800, Po-Hsu Lin wrote:
+# setup netns with given names as prefix. e.g +# setup_ns local remote +setup_ns() +{
local ns=""local ns_name=""local ns_list=""for ns_name in "$@"; do# Some test may setup/remove same netns multi timesif unset ${ns_name} 2> /dev/null; thenns="${ns_name,,}-$(mktemp -u XXXXXX)"eval readonly ${ns_name}="$ns"elseeval ns='$'${ns_name}cleanup_ns "$ns"fiif ! ip netns add "$ns"; thenecho "Failed to create namespace $ns_name"cleanup_ns "$ns_list"return $ksft_skipfiip -n "$ns" link set lo upI got this patchset tested the result is looking good. However it seems that not all of the tests require this loopback bring up, e.g.
- arp_ndisc_untracked_subnets.sh
- cmsg_ipv6.sh
- cmsg_so_mark.sh
- cmsg_time.sh
- drop_monitor_tests.sh
- icmp.sh
- ndisc_unsolicited_na_test.sh
- sctp_vrf.sh
- unicast_extensions.sh
A possible solution could be adding an extra flag to setup_ns(), bring lo up on demand.
Not sure if this is needed, as I can't think of possible impacts of this for the moment. (Maybe a test does not require loopback device in such state?) Other might be able to provide some feedback about this.
Yes, I also can't think of impact of set lo up. So I just do it explicit. If someone could help find out the impact, I can add a flag for this function.
Thanks Hangbin