diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2025-02-05 09:14:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-05 09:14:58 -0500 |
| commit | 0b42b4ce6d7ccb43931c391e916ac6bf0a0aadf2 (patch) | |
| tree | 80dbbf17651c54797287b8aca095de15e325ef92 /zebra | |
| parent | 3fabd4f4f97630ef911a83712eef4ac515a76a42 (diff) | |
| parent | 001fcfa1dd9f7dc2639b4f5c7a52ab59cc425452 (diff) | |
Merge pull request #17901 from opensourcerouting/nexthop_hashing
lib: actually hash all 16 bytes of IPv6 addresses, not just 4
Diffstat (limited to 'zebra')
| -rw-r--r-- | zebra/zebra_routemap.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c index 73ffa09c16..2813f037a2 100644 --- a/zebra/zebra_routemap.c +++ b/zebra/zebra_routemap.c @@ -959,10 +959,11 @@ route_set_src(void *rule, const struct prefix *prefix, void *object) /* set src compilation. */ static void *route_set_src_compile(const char *arg) { - union g_addr src, *psrc; + union g_addr src = {}, *psrc; - if ((inet_pton(AF_INET6, arg, &src.ipv6) == 1) - || (inet_pton(AF_INET, arg, &src.ipv4) == 1)) { + /* IPv4 first, to ensure no garbage in the 12 unused bytes */ + if ((inet_pton(AF_INET, arg, &src.ipv4) == 1) || + (inet_pton(AF_INET6, arg, &src.ipv6) == 1)) { psrc = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, sizeof(union g_addr)); *psrc = src; return psrc; |
