mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 13:13:08 +00:00
pimd: Add a pim pointer to register_recv
We already use the pim pointer a bunch off of pim_ifp->pim just add another pim variable to allow us to shorten code a bit. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
1c4e26bc06
commit
2ca35b6437
@ -324,14 +324,13 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
|
|||||||
struct prefix_sg sg;
|
struct prefix_sg sg;
|
||||||
uint32_t *bits;
|
uint32_t *bits;
|
||||||
int i_am_rp = 0;
|
int i_am_rp = 0;
|
||||||
struct pim_interface *pim_ifp = NULL;
|
struct pim_interface *pim_ifp = ifp->info;
|
||||||
|
struct pim_instance *pim = pim_ifp->pim;
|
||||||
pim_ifp = ifp->info;
|
|
||||||
|
|
||||||
#define PIM_MSG_REGISTER_BIT_RESERVED_LEN 4
|
#define PIM_MSG_REGISTER_BIT_RESERVED_LEN 4
|
||||||
ip_hdr = (struct ip *)(tlv_buf + PIM_MSG_REGISTER_BIT_RESERVED_LEN);
|
ip_hdr = (struct ip *)(tlv_buf + PIM_MSG_REGISTER_BIT_RESERVED_LEN);
|
||||||
|
|
||||||
if (!pim_rp_check_is_my_ip_address(pim_ifp->pim, dest_addr)) {
|
if (!pim_rp_check_is_my_ip_address(pim, dest_addr)) {
|
||||||
if (PIM_DEBUG_PIM_REG) {
|
if (PIM_DEBUG_PIM_REG) {
|
||||||
char dest[INET_ADDRSTRLEN];
|
char dest[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
@ -375,7 +374,7 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
|
|||||||
sg.src = ip_hdr->ip_src;
|
sg.src = ip_hdr->ip_src;
|
||||||
sg.grp = ip_hdr->ip_dst;
|
sg.grp = ip_hdr->ip_dst;
|
||||||
|
|
||||||
i_am_rp = I_am_RP(pim_ifp->pim, sg.grp);
|
i_am_rp = I_am_RP(pim, sg.grp);
|
||||||
|
|
||||||
if (PIM_DEBUG_PIM_REG) {
|
if (PIM_DEBUG_PIM_REG) {
|
||||||
char src_str[INET_ADDRSTRLEN];
|
char src_str[INET_ADDRSTRLEN];
|
||||||
@ -387,7 +386,7 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
|
|||||||
|
|
||||||
if (i_am_rp
|
if (i_am_rp
|
||||||
&& (dest_addr.s_addr
|
&& (dest_addr.s_addr
|
||||||
== ((RP(pim_ifp->pim, sg.grp))->rpf_addr.u.prefix4.s_addr))) {
|
== ((RP(pim, sg.grp))->rpf_addr.u.prefix4.s_addr))) {
|
||||||
sentRegisterStop = 0;
|
sentRegisterStop = 0;
|
||||||
|
|
||||||
if (*bits & PIM_REGISTER_BORDER_BIT) {
|
if (*bits & PIM_REGISTER_BORDER_BIT) {
|
||||||
@ -411,14 +410,13 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pim_upstream *upstream =
|
struct pim_upstream *upstream = pim_upstream_find(pim, &sg);
|
||||||
pim_upstream_find(pim_ifp->pim, &sg);
|
|
||||||
/*
|
/*
|
||||||
* If we don't have a place to send ignore the packet
|
* If we don't have a place to send ignore the packet
|
||||||
*/
|
*/
|
||||||
if (!upstream) {
|
if (!upstream) {
|
||||||
upstream = pim_upstream_add(
|
upstream = pim_upstream_add(
|
||||||
pim_ifp->pim, &sg, ifp,
|
pim, &sg, ifp,
|
||||||
PIM_UPSTREAM_FLAG_MASK_SRC_STREAM, __func__,
|
PIM_UPSTREAM_FLAG_MASK_SRC_STREAM, __func__,
|
||||||
NULL);
|
NULL);
|
||||||
if (!upstream) {
|
if (!upstream) {
|
||||||
@ -452,9 +450,8 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((upstream->sptbit == PIM_UPSTREAM_SPTBIT_TRUE)
|
if ((upstream->sptbit == PIM_UPSTREAM_SPTBIT_TRUE)
|
||||||
|| ((SwitchToSptDesiredOnRp(pim_ifp->pim, &sg))
|
|| ((SwitchToSptDesiredOnRp(pim, &sg))
|
||||||
&& pim_upstream_inherited_olist(pim_ifp->pim, upstream)
|
&& pim_upstream_inherited_olist(pim, upstream) == 0)) {
|
||||||
== 0)) {
|
|
||||||
pim_register_stop_send(ifp, &sg, dest_addr, src_addr);
|
pim_register_stop_send(ifp, &sg, dest_addr, src_addr);
|
||||||
sentRegisterStop = 1;
|
sentRegisterStop = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -463,15 +460,13 @@ int pim_register_recv(struct interface *ifp, struct in_addr dest_addr,
|
|||||||
upstream->sptbit);
|
upstream->sptbit);
|
||||||
}
|
}
|
||||||
if ((upstream->sptbit == PIM_UPSTREAM_SPTBIT_TRUE)
|
if ((upstream->sptbit == PIM_UPSTREAM_SPTBIT_TRUE)
|
||||||
|| (SwitchToSptDesiredOnRp(pim_ifp->pim, &sg))) {
|
|| (SwitchToSptDesiredOnRp(pim, &sg))) {
|
||||||
if (sentRegisterStop) {
|
if (sentRegisterStop) {
|
||||||
pim_upstream_keep_alive_timer_start(
|
pim_upstream_keep_alive_timer_start(
|
||||||
upstream,
|
upstream, pim->rp_keep_alive_time);
|
||||||
pim_ifp->pim->rp_keep_alive_time);
|
|
||||||
} else {
|
} else {
|
||||||
pim_upstream_keep_alive_timer_start(
|
pim_upstream_keep_alive_timer_start(
|
||||||
upstream,
|
upstream, pim->keep_alive_time);
|
||||||
pim_ifp->pim->keep_alive_time);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user