The add_ra_header function had a hidden dependency on system state:
If cease_adv was not set, the outcome was dependent on the sysctl knob
"net.ipv6.conf.all.forwarding".
This was visible only during testing with
net.ipv6.conf.all.forwarding=1. If tested with
net.ipv6.conf.all.forwarding=0, the tests passed.
Hoist the sysctl dependency out of the add_ra_header function, to enable
testing of both code paths, and add the extra test to validate both
states of the cease_adv input.
The add_ra_header function had a hidden dependency on system state: If cease_adv was not set, the outcome was dependent on the sysctl knob "net.ipv6.conf.all.forwarding".
This was visible only during testing with net.ipv6.conf.all.forwarding=1. If tested with net.ipv6.conf.all.forwarding=0, the tests passed.
Hoist the sysctl dependency out of the add_ra_header function, to enable testing of both code paths, and add the extra test to validate both states of the cease_adv input.
Also improve
snprint_safe_buffer
:{
seen in this comment https://github.com/radvd-project/radvd/issues/200#issuecomment-1374717135)Closes: https://github.com/radvd-project/radvd/issues/200 Signed-off-by: Robin H. Johnson robbat2@gentoo.org