diff options
author | tb <> | 2021-12-28 16:26:53 +0000 |
---|---|---|
committer | tb <> | 2021-12-28 16:26:53 +0000 |
commit | c5e2fed5aebe8491f8f9f05ec8e17fa61fbfca9f (patch) | |
tree | 3fef000e0741e91a46b34ddae411b0e0603ba9fd /src/usr.bin | |
parent | 0e7d4e6fe6e9b90dd5e9e65301b1c7f33b277995 (diff) | |
download | openbsd-c5e2fed5aebe8491f8f9f05ec8e17fa61fbfca9f.tar.gz openbsd-c5e2fed5aebe8491f8f9f05ec8e17fa61fbfca9f.tar.bz2 openbsd-c5e2fed5aebe8491f8f9f05ec8e17fa61fbfca9f.zip |
Simplify and explain expand_addr() a bit
RFC 3779 section 2.1.2 does a decent job of explaining how IP addresses
are encoded in. What's stored amounts to a prefix with all trailing zero
octets omitted. If there are trailing zero bits in the last non-zero octet,
bs->flags & 7 indicates how many. addr_expand() expands this to an address
of length 4 or 16 depending on whether we deal with IPv4 or IPv6.
Since an address can be the lower or the upper bound of a prefix or
address range, expansion needs to be able to zero-fill or one-fill the
unused bits/octets. No other expansion is ever used, so simplify the
meaning of fill accordingly. There's no need to special case the case
that there are no unused bits, the masking/filling is a noop.
ok jsing
Diffstat (limited to 'src/usr.bin')
0 files changed, 0 insertions, 0 deletions