Merge pull request #15149 from donaldsharp/pim_vxlan_issues_2

Some code realignment in pim
This commit is contained in:
Donatas Abraitis 2024-01-13 21:10:07 +02:00 committed by GitHub
commit 4eafe41546
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 69 additions and 75 deletions

View File

@ -185,14 +185,15 @@ size_t pim_msg_get_jp_group_size(struct list *sources)
size += sizeof(pim_encoded_source) * sources->count; size += sizeof(pim_encoded_source) * sources->count;
js = listgetdata(listhead(sources)); js = listgetdata(listhead(sources));
if (js && pim_addr_is_any(js->up->sg.src) && js->is_join) { if (!js || !pim_addr_is_any(js->up->sg.src) || !js->is_join)
return size;
struct pim_upstream *child, *up; struct pim_upstream *child, *up;
struct listnode *up_node; struct listnode *up_node;
up = js->up; up = js->up;
if (PIM_DEBUG_PIM_PACKETS) if (PIM_DEBUG_PIM_PACKETS)
zlog_debug( zlog_debug("%s: Considering (%s) children for (S,G,rpt) prune",
"%s: Considering (%s) children for (S,G,rpt) prune",
__func__, up->sg_str); __func__, up->sg_str);
for (ALL_LIST_ELEMENTS_RO(up->sources, up_node, child)) { for (ALL_LIST_ELEMENTS_RO(up->sources, up_node, child)) {
@ -230,39 +231,32 @@ size_t pim_msg_get_jp_group_size(struct list *sources)
* same IIF as RPF_interface(RP). * same IIF as RPF_interface(RP).
*/ */
if (child->rpf.source_nexthop.interface && if (child->rpf.source_nexthop.interface &&
!pim_rpf_is_same(&up->rpf, !pim_rpf_is_same(&up->rpf, &child->rpf)) {
&child->rpf)) {
size += sizeof(pim_encoded_source); size += sizeof(pim_encoded_source);
PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE( PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE(
child->flags); child->flags);
if (PIM_DEBUG_PIM_PACKETS) if (PIM_DEBUG_PIM_PACKETS)
zlog_debug( zlog_debug("%s: SPT Bit and RPF'(%s) != RPF'(S,G): Add Prune (%s,rpt) to compound message",
"%s: SPT Bit and RPF'(%s) != RPF'(S,G): Add Prune (%s,rpt) to compound message",
__func__, up->sg_str, __func__, up->sg_str,
child->sg_str); child->sg_str);
} else if (PIM_DEBUG_PIM_PACKETS) } else if (PIM_DEBUG_PIM_PACKETS)
zlog_debug( zlog_debug("%s: SPT Bit and RPF'(%s) == RPF'(S,G): Not adding Prune for (%s,rpt)",
"%s: SPT Bit and RPF'(%s) == RPF'(S,G): Not adding Prune for (%s,rpt)", __func__, up->sg_str, child->sg_str);
__func__, up->sg_str,
child->sg_str);
} else if (pim_upstream_empty_inherited_olist(child)) { } else if (pim_upstream_empty_inherited_olist(child)) {
/* S is supposed to be forwarded along the RPT /* S is supposed to be forwarded along the RPT
* but it's inherited OIL is empty. So just * but it's inherited OIL is empty. So just
* prune it off. * prune it off.
*/ */
size += sizeof(pim_encoded_source); size += sizeof(pim_encoded_source);
PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE( PIM_UPSTREAM_FLAG_SET_SEND_SG_RPT_PRUNE(child->flags);
child->flags);
if (PIM_DEBUG_PIM_PACKETS) if (PIM_DEBUG_PIM_PACKETS)
zlog_debug( zlog_debug("%s: inherited_olist(%s,rpt) is NULL, Add Prune to compound message",
"%s: inherited_olist(%s,rpt) is NULL, Add Prune to compound message",
__func__, child->sg_str); __func__, child->sg_str);
} else if (PIM_DEBUG_PIM_PACKETS) } else if (PIM_DEBUG_PIM_PACKETS)
zlog_debug( zlog_debug("%s: Do not add Prune %s to compound message %s",
"%s: Do not add Prune %s to compound message %s",
__func__, child->sg_str, up->sg_str); __func__, child->sg_str, up->sg_str);
} }
}
return size; return size;
} }

View File

@ -96,8 +96,8 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
p = c->address; p = c->address;
if (PIM_DEBUG_ZEBRA) { if (PIM_DEBUG_ZEBRA) {
zlog_debug("%s: %s(%u) connected IP address %pFX flags %u %s", zlog_debug("%s: %s(%s) connected IP address %pFX flags %u %s",
__func__, c->ifp->name, vrf_id, p, c->flags, __func__, c->ifp->name, VRF_LOGNAME(pim_ifp->pim->vrf), p, c->flags,
CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY) CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)
? "secondary" ? "secondary"
: "primary"); : "primary");
@ -182,8 +182,8 @@ static int pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS)
if (PIM_DEBUG_ZEBRA) { if (PIM_DEBUG_ZEBRA) {
zlog_debug( zlog_debug(
"%s: %s(%u) disconnected IP address %pFX flags %u %s", "%s: %s(%s) disconnected IP address %pFX flags %u %s",
__func__, c->ifp->name, vrf_id, p, c->flags, __func__, c->ifp->name, VRF_LOGNAME(vrf), p, c->flags,
CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY) CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)
? "secondary" ? "secondary"
: "primary"); : "primary");
@ -325,7 +325,7 @@ static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS)
stream_get(&sg.grp, s, prefixlen); stream_get(&sg.grp, s, prefixlen);
if (PIM_DEBUG_ZEBRA) if (PIM_DEBUG_ZEBRA)
zlog_debug("%u:recv SG %s %pSG", vrf_id, zlog_debug("%s:recv SG %s %pSG", VRF_LOGNAME(pim->vrf),
(cmd == ZEBRA_VXLAN_SG_ADD) ? "add" : "del", &sg); (cmd == ZEBRA_VXLAN_SG_ADD) ? "add" : "del", &sg);
if (cmd == ZEBRA_VXLAN_SG_ADD) if (cmd == ZEBRA_VXLAN_SG_ADD)