summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMobashshera Rasool <mrasool@vmware.com>2021-12-13 22:28:46 -0800
committerMobashshera Rasool <mrasool@vmware.com>2022-01-10 21:10:29 -0800
commit95d516622bcbf90bc8bfff23cc6512ea416fd8da (patch)
treeb34b808fcf964b5d1697b0dcc6aea79eb7ca5d53
parentb85201d5cde1ad28fba70517ab4a33063fba1ae0 (diff)
pimd: Modify in_addr to pim_addr in pim_assert_metric
This change is to accomodate IPv6 and IPv4 in the same code. Based on pimd or pim6d, this will be compiled. Reviewed-by: Sarita Patra <saritap@vmware.com> Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
-rw-r--r--pimd/pim_assert.c8
-rw-r--r--pimd/pim_assert.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/pimd/pim_assert.c b/pimd/pim_assert.c
index cac3194681..a335bc8c1a 100644
--- a/pimd/pim_assert.c
+++ b/pimd/pim_assert.c
@@ -65,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,
@@ -339,7 +339,7 @@ int pim_assert_metric_better(const struct pim_assert_metric *m1,
if (m1->route_metric > m2->route_metric)
return 0;
- return ntohl(m1->ip_address.s_addr) > ntohl(m2->ip_address.s_addr);
+ return pim_addr_cmp(m1->ip_address, m2->ip_address) > 0;
}
int pim_assert_metric_match(const struct pim_assert_metric *m1,
@@ -352,7 +352,7 @@ int pim_assert_metric_match(const struct pim_assert_metric *m1,
if (m1->route_metric != m2->route_metric)
return 0;
- return m1->ip_address.s_addr == m2->ip_address.s_addr;
+ return !pim_addr_cmp(m1->ip_address, m2->ip_address);
}
int pim_assert_build_msg(uint8_t *pim_msg, int buf_size, struct interface *ifp,
diff --git a/pimd/pim_assert.h b/pimd/pim_assert.h
index 2e6e62cc3a..a149fb176e 100644
--- a/pimd/pim_assert.h
+++ b/pimd/pim_assert.h
@@ -37,7 +37,7 @@ struct pim_assert_metric {
uint32_t rpt_bit_flag;
uint32_t metric_preference;
uint32_t route_metric;
- struct in_addr ip_address; /* neighbor router that sourced the Assert
+ pim_addr ip_address; /* neighbor router that sourced the Assert
message */
};