diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2022-01-14 16:55:12 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2022-02-14 06:45:03 +0100 |
commit | c631920c151f0130986cb9051daa710bb0eb261b (patch) | |
tree | bc3351777ea0323aa17ebd2878516a31a29e75ad /pimd | |
parent | pim6d: prepare SSM/filter functions (diff) | |
download | frr-c631920c151f0130986cb9051daa710bb0eb261b.tar.xz frr-c631920c151f0130986cb9051daa710bb0eb261b.zip |
pim6d: IPv6-adjust various pim_sgaddr uses
Since `pim_sgaddr` is `pim_addr` now, that causes a whole lot of fallout
anywhere S,G pairs are handled.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'pimd')
-rw-r--r-- | pimd/pim_assert.c | 25 | ||||
-rw-r--r-- | pimd/pim_assert.h | 2 | ||||
-rw-r--r-- | pimd/pim_bsm.c | 5 | ||||
-rw-r--r-- | pimd/pim_ifchannel.c | 4 | ||||
-rw-r--r-- | pimd/pim_join.c | 11 | ||||
-rw-r--r-- | pimd/pim_nht.c | 5 | ||||
-rw-r--r-- | pimd/pim_register.c | 7 | ||||
-rw-r--r-- | pimd/pim_rpf.c | 4 | ||||
-rw-r--r-- | pimd/pim_upstream.c | 7 | ||||
-rw-r--r-- | pimd/pim_zebra.c | 28 |
10 files changed, 34 insertions, 64 deletions
diff --git a/pimd/pim_assert.c b/pimd/pim_assert.c index f4b6e81bd..7d2ebffab 100644 --- a/pimd/pim_assert.c +++ b/pimd/pim_assert.c @@ -136,8 +136,8 @@ static void if_could_assert_do_a1(const char *caller, struct pim_ifchannel *ch) } } -static int dispatch_assert(struct interface *ifp, struct in_addr source_addr, - struct in_addr group_addr, +static int dispatch_assert(struct interface *ifp, pim_addr source_addr, + pim_addr group_addr, struct pim_assert_metric recv_metric) { struct pim_ifchannel *ch; @@ -353,7 +353,7 @@ int pim_assert_metric_match(const struct pim_assert_metric *m1, } int pim_assert_build_msg(uint8_t *pim_msg, int buf_size, struct interface *ifp, - struct in_addr group_addr, struct in_addr source_addr, + pim_addr group_addr, pim_addr source_addr, uint32_t metric_preference, uint32_t route_metric, uint32_t rpt_bit_flag) { @@ -367,28 +367,21 @@ int pim_assert_build_msg(uint8_t *pim_msg, int buf_size, struct interface *ifp, /* Encode group */ remain = buf_pastend - pim_msg_curr; - pim_msg_curr = pim_msg_addr_encode_ipv4_group(pim_msg_curr, group_addr); + pim_msg_curr = pim_msg_addr_encode_group(pim_msg_curr, group_addr); if (!pim_msg_curr) { - char group_str[INET_ADDRSTRLEN]; - pim_inet4_dump("<grp?>", group_addr, group_str, - sizeof(group_str)); zlog_warn( - "%s: failure encoding group address %s: space left=%d", - __func__, group_str, remain); + "%s: failure encoding group address %pPA: space left=%d", + __func__, &group_addr, remain); return -1; } /* Encode source */ remain = buf_pastend - pim_msg_curr; - pim_msg_curr = - pim_msg_addr_encode_ipv4_ucast(pim_msg_curr, source_addr); + pim_msg_curr = pim_msg_addr_encode_ucast(pim_msg_curr, source_addr); if (!pim_msg_curr) { - char source_str[INET_ADDRSTRLEN]; - pim_inet4_dump("<src?>", source_addr, source_str, - sizeof(source_str)); zlog_warn( - "%s: failure encoding source address %s: space left=%d", - __func__, source_str, remain); + "%s: failure encoding source address %pPA: space left=%d", + __func__, &source_addr, remain); return -2; } diff --git a/pimd/pim_assert.h b/pimd/pim_assert.h index a149fb176..c7c11039a 100644 --- a/pimd/pim_assert.h +++ b/pimd/pim_assert.h @@ -67,7 +67,7 @@ int pim_assert_metric_match(const struct pim_assert_metric *m1, const struct pim_assert_metric *m2); int pim_assert_build_msg(uint8_t *pim_msg, int buf_size, struct interface *ifp, - struct in_addr group_addr, struct in_addr source_addr, + pim_addr group_addr, pim_addr source_addr, uint32_t metric_preference, uint32_t route_metric, uint32_t rpt_bit_flag); diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c index 421479047..afb4a6057 100644 --- a/pimd/pim_bsm.c +++ b/pimd/pim_bsm.c @@ -667,10 +667,7 @@ void pim_bsm_clear(struct pim_instance *pim) struct prefix grp; struct rp_info *trp_info; - grp.family = AF_INET; - grp.prefixlen = IPV4_MAX_BITLEN; - grp.u.prefix4 = up->sg.grp; - + pim_addr_to_prefix(&grp, up->sg.grp); trp_info = pim_rp_find_match_group(pim, &grp); /* RP not found for the group grp */ diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c index 924817772..343817544 100644 --- a/pimd/pim_ifchannel.c +++ b/pimd/pim_ifchannel.c @@ -1235,10 +1235,8 @@ int pim_ifchannel_local_membership_add(struct interface *ifp, pim_sgaddr *sg, struct prefix_list *plist = prefix_list_lookup( AFI_IP, pim->spt.plist); struct prefix g; - g.family = AF_INET; - g.prefixlen = IPV4_MAX_BITLEN; - g.u.prefix4 = up->sg.grp; + pim_addr_to_prefix(&g, up->sg.grp); if (prefix_list_apply(plist, &g) == PREFIX_DENY) { pim_channel_add_oif( diff --git a/pimd/pim_join.c b/pimd/pim_join.c index a3a97f20e..7aea41160 100644 --- a/pimd/pim_join.c +++ b/pimd/pim_join.c @@ -84,6 +84,7 @@ static void recv_join(struct interface *ifp, struct pim_neighbor *neigh, if ((source_flags & PIM_RPT_BIT_MASK) && (source_flags & PIM_WILDCARD_BIT_MASK)) { struct pim_rpf *rp = RP(pim_ifp->pim, sg->grp); + pim_addr rpf_addr; if (!rp) { zlog_warn("%s: Lookup of RP failed for %pSG", __func__, @@ -94,13 +95,11 @@ static void recv_join(struct interface *ifp, struct pim_neighbor *neigh, * If the RP sent in the message is not * our RP for the group, drop the message */ - if (sg->src.s_addr != rp->rpf_addr.u.prefix4.s_addr) { - char local_rp[INET_ADDRSTRLEN]; - pim_inet4_dump("<local?>", rp->rpf_addr.u.prefix4, - local_rp, sizeof(local_rp)); + rpf_addr = pim_addr_from_prefix(&rp->rpf_addr); + if (pim_addr_cmp(sg->src, rpf_addr)) { zlog_warn( - "%s: Specified RP(%pPAs) in join is different than our configured RP(%s)", - __func__, &sg->src, local_rp); + "%s: Specified RP(%pPAs) in join is different than our configured RP(%pPAs)", + __func__, &sg->src, &rpf_addr); return; } diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index 26ca48543..419e76c33 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -237,10 +237,7 @@ void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr, if (!pim_addr_is_any(upstream->sg.src)) continue; - grp.family = AF_INET; - grp.prefixlen = IPV4_MAX_BITLEN; - grp.u.prefix4 = upstream->sg.grp; - + pim_addr_to_prefix(&grp, upstream->sg.grp); trp_info = pim_rp_find_match_group(pim, &grp); if (trp_info == rp) hash_release(pnc->upstream_hash, upstream); diff --git a/pimd/pim_register.c b/pimd/pim_register.c index a0def299f..2cc80f957 100644 --- a/pimd/pim_register.c +++ b/pimd/pim_register.c @@ -399,11 +399,10 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr, struct prefix_list *plist; struct prefix src; - plist = prefix_list_lookup(AFI_IP, pim->register_plist); + plist = prefix_list_lookup(PIM_AFI, + pim->register_plist); - src.family = AF_INET; - src.prefixlen = IPV4_MAX_BITLEN; - src.u.prefix4 = sg.src; + pim_addr_to_prefix(&src, sg.src); if (prefix_list_apply(plist, &src) == PREFIX_DENY) { pim_register_stop_send(ifp, &sg, dest_addr, diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c index 1e865a395..14e6e0dc9 100644 --- a/pimd/pim_rpf.c +++ b/pimd/pim_rpf.c @@ -255,9 +255,7 @@ enum pim_rpf_result pim_rpf_update(struct pim_instance *pim, src.family = AF_INET; src.prefixlen = IPV4_MAX_BITLEN; src.u.prefix4 = up->upstream_addr; // RP or Src address - grp.family = AF_INET; - grp.prefixlen = IPV4_MAX_BITLEN; - grp.u.prefix4 = up->sg.grp; + pim_addr_to_prefix(&grp, up->sg.grp); if ((pim_addr_is_any(up->sg.src) && I_am_RP(pim, up->sg.grp)) || PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)) diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 800ec9c45..68fb5ba38 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -2153,10 +2153,7 @@ void pim_upstream_remove_lhr_star_pimreg(struct pim_instance *pim, struct prefix g; enum prefix_list_type apply_new; - np = prefix_list_lookup(AFI_IP, nlist); - - g.family = AF_INET; - g.prefixlen = IPV4_MAX_BITLEN; + np = prefix_list_lookup(PIM_AFI, nlist); frr_each (rb_pim_upstream, &pim->upstream_head, up) { if (!pim_addr_is_any(up->sg.src)) @@ -2170,7 +2167,7 @@ void pim_upstream_remove_lhr_star_pimreg(struct pim_instance *pim, PIM_OIF_FLAG_PROTO_IGMP, __func__); continue; } - g.u.prefix4 = up->sg.grp; + pim_addr_to_prefix(&g, up->sg.grp); apply_new = prefix_list_apply(np, &g); if (apply_new == PREFIX_DENY) pim_channel_add_oif(up->channel_oil, pim->regiface, diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 2efafd4b9..5f9273eb4 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -337,8 +337,8 @@ static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS) s = zclient->ibuf; prefixlen = stream_getl(s); - stream_get(&sg.src.s_addr, s, prefixlen); - stream_get(&sg.grp.s_addr, s, prefixlen); + stream_get(&sg.src, s, prefixlen); + stream_get(&sg.grp, s, prefixlen); if (PIM_DEBUG_ZEBRA) zlog_debug("%u:recv SG %s %pSG", vrf_id, @@ -606,7 +606,7 @@ void igmp_source_forward_start(struct pim_instance *pim, } if (!source->source_channel_oil) { - struct in_addr vif_source; + pim_addr vif_source; struct prefix src, grp; struct pim_nexthop nexthop; struct pim_upstream *up = NULL; @@ -619,12 +619,8 @@ void igmp_source_forward_start(struct pim_instance *pim, } else { - src.family = AF_INET; - src.prefixlen = IPV4_MAX_BITLEN; - src.u.prefix4 = vif_source; // RP or Src address - grp.family = AF_INET; - grp.prefixlen = IPV4_MAX_BITLEN; - grp.u.prefix4 = sg.grp; + pim_addr_to_prefix(&src, vif_source); // RP or Src addr + pim_addr_to_prefix(&grp, sg.grp); up = pim_upstream_find(pim, &sg); if (up) { @@ -642,15 +638,11 @@ void igmp_source_forward_start(struct pim_instance *pim, pim_ecmp_fib_lookup_if_vif_index( pim, &src, &grp); - if (PIM_DEBUG_ZEBRA) { - char buf2[INET_ADDRSTRLEN]; - - pim_inet4_dump("<source?>", vif_source, buf2, - sizeof(buf2)); - zlog_debug("%s: NHT %pSG vif_source %s vif_index:%d ", - __func__, &sg, buf2, - input_iface_vif_index); - } + if (PIM_DEBUG_ZEBRA) + zlog_debug( + "%s: NHT %pSG vif_source %pPAs vif_index:%d ", + __func__, &sg, &vif_source, + input_iface_vif_index); if (input_iface_vif_index < 1) { if (PIM_DEBUG_IGMP_TRACE) { |