ndisc-option: introduce generic NDisc option parser
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 29 Feb 2024 03:31:58 +0000 (12:31 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 13 Mar 2024 03:32:37 +0000 (12:32 +0900)
commita163404cc88914142ef8bbfaab0eb39d1a990c02
tree0cd6aa4ecbc68b71727db553fba3fc84acc68e74
parentdd6bbb302791b40d31ff0913cbc1a618595e605c
ndisc-option: introduce generic NDisc option parser

It is not used in this commit, but will be used for parsing NDisc
options in Router Advertisement message and friends.

The parser does mostly equivalent to what currently we do in
sd-ndisc-router.c. Several notable differences are:
- also perse source and target link-layer address,
- refuse multiple captive portals,
- check if the captive portal is in safe characters, as previously we
  checked that in networkd-ndisc.c,
- dedup prefixes, routes, and pref64,
- limit the total number of options, for safety.
src/libsystemd-network/ndisc-option.c
src/libsystemd-network/ndisc-option.h
src/systemd/sd-ndisc-protocol.h