summaryrefslogtreecommitdiff
path: root/pimd/pim_join.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2022-01-14 16:38:41 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2022-02-14 06:45:03 +0100
commit0d360092045fdfca1a363bbc522deafbb79255e8 (patch)
tree9ce974e3fb9af2dfb2b6ea5e35c92328dbd115a0 /pimd/pim_join.c
parent16763d77a39ae0cd84e6fcf4b3f6a05f10d94c38 (diff)
pim6d: more TLV parse/encode IPv6 preparation
More proliferation of pim_addr to work towards IPV6. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_join.c')
-rw-r--r--pimd/pim_join.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/pimd/pim_join.c b/pimd/pim_join.c
index 22890dc372..a3a97f20e5 100644
--- a/pimd/pim_join.c
+++ b/pimd/pim_join.c
@@ -165,7 +165,8 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh,
struct in_addr src_addr, uint8_t *tlv_buf,
int tlv_buf_size)
{
- struct prefix msg_upstream_addr;
+ pim_addr msg_upstream_addr;
+ bool wrong_af = false;
struct pim_interface *pim_ifp;
uint8_t msg_num_groups;
uint16_t msg_holdtime;
@@ -184,8 +185,8 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh,
/*
Parse ucast addr
*/
- addr_offset =
- pim_parse_addr_ucast(&msg_upstream_addr, buf, pastend - buf);
+ addr_offset = pim_parse_addr_ucast(&msg_upstream_addr, buf,
+ pastend - buf, &wrong_af);
if (addr_offset < 1) {
char src_str[INET_ADDRSTRLEN];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
@@ -198,12 +199,12 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh,
/*
Check upstream address family
*/
- if (msg_upstream_addr.family != AF_INET) {
+ if (wrong_af) {
char src_str[INET_ADDRSTRLEN];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
zlog_warn(
- "%s: ignoring join/prune directed to unexpected addr family=%d from %s on %s",
- __func__, msg_upstream_addr.family, src_str, ifp->name);
+ "%s: ignoring join/prune directed to unexpected addr family from %s on %s",
+ __func__, src_str, ifp->name);
return -2;
}
@@ -226,14 +227,11 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh,
if (PIM_DEBUG_PIM_J_P) {
char src_str[INET_ADDRSTRLEN];
- char upstream_str[INET_ADDRSTRLEN];
pim_inet4_dump("<src?>", src_addr, src_str, sizeof(src_str));
- pim_inet4_dump("<addr?>", msg_upstream_addr.u.prefix4,
- upstream_str, sizeof(upstream_str));
zlog_debug(
- "%s: join/prune upstream=%s groups=%d holdtime=%d from %s on %s",
- __func__, upstream_str, msg_num_groups, msg_holdtime,
- src_str, ifp->name);
+ "%s: join/prune upstream=%pPAs groups=%d holdtime=%d from %s on %s",
+ __func__, &msg_upstream_addr, msg_num_groups,
+ msg_holdtime, src_str, ifp->name);
}
/* Scan groups */
@@ -271,14 +269,11 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh,
if (PIM_DEBUG_PIM_J_P) {
char src_str[INET_ADDRSTRLEN];
- char upstream_str[INET_ADDRSTRLEN];
pim_inet4_dump("<src?>", src_addr, src_str,
sizeof(src_str));
- pim_inet4_dump("<addr?>", msg_upstream_addr.u.prefix4,
- upstream_str, sizeof(upstream_str));
zlog_debug(
- "%s: join/prune upstream=%s group=%pPA/32 join_src=%d prune_src=%d from %s on %s",
- __func__, upstream_str, &sg.grp,
+ "%s: join/prune upstream=%pPAs group=%pPA/32 join_src=%d prune_src=%d from %s on %s",
+ __func__, &msg_upstream_addr, &sg.grp,
msg_num_joined_sources, msg_num_pruned_sources,
src_str, ifp->name);
}
@@ -300,9 +295,8 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh,
if (filtered)
continue;
- recv_join(ifp, neigh, msg_holdtime,
- msg_upstream_addr.u.prefix4, &sg,
- msg_source_flags);
+ recv_join(ifp, neigh, msg_holdtime, msg_upstream_addr,
+ &sg, msg_source_flags);
if (pim_addr_is_any(sg.src)) {
starg_ch = pim_ifchannel_find(ifp, &sg);
@@ -326,9 +320,8 @@ int pim_joinprune_recv(struct interface *ifp, struct pim_neighbor *neigh,
if (filtered)
continue;
- recv_prune(ifp, neigh, msg_holdtime,
- msg_upstream_addr.u.prefix4, &sg,
- msg_source_flags);
+ recv_prune(ifp, neigh, msg_holdtime, msg_upstream_addr,
+ &sg, msg_source_flags);
/*
* So if we are receiving a S,G,RPT prune
* before we have any data for that S,G