diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-10-25 22:24:25 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-10-25 22:25:36 +0200 |
commit | 61be6e94ab21b6883884e3a6cbbfc5e4e1808bab (patch) | |
tree | 56e5fc84e650399c3a13328d8ac8dde056b99bd7 /lib/prefix.c | |
parent | lib: convert prefixlen to 16-bit integer (diff) | |
download | frr-61be6e94ab21b6883884e3a6cbbfc5e4e1808bab.tar.xz frr-61be6e94ab21b6883884e3a6cbbfc5e4e1808bab.zip |
bgpd, lib: few more prefixlen updated
* Cast when assigning should be to uint16_t
* Restored comment documenting strange behavior
* Further increased PREFIX_STRLEN to 80 chars
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/prefix.c')
-rw-r--r-- | lib/prefix.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/prefix.c b/lib/prefix.c index f3b707af3..9f0aa5066 100644 --- a/lib/prefix.c +++ b/lib/prefix.c @@ -971,6 +971,10 @@ uint8_t ip_masklen(struct in_addr netmask) { uint32_t tmp = ~ntohl(netmask.s_addr); + /* + * clz: count leading zeroes. sadly, the behaviour of this builtin is + * undefined for a 0 argument, even though most CPUs give 32 + */ return tmp ? __builtin_clz(tmp) : 32; } |