radvd-project / radvd

radvd | Official repository: https://github.com/radvd-project/radvd
https://radvd.litech.org/
Other
203 stars 106 forks source link

send, test/send: isolate cease_adv of add_ra_header #201

Closed robbat2 closed 1 year ago

robbat2 commented 1 year ago

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:

Closes: https://github.com/radvd-project/radvd/issues/200 Signed-off-by: Robin H. Johnson robbat2@gentoo.org