[LTP] [PATCH v2 1/2] tst_net.sh: Detect IPv6 disabled via sysct

Petr Vorel pvorel@suse.cz
Wed Mar 22 17:20:46 CET 2023


Hi Cyril,

...
> > +	if [ $? -ne 0 ]; then
> > +		TST_NET_IPV6_ENABLED=0
> > +		tst_res_ TINFO "IPv6 disabled on $type via ipv6.disable=1"

> Doesn't this happen also in the unlikely case that CONFIG_IPV6 is not
> set?

> So maybe "IPv6 disabled on kernel commandline or not compiled in"
Indeed, You're right, I'll use (to show where it was disabled):

tst_res_ TINFO "IPv6 disabled on $type via kernel command line or not compiled in"

> > +		return
> > +	fi
> > +
> > +	cmd='sysctl -n net.ipv6.conf.all.disable_ipv6'

> I'm not sure why we should use sysctl when this the same as doing

> cat /proc/sys/net/ipv6/conf/all/disable_ipv6
> Or is there any added value from the sysctl command?

No, but we already use sysctl in tst_init_iface():
sysctl -qw net.ipv6.conf.$iface.accept_dad=0 || return $?
tst_rhost_run -c "sysctl -qw net.ipv6.conf.$iface.accept_dad=0" || return $?

and we don't check for sysctl (expecting is everywhere). I'd also allow using
sysctl (and then add a check via tst_require_cmds) or change also these with
cat for reading and echo ... > for writing. WDYT?

Kind regards,
Petr


More information about the ltp mailing list