[LTP] [PATCH 1/2] tst_net.sh: Fix for disabled IPv6

Petr Vorel pvorel@suse.cz
Wed Feb 2 11:32:25 CET 2022


Hi all,

> Hi Alexey, all,

> ...
> > > @@ -971,8 +1003,16 @@ IPV6_RHOST="${IPV6_RHOST:-fd00:1:1:1::1/64}"
> > >  if [ -z "$_tst_net_parse_variables" ]; then
> > >  	eval $(tst_net_ip_prefix $IPV4_LHOST || echo "exit $?")
> > >  	eval $(tst_net_ip_prefix -r $IPV4_RHOST || echo "exit $?")
> > > -	eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?")
> > > -	eval $(tst_net_ip_prefix -r $IPV6_RHOST || echo "exit $?")
> > > +
> > > +	tst_net_detect_ipv6 && TST_NET_LHOST_IPV6=1
> > > +	tst_net_detect_ipv6 rhost && TST_NET_RHOST_IPV6=1
> > > +
> > > +	if [ "$TST_NET_LHOST_IPV6" = 1 ]; then
> > > +		eval $(tst_net_ip_prefix $IPV6_LHOST || echo "exit $?")
> > > +	fi
> > > +	if [ "$TST_NET_RHOST_IPV6" = 1 ]; then
> > > +		eval $(tst_net_ip_prefix -r $IPV6_RHOST || echo "exit $?")
> > > +	fi

> > Do we really need to keep around and check two variables? If at least
> > one machine doesn't have IPv6, it's not longer necessary to setup the
> > other.

> OK, just one variable is enough, e.g. TST_NET_REQUIRE_IPV6.

> @all: But netns_helper.sh, which does not use tst_net.sh also requires IPv6
> (and there are probably more), thus how about adding flag TST_REQUIRE_IPV6
> into tst_test.sh (would help also for documentation - docparse).
Going to add it to v3.

> And tst_net.sh would just on check also IPv6 on rhost.

I found that no C test needs a special flag for handling IPv6 because we can
filter it with errno EAFNOSUPPORT. We should just remember tests first use IPv4
(e.g. in bind05.c), because functions behind SAFE_* macros use tst_brk.

@Cyril: I suppose we don't want to have kind of info flag "uses_ipv6" in C API
(for docparse), right?

Kind regards,
Petr

> Kind regards,
> Petr


More information about the ltp mailing list