diff options
author | Mobashshera Rasool <mrasool@vmware.com> | 2021-12-14 07:20:37 +0100 |
---|---|---|
committer | Mobashshera Rasool <mrasool@vmware.com> | 2022-01-11 06:10:24 +0100 |
commit | b85201d5cde1ad28fba70517ab4a33063fba1ae0 (patch) | |
tree | a8e7e023c97831105f49f1a7f3337f64c28be9b4 /pimd | |
parent | pimd: API changes to accomodate IPv4 and IPv6 (diff) | |
download | frr-b85201d5cde1ad28fba70517ab4a33063fba1ae0.tar.xz frr-b85201d5cde1ad28fba70517ab4a33063fba1ae0.zip |
pimd: Modifying in_addr to pim_addr in struct pim_ifchannel for IPv6.
Changed struct in_addr ifassert_winner to pim_addr
which will be used in both IPv4 and IPv6(Both MLD and IGMP).
Reviewed-by: Sarita Patra <saritap@vmware.com>
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
Diffstat (limited to 'pimd')
-rw-r--r-- | pimd/pim_assert.c | 13 | ||||
-rw-r--r-- | pimd/pim_assert.h | 3 | ||||
-rw-r--r-- | pimd/pim_ifchannel.h | 2 |
3 files changed, 8 insertions, 10 deletions
diff --git a/pimd/pim_assert.c b/pimd/pim_assert.c index 098893870..cac319468 100644 --- a/pimd/pim_assert.c +++ b/pimd/pim_assert.c @@ -43,12 +43,11 @@ static void assert_action_a6(struct pim_ifchannel *ch, struct pim_assert_metric winner_metric); void pim_ifassert_winner_set(struct pim_ifchannel *ch, - enum pim_ifassert_state new_state, - struct in_addr winner, + enum pim_ifassert_state new_state, pim_addr winner, struct pim_assert_metric winner_metric) { struct pim_interface *pim_ifp = ch->interface->info; - int winner_changed = (ch->ifassert_winner.s_addr != winner.s_addr); + int winner_changed = !!pim_addr_cmp(ch->ifassert_winner, winner); int metric_changed = !pim_assert_metric_match( &ch->ifassert_winner_metric, &winner_metric); @@ -66,9 +65,9 @@ void pim_ifassert_winner_set(struct pim_ifchannel *ch, char was_str[INET_ADDRSTRLEN]; char winner_str[INET_ADDRSTRLEN]; pim_inet4_dump("<was?>", ch->ifassert_winner, was_str, - sizeof(was_str)); + sizeof(was_str)); pim_inet4_dump("<winner?>", winner, winner_str, - sizeof(winner_str)); + sizeof(winner_str)); zlog_debug( "%s: (S,G)=%s assert winner changed from %s to %s on interface %s", __func__, ch->sg_str, was_str, winner_str, @@ -179,8 +178,8 @@ static int dispatch_assert(struct interface *ifp, struct in_addr source_addr, } break; case PIM_IFASSERT_I_AM_LOSER: - if (recv_metric.ip_address.s_addr - == ch->ifassert_winner.s_addr) { + if (!pim_addr_cmp(recv_metric.ip_address, + ch->ifassert_winner)) { /* Assert from current winner */ if (cancel_assert(&recv_metric)) { diff --git a/pimd/pim_assert.h b/pimd/pim_assert.h index c07cbeb01..2e6e62cc3 100644 --- a/pimd/pim_assert.h +++ b/pimd/pim_assert.h @@ -55,8 +55,7 @@ struct pim_assert_metric { #define PIM_ASSERT_ROUTE_METRIC_MAX (0xFFFFFFFF) void pim_ifassert_winner_set(struct pim_ifchannel *ch, - enum pim_ifassert_state new_state, - struct in_addr winner, + enum pim_ifassert_state new_state, pim_addr winner, struct pim_assert_metric winner_metric); int pim_assert_recv(struct interface *ifp, struct pim_neighbor *neigh, diff --git a/pimd/pim_ifchannel.h b/pimd/pim_ifchannel.h index 332d40d92..e26604069 100644 --- a/pimd/pim_ifchannel.h +++ b/pimd/pim_ifchannel.h @@ -106,7 +106,7 @@ struct pim_ifchannel { /* Per-interface (S,G) Assert State (Section 4.6.1 of RFC4601) */ enum pim_ifassert_state ifassert_state; struct thread *t_ifassert_timer; - struct in_addr ifassert_winner; + pim_addr ifassert_winner; struct pim_assert_metric ifassert_winner_metric; int64_t ifassert_creation; /* Record uptime of ifassert state */ struct pim_assert_metric ifassert_my_metric; |