Re: [LTP] [PATCH 6/9] tst_net.sh: Rename function + add doc

Petr Vorel
2023-02-08T13:45:54Z

Hi Cyril,

first, thanks for you review!

> Hi!
> What I didn't get here is why do we put the code to detect IPV6 into two
> different functions and then call it twice nearly from the same place in
> the library. Is there a reason why can't we put the sysctl check right
> after the proc check in the current ipv6 detection function?

Well, the old check (cmdline check for ipv6.disable=1) must be run before
creating interfaces. But the new sysctl based tests test interfaces
(${L,R}HOST_IFACES). Technically it could be run just after ipv6.disable=1
check, because it's needed only for the non-default ssh based two host setup [1].
But ${L,R}HOST_IFACES initialization:

export LHOST_IFACES="${LHOST_IFACES:-eth0}"
export RHOST_IFACES="${RHOST_IFACES:-eth0}"

would have to be moved before this check and run only for ssh based test
(the default netns based single host will create interfaces in init_ltp_netspace()
and for them ipv6.disable=1 check is good enough). I wanted to keep variables in
single place, but I'm ok to add this exception. Or we can keep variables where
they are and run this check on ${LHOST_IFACES:-} and ${RHOST_IFACES:-} (i.e.
only if these interfaces are set externally - which should be only on ssh two
host based setup).

I also thought that having to run this new check separately could be useful
(setup can change any time). But as nobody required that /complained it's
needed, let's ignore this.

Kind regards,
Petr

[1] https://github.com/linux-test-project/ltp/tree/master/testcases/network#single-host-configuration