diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2022-01-05 15:56:18 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2022-01-17 14:08:58 +0100 |
commit | 62f59b58ba4c0fa2a5763bccaade47d6b070438b (patch) | |
tree | 7174d035faddc37f9c8b78b25cd9e6b05892a822 /pimd/pim_msdp.c | |
parent | pimd: remove pim_addr_copy (diff) | |
download | frr-62f59b58ba4c0fa2a5763bccaade47d6b070438b.tar.xz frr-62f59b58ba4c0fa2a5763bccaade47d6b070438b.zip |
pimd: deploy pim_sgaddr_* helpers
Use _cmp/_hash/_match helpers for operations on pim_sgaddr to prepare
IPv6 support.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_msdp.c')
-rw-r--r-- | pimd/pim_msdp.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index 63cdc9214..8c4d2293c 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -680,7 +680,7 @@ static unsigned int pim_msdp_sa_hash_key_make(const void *p) { const struct pim_msdp_sa *sa = p; - return (jhash_2words(sa->sg.src.s_addr, sa->sg.grp.s_addr, 0)); + return pim_sgaddr_hash(sa->sg, 0); } static bool pim_msdp_sa_hash_eq(const void *p1, const void *p2) @@ -688,8 +688,7 @@ static bool pim_msdp_sa_hash_eq(const void *p1, const void *p2) const struct pim_msdp_sa *sa1 = p1; const struct pim_msdp_sa *sa2 = p2; - return ((sa1->sg.src.s_addr == sa2->sg.src.s_addr) - && (sa1->sg.grp.s_addr == sa2->sg.grp.s_addr)); + return !pim_sgaddr_cmp(sa1->sg, sa2->sg); } static int pim_msdp_sa_comp(const void *p1, const void *p2) @@ -697,19 +696,7 @@ static int pim_msdp_sa_comp(const void *p1, const void *p2) const struct pim_msdp_sa *sa1 = p1; const struct pim_msdp_sa *sa2 = p2; - if (ntohl(sa1->sg.grp.s_addr) < ntohl(sa2->sg.grp.s_addr)) - return -1; - - if (ntohl(sa1->sg.grp.s_addr) > ntohl(sa2->sg.grp.s_addr)) - return 1; - - if (ntohl(sa1->sg.src.s_addr) < ntohl(sa2->sg.src.s_addr)) - return -1; - - if (ntohl(sa1->sg.src.s_addr) > ntohl(sa2->sg.src.s_addr)) - return 1; - - return 0; + return pim_sgaddr_cmp(sa1->sg, sa2->sg); } /* RFC-3618:Sec-10.1.3 - Peer-RPF forwarding */ |