mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-28 21:20:48 +00:00
pimd: Refactor s,g information to struct prefix in pim_upstream.h
This change allows us to pass the (s,g) state around as a prefix. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
99064df9e3
commit
05e451f828
@ -987,8 +987,8 @@ static void pim_show_upstream(struct vty *vty)
|
||||
char uptime[10];
|
||||
char join_timer[10];
|
||||
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
pim_inet4_dump("<src?>", up->sg.u.sg.src, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->sg.u.sg.grp, grp_str, sizeof(grp_str));
|
||||
pim_time_uptime(uptime, sizeof(uptime), now - up->state_transition);
|
||||
pim_time_timer_to_hhmmss(join_timer, sizeof(join_timer), up->t_join_timer);
|
||||
|
||||
@ -1028,8 +1028,8 @@ static void pim_show_join_desired(struct vty *vty)
|
||||
for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_ifchannel_list, chnode, ch)) {
|
||||
struct pim_upstream *up = ch->upstream;
|
||||
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
pim_inet4_dump("<src?>", up->sg.u.sg.src, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->sg.u.sg.grp, grp_str, sizeof(grp_str));
|
||||
|
||||
vty_out(vty, "%-9s %-15s %-15s %-10s %-5s %-10s %-11s %-6s%s",
|
||||
ifp->name,
|
||||
@ -1064,8 +1064,8 @@ static void pim_show_upstream_rpf(struct vty *vty)
|
||||
|
||||
rpf = &up->rpf;
|
||||
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
pim_inet4_dump("<src?>", up->sg.u.sg.src, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->sg.u.sg.grp, grp_str, sizeof(grp_str));
|
||||
pim_inet4_dump("<nexthop?>", rpf->source_nexthop.mrib_nexthop_addr, rpf_nexthop_str, sizeof(rpf_nexthop_str));
|
||||
pim_inet4_dump("<rpf?>", rpf->rpf_addr, rpf_addr_str, sizeof(rpf_addr_str));
|
||||
|
||||
@ -1141,8 +1141,8 @@ static void pim_show_rpf(struct vty *vty)
|
||||
const char *rpf_ifname;
|
||||
struct pim_rpf *rpf = &up->rpf;
|
||||
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
pim_inet4_dump("<src?>", up->sg.u.sg.src, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->sg.u.sg.grp, grp_str, sizeof(grp_str));
|
||||
pim_inet4_dump("<rpf?>", rpf->rpf_addr, rpf_addr_str, sizeof(rpf_addr_str));
|
||||
pim_inet4_dump("<nexthop?>", rpf->source_nexthop.mrib_nexthop_addr, rib_nexthop_str, sizeof(rib_nexthop_str));
|
||||
|
||||
|
@ -383,8 +383,7 @@ static int on_ifjoin_prune_pending_timer(struct thread *t)
|
||||
int send_prune_echo; /* boolean */
|
||||
struct interface *ifp;
|
||||
struct pim_interface *pim_ifp;
|
||||
struct in_addr ch_source;
|
||||
struct in_addr ch_group;
|
||||
struct prefix sg;
|
||||
|
||||
zassert(t);
|
||||
ch = THREAD_ARG(t);
|
||||
@ -400,15 +399,14 @@ static int on_ifjoin_prune_pending_timer(struct thread *t)
|
||||
send_prune_echo = (listcount(pim_ifp->pim_neighbor_list) > 1);
|
||||
|
||||
/* Save (S,G) */
|
||||
ch_source = ch->sg.u.sg.src;
|
||||
ch_group = ch->sg.u.sg.grp;
|
||||
sg = ch->sg;
|
||||
|
||||
ifjoin_to_noinfo(ch);
|
||||
/* from here ch may have been deleted */
|
||||
|
||||
if (send_prune_echo)
|
||||
pim_joinprune_send (ifp, pim_ifp->primary_address,
|
||||
ch_source, ch_group, 0);
|
||||
&sg, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -272,8 +272,7 @@ int pim_joinprune_recv(struct interface *ifp,
|
||||
|
||||
int pim_joinprune_send(struct interface *ifp,
|
||||
struct in_addr upstream_addr,
|
||||
struct in_addr source_addr,
|
||||
struct in_addr group_addr,
|
||||
struct prefix *sg,
|
||||
int send_join)
|
||||
{
|
||||
struct pim_interface *pim_ifp;
|
||||
@ -295,30 +294,22 @@ int pim_joinprune_send(struct interface *ifp,
|
||||
}
|
||||
|
||||
if (PIM_DEBUG_PIM_TRACE) {
|
||||
char source_str[100];
|
||||
char group_str[100];
|
||||
char dst_str[100];
|
||||
pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str));
|
||||
pim_inet4_dump("<grp?>", group_addr, group_str, sizeof(group_str));
|
||||
pim_inet4_dump("<dst?>", upstream_addr, dst_str, sizeof(dst_str));
|
||||
zlog_debug("%s: sending %s(S,G)=(%s,%s) to upstream=%s on interface %s",
|
||||
zlog_debug("%s: sending %s(S,G)=%s to upstream=%s on interface %s",
|
||||
__PRETTY_FUNCTION__,
|
||||
send_join ? "Join" : "Prune",
|
||||
source_str, group_str, dst_str, ifp->name);
|
||||
pim_str_sg_dump (sg), dst_str, ifp->name);
|
||||
}
|
||||
|
||||
if (PIM_INADDR_IS_ANY(upstream_addr)) {
|
||||
if (PIM_DEBUG_PIM_TRACE) {
|
||||
char source_str[100];
|
||||
char group_str[100];
|
||||
char dst_str[100];
|
||||
pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str));
|
||||
pim_inet4_dump("<grp?>", group_addr, group_str, sizeof(group_str));
|
||||
pim_inet4_dump("<dst?>", upstream_addr, dst_str, sizeof(dst_str));
|
||||
zlog_debug("%s: %s(S,G)=(%s,%s): upstream=%s is myself on interface %s",
|
||||
zlog_debug("%s: %s(S,G)=%s: upstream=%s is myself on interface %s",
|
||||
__PRETTY_FUNCTION__,
|
||||
send_join ? "Join" : "Prune",
|
||||
source_str, group_str, dst_str, ifp->name);
|
||||
pim_str_sg_dump (sg), dst_str, ifp->name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -368,10 +359,10 @@ int pim_joinprune_send(struct interface *ifp,
|
||||
remain = pastend - pim_msg_curr;
|
||||
pim_msg_curr = pim_msg_addr_encode_ipv4_group(pim_msg_curr,
|
||||
remain,
|
||||
group_addr);
|
||||
sg->u.sg.grp);
|
||||
if (!pim_msg_curr) {
|
||||
char group_str[100];
|
||||
pim_inet4_dump("<grp?>", group_addr, group_str, sizeof(group_str));
|
||||
pim_inet4_dump("<grp?>", sg->u.sg.grp, group_str, sizeof(group_str));
|
||||
zlog_warn("%s: failure encoding group address %s: space left=%d",
|
||||
__PRETTY_FUNCTION__, group_str, remain);
|
||||
return -5;
|
||||
@ -397,10 +388,10 @@ int pim_joinprune_send(struct interface *ifp,
|
||||
remain = pastend - pim_msg_curr;
|
||||
pim_msg_curr = pim_msg_addr_encode_ipv4_source(pim_msg_curr,
|
||||
remain,
|
||||
source_addr);
|
||||
sg->u.sg.src);
|
||||
if (!pim_msg_curr) {
|
||||
char source_str[100];
|
||||
pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str));
|
||||
pim_inet4_dump("<src?>", sg->u.sg.src, source_str, sizeof(source_str));
|
||||
zlog_warn("%s: failure encoding source address %s: space left=%d",
|
||||
__PRETTY_FUNCTION__, source_str, remain);
|
||||
return -7;
|
||||
|
@ -36,8 +36,7 @@ int pim_joinprune_recv(struct interface *ifp,
|
||||
|
||||
int pim_joinprune_send(struct interface *ifp,
|
||||
struct in_addr upstream_addr,
|
||||
struct in_addr source_addr,
|
||||
struct in_addr group_addr,
|
||||
struct prefix *sg,
|
||||
int send_join);
|
||||
|
||||
#endif /* PIM_JOIN_H */
|
||||
|
@ -97,6 +97,7 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
|
||||
struct pim_ifchannel *ch;
|
||||
struct pim_upstream *up;
|
||||
struct pim_rpf *rpg;
|
||||
struct prefix sg;
|
||||
|
||||
rpg = RP(msg->im_dst);
|
||||
/*
|
||||
@ -127,6 +128,8 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
|
||||
__PRETTY_FUNCTION__, grp_str, src_str);
|
||||
}
|
||||
|
||||
sg.u.sg.src = msg->im_src;
|
||||
sg.u.sg.grp = msg->im_dst;
|
||||
up = pim_upstream_add(msg->im_src, msg->im_dst, ifp);
|
||||
if (!up) {
|
||||
if (PIM_DEBUG_PIM_TRACE) {
|
||||
@ -139,8 +142,7 @@ pim_mroute_msg_nocache (int fd, struct interface *ifp, const struct igmpmsg *msg
|
||||
|
||||
pim_upstream_keep_alive_timer_start (up, PIM_KEEPALIVE_PERIOD);
|
||||
|
||||
up->channel_oil = pim_channel_oil_add(msg->im_dst,
|
||||
msg->im_src,
|
||||
up->channel_oil = pim_channel_oil_add(&sg,
|
||||
pim_ifp->mroute_vif_index);
|
||||
if (!up->channel_oil) {
|
||||
if (PIM_DEBUG_PIM_TRACE) {
|
||||
|
@ -50,8 +50,7 @@ static void pim_channel_oil_delete(struct channel_oil *c_oil)
|
||||
pim_channel_oil_free(c_oil);
|
||||
}
|
||||
|
||||
static struct channel_oil *channel_oil_new(struct in_addr group_addr,
|
||||
struct in_addr source_addr,
|
||||
static struct channel_oil *channel_oil_new(struct prefix *sg,
|
||||
int input_vif_index)
|
||||
{
|
||||
struct channel_oil *c_oil;
|
||||
@ -60,13 +59,9 @@ static struct channel_oil *channel_oil_new(struct in_addr group_addr,
|
||||
ifp_in = pim_if_find_by_vif_index(input_vif_index);
|
||||
if (!ifp_in) {
|
||||
/* warning only */
|
||||
char group_str[100];
|
||||
char source_str[100];
|
||||
pim_inet4_dump("<group?>", group_addr, group_str, sizeof(group_str));
|
||||
pim_inet4_dump("<source?>", source_addr, source_str, sizeof(source_str));
|
||||
zlog_warn("%s: (S,G)=(%s,%s) could not find input interface for input_vif_index=%d",
|
||||
zlog_warn("%s: (S,G)=%s could not find input interface for input_vif_index=%d",
|
||||
__PRETTY_FUNCTION__,
|
||||
source_str, group_str, input_vif_index);
|
||||
pim_str_sg_dump (sg), input_vif_index);
|
||||
}
|
||||
|
||||
c_oil = XCALLOC(MTYPE_PIM_CHANNEL_OIL, sizeof(*c_oil));
|
||||
@ -75,8 +70,8 @@ static struct channel_oil *channel_oil_new(struct in_addr group_addr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
c_oil->oil.mfcc_mcastgrp = group_addr;
|
||||
c_oil->oil.mfcc_origin = source_addr;
|
||||
c_oil->oil.mfcc_mcastgrp = sg->u.sg.grp;
|
||||
c_oil->oil.mfcc_origin = sg->u.sg.src;
|
||||
c_oil->oil.mfcc_parent = input_vif_index;
|
||||
c_oil->oil_ref_count = 1;
|
||||
c_oil->installed = 0;
|
||||
@ -86,13 +81,12 @@ static struct channel_oil *channel_oil_new(struct in_addr group_addr,
|
||||
return c_oil;
|
||||
}
|
||||
|
||||
static struct channel_oil *pim_add_channel_oil(struct in_addr group_addr,
|
||||
struct in_addr source_addr,
|
||||
static struct channel_oil *pim_add_channel_oil(struct prefix *sg,
|
||||
int input_vif_index)
|
||||
{
|
||||
struct channel_oil *c_oil;
|
||||
|
||||
c_oil = channel_oil_new(group_addr, source_addr, input_vif_index);
|
||||
c_oil = channel_oil_new(sg, input_vif_index);
|
||||
if (!c_oil) {
|
||||
zlog_warn("PIM XCALLOC(%zu) failure", sizeof(*c_oil));
|
||||
return 0;
|
||||
@ -103,34 +97,32 @@ static struct channel_oil *pim_add_channel_oil(struct in_addr group_addr,
|
||||
return c_oil;
|
||||
}
|
||||
|
||||
static struct channel_oil *pim_find_channel_oil(struct in_addr group_addr,
|
||||
struct in_addr source_addr)
|
||||
static struct channel_oil *pim_find_channel_oil(struct prefix *sg)
|
||||
{
|
||||
struct listnode *node;
|
||||
struct channel_oil *c_oil;
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO(qpim_channel_oil_list, node, c_oil)) {
|
||||
if ((group_addr.s_addr == c_oil->oil.mfcc_mcastgrp.s_addr) &&
|
||||
(source_addr.s_addr == c_oil->oil.mfcc_origin.s_addr))
|
||||
if ((sg->u.sg.grp.s_addr == c_oil->oil.mfcc_mcastgrp.s_addr) &&
|
||||
(sg->u.sg.src.s_addr == c_oil->oil.mfcc_origin.s_addr))
|
||||
return c_oil;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct channel_oil *pim_channel_oil_add(struct in_addr group_addr,
|
||||
struct in_addr source_addr,
|
||||
struct channel_oil *pim_channel_oil_add(struct prefix *sg,
|
||||
int input_vif_index)
|
||||
{
|
||||
struct channel_oil *c_oil;
|
||||
|
||||
c_oil = pim_find_channel_oil(group_addr, source_addr);
|
||||
c_oil = pim_find_channel_oil(sg);
|
||||
if (c_oil) {
|
||||
++c_oil->oil_ref_count;
|
||||
return c_oil;
|
||||
}
|
||||
|
||||
return pim_add_channel_oil(group_addr, source_addr, input_vif_index);
|
||||
return pim_add_channel_oil(sg, input_vif_index);
|
||||
}
|
||||
|
||||
void pim_channel_oil_del(struct channel_oil *c_oil)
|
||||
|
@ -79,8 +79,7 @@ struct channel_oil {
|
||||
};
|
||||
|
||||
void pim_channel_oil_free(struct channel_oil *c_oil);
|
||||
struct channel_oil *pim_channel_oil_add(struct in_addr group_addr,
|
||||
struct in_addr source_addr,
|
||||
struct channel_oil *pim_channel_oil_add(struct prefix *sg,
|
||||
int input_vif_index);
|
||||
void pim_channel_oil_del(struct channel_oil *c_oil);
|
||||
|
||||
|
@ -347,7 +347,7 @@ pim_register_recv (struct interface *ifp,
|
||||
pim_nexthop_lookup (&upstream->rpf.source_nexthop,
|
||||
upstream->upstream_addr, NULL);
|
||||
upstream->rpf.source_nexthop.interface = ifp;
|
||||
upstream->source_addr.s_addr = source.s_addr;
|
||||
upstream->sg.u.sg.src.s_addr = source.s_addr;
|
||||
upstream->rpf.rpf_addr = upstream->rpf.source_nexthop.mrib_nexthop_addr;
|
||||
upstream->channel_oil->oil.mfcc_origin = source;
|
||||
pim_scan_individual_oil (upstream->channel_oil);
|
||||
|
@ -151,13 +151,9 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up,
|
||||
rpf->rpf_addr = pim_rpf_find_rpf_addr(up);
|
||||
if (PIM_INADDR_IS_ANY(rpf->rpf_addr) && PIM_DEBUG_PIM_EVENTS) {
|
||||
/* RPF'(S,G) not found */
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
zlog_debug("%s %s: RPF'(%s,%s) not found: won't send join upstream",
|
||||
zlog_debug("%s %s: RPF'%s not found: won't send join upstream",
|
||||
__FILE__, __PRETTY_FUNCTION__,
|
||||
src_str, grp_str);
|
||||
pim_str_sg_dump (&up->sg));
|
||||
/* warning only */
|
||||
}
|
||||
|
||||
@ -165,15 +161,11 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up,
|
||||
if (nexthop_mismatch(&rpf->source_nexthop, &save_nexthop)) {
|
||||
|
||||
if (PIM_DEBUG_PIM_EVENTS) {
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
char nhaddr_str[100];
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
pim_inet4_dump("<addr?>", rpf->source_nexthop.mrib_nexthop_addr, nhaddr_str, sizeof(nhaddr_str));
|
||||
zlog_debug("%s %s: (S,G)=(%s,%s) source nexthop now is: interface=%s address=%s pref=%d metric=%d",
|
||||
zlog_debug("%s %s: (S,G)=%s source nexthop now is: interface=%s address=%s pref=%d metric=%d",
|
||||
__FILE__, __PRETTY_FUNCTION__,
|
||||
src_str, grp_str,
|
||||
pim_str_sg_dump (&up->sg),
|
||||
rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<ifname?>",
|
||||
nhaddr_str,
|
||||
rpf->source_nexthop.mrib_metric_preference,
|
||||
@ -189,13 +181,9 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up,
|
||||
if (save_nexthop.interface != rpf->source_nexthop.interface) {
|
||||
|
||||
if (PIM_DEBUG_PIM_EVENTS) {
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
zlog_debug("%s %s: (S,G)=(%s,%s) RPF_interface(S) changed from %s to %s",
|
||||
zlog_debug("%s %s: (S,G)=%s RPF_interface(S) changed from %s to %s",
|
||||
__FILE__, __PRETTY_FUNCTION__,
|
||||
src_str, grp_str,
|
||||
pim_str_sg_dump (&up->sg),
|
||||
save_nexthop.interface ? save_nexthop.interface->name : "<oldif?>",
|
||||
rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<newif?>");
|
||||
/* warning only */
|
||||
@ -239,20 +227,16 @@ static struct in_addr pim_rpf_find_rpf_addr(struct pim_upstream *up)
|
||||
struct in_addr rpf_addr;
|
||||
|
||||
if (!up->rpf.source_nexthop.interface) {
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
zlog_warn("%s: missing RPF interface for upstream (S,G)=(%s,%s)",
|
||||
zlog_warn("%s: missing RPF interface for upstream (S,G)=%s",
|
||||
__PRETTY_FUNCTION__,
|
||||
src_str, grp_str);
|
||||
pim_str_sg_dump (&up->sg));
|
||||
|
||||
rpf_addr.s_addr = PIM_NET_INADDR_ANY;
|
||||
return rpf_addr;
|
||||
}
|
||||
|
||||
rpf_ch = pim_ifchannel_find(up->rpf.source_nexthop.interface,
|
||||
up->source_addr, up->group_addr);
|
||||
up->sg.u.sg.src, up->sg.u.sg.grp);
|
||||
if (rpf_ch) {
|
||||
if (rpf_ch->ifassert_state == PIM_IFASSERT_I_AM_LOSER) {
|
||||
return rpf_ch->ifassert_winner;
|
||||
|
@ -86,19 +86,15 @@ void
|
||||
pim_upstream_send_join (struct pim_upstream *up)
|
||||
{
|
||||
if (PIM_DEBUG_PIM_TRACE) {
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
char rpf_str[100];
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
pim_inet4_dump("<rpf?>", up->rpf.rpf_addr, rpf_str, sizeof(rpf_str));
|
||||
zlog_debug ("%s: RPF'(%s,%s)=%s(%s) for Interface %s", __PRETTY_FUNCTION__,
|
||||
src_str, grp_str, rpf_str, pim_upstream_state2str (up),
|
||||
zlog_debug ("%s: RPF'%s=%s(%s) for Interface %s", __PRETTY_FUNCTION__,
|
||||
pim_str_sg_dump (&up->sg), rpf_str, pim_upstream_state2str (up),
|
||||
up->rpf.source_nexthop.interface->name);
|
||||
if (PIM_INADDR_IS_ANY(up->rpf.rpf_addr)) {
|
||||
zlog_debug("%s: can't send join upstream: RPF'(%s,%s)=%s",
|
||||
zlog_debug("%s: can't send join upstream: RPF'%s=%s",
|
||||
__PRETTY_FUNCTION__,
|
||||
src_str, grp_str, rpf_str);
|
||||
pim_str_sg_dump (&up->sg), rpf_str);
|
||||
/* warning only */
|
||||
}
|
||||
}
|
||||
@ -114,8 +110,7 @@ pim_upstream_send_join (struct pim_upstream *up)
|
||||
/* send Join(S,G) to the current upstream neighbor */
|
||||
pim_joinprune_send(up->rpf.source_nexthop.interface,
|
||||
up->rpf.rpf_addr,
|
||||
up->source_addr,
|
||||
up->group_addr,
|
||||
&up->sg,
|
||||
1 /* join */);
|
||||
}
|
||||
|
||||
@ -138,14 +133,10 @@ static int on_join_timer(struct thread *t)
|
||||
static void join_timer_start(struct pim_upstream *up)
|
||||
{
|
||||
if (PIM_DEBUG_PIM_EVENTS) {
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
zlog_debug("%s: starting %d sec timer for upstream (S,G)=(%s,%s)",
|
||||
zlog_debug("%s: starting %d sec timer for upstream (S,G)=%s",
|
||||
__PRETTY_FUNCTION__,
|
||||
qpim_t_periodic,
|
||||
src_str, grp_str);
|
||||
pim_str_sg_dump (&up->sg));
|
||||
}
|
||||
|
||||
zassert(!up->t_join_timer);
|
||||
@ -165,14 +156,10 @@ static void pim_upstream_join_timer_restart_msec(struct pim_upstream *up,
|
||||
int interval_msec)
|
||||
{
|
||||
if (PIM_DEBUG_PIM_EVENTS) {
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
zlog_debug("%s: restarting %d msec timer for upstream (S,G)=(%s,%s)",
|
||||
zlog_debug("%s: restarting %d msec timer for upstream (S,G)=%s",
|
||||
__PRETTY_FUNCTION__,
|
||||
interval_msec,
|
||||
src_str, grp_str);
|
||||
pim_str_sg_dump (&up->sg));
|
||||
}
|
||||
|
||||
THREAD_OFF(up->t_join_timer);
|
||||
@ -194,28 +181,20 @@ void pim_upstream_join_suppress(struct pim_upstream *up,
|
||||
join_timer_remain_msec = pim_time_timer_remain_msec(up->t_join_timer);
|
||||
|
||||
if (PIM_DEBUG_PIM_TRACE) {
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
char rpf_str[100];
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
pim_inet4_dump("<rpf?>", rpf_addr, rpf_str, sizeof(rpf_str));
|
||||
zlog_debug("%s %s: detected Join(%s,%s) to RPF'(S,G)=%s: join_timer=%ld msec t_joinsuppress=%ld msec",
|
||||
zlog_debug("%s %s: detected Join%s to RPF'(S,G)=%s: join_timer=%ld msec t_joinsuppress=%ld msec",
|
||||
__FILE__, __PRETTY_FUNCTION__,
|
||||
src_str, grp_str,
|
||||
pim_str_sg_dump (&up->sg),
|
||||
rpf_str,
|
||||
join_timer_remain_msec, t_joinsuppress_msec);
|
||||
}
|
||||
|
||||
if (join_timer_remain_msec < t_joinsuppress_msec) {
|
||||
if (PIM_DEBUG_PIM_TRACE) {
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
zlog_debug("%s %s: suppressing Join(S,G)=(%s,%s) for %ld msec",
|
||||
zlog_debug("%s %s: suppressing Join(S,G)=%s for %ld msec",
|
||||
__FILE__, __PRETTY_FUNCTION__,
|
||||
src_str, grp_str, t_joinsuppress_msec);
|
||||
pim_str_sg_dump (&up->sg), t_joinsuppress_msec);
|
||||
}
|
||||
|
||||
pim_upstream_join_timer_restart_msec(up, t_joinsuppress_msec);
|
||||
@ -233,27 +212,19 @@ void pim_upstream_join_timer_decrease_to_t_override(const char *debug_label,
|
||||
t_override_msec = pim_if_t_override_msec(up->rpf.source_nexthop.interface);
|
||||
|
||||
if (PIM_DEBUG_PIM_TRACE) {
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
char rpf_str[100];
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
pim_inet4_dump("<rpf?>", rpf_addr, rpf_str, sizeof(rpf_str));
|
||||
zlog_debug("%s: to RPF'(%s,%s)=%s: join_timer=%ld msec t_override=%d msec",
|
||||
zlog_debug("%s: to RPF'%s=%s: join_timer=%ld msec t_override=%d msec",
|
||||
debug_label,
|
||||
src_str, grp_str, rpf_str,
|
||||
pim_str_sg_dump (&up->sg), rpf_str,
|
||||
join_timer_remain_msec, t_override_msec);
|
||||
}
|
||||
|
||||
if (join_timer_remain_msec > t_override_msec) {
|
||||
if (PIM_DEBUG_PIM_TRACE) {
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
zlog_debug("%s: decreasing (S,G)=(%s,%s) join timer to t_override=%d msec",
|
||||
zlog_debug("%s: decreasing (S,G)=%s join timer to t_override=%d msec",
|
||||
debug_label,
|
||||
src_str, grp_str,
|
||||
pim_str_sg_dump (&up->sg),
|
||||
t_override_msec);
|
||||
}
|
||||
|
||||
@ -330,14 +301,10 @@ pim_upstream_switch(struct pim_upstream *up,
|
||||
up->state_transition = pim_time_monotonic_sec();
|
||||
|
||||
if (PIM_DEBUG_PIM_EVENTS) {
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
zlog_debug("%s: PIM_UPSTREAM_%s: (S,G)=(%s,%s)",
|
||||
zlog_debug("%s: PIM_UPSTREAM_%s: (S,G)=%s",
|
||||
__PRETTY_FUNCTION__,
|
||||
((new_state == PIM_UPSTREAM_JOINED) ? "JOINED" : "NOTJOINED"),
|
||||
src_str, grp_str);
|
||||
pim_str_sg_dump (&up->sg));
|
||||
}
|
||||
|
||||
pim_upstream_update_assert_tracking_desired(up);
|
||||
@ -351,8 +318,7 @@ pim_upstream_switch(struct pim_upstream *up,
|
||||
forward_off(up);
|
||||
pim_joinprune_send(up->rpf.source_nexthop.interface,
|
||||
up->rpf.rpf_addr,
|
||||
up->source_addr,
|
||||
up->group_addr,
|
||||
&up->sg,
|
||||
0 /* prune */);
|
||||
if (up->t_join_timer)
|
||||
THREAD_OFF(up->t_join_timer);
|
||||
@ -373,7 +339,7 @@ static struct pim_upstream *pim_upstream_new(struct in_addr source_addr,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
up->source_addr = source_addr;
|
||||
up->sg.u.sg.src = source_addr;
|
||||
if (!pim_rp_set_upstream_addr (&up->upstream_addr, source_addr))
|
||||
{
|
||||
if (PIM_DEBUG_PIM_TRACE)
|
||||
@ -383,7 +349,7 @@ static struct pim_upstream *pim_upstream_new(struct in_addr source_addr,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
up->group_addr = group_addr;
|
||||
up->sg.u.sg.grp = group_addr;
|
||||
up->flags = 0;
|
||||
up->ref_count = 1;
|
||||
up->t_join_timer = NULL;
|
||||
@ -418,9 +384,9 @@ struct pim_upstream *pim_upstream_find(struct in_addr source_addr,
|
||||
struct pim_upstream *up;
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO(qpim_upstream_list, up_node, up)) {
|
||||
if (group_addr.s_addr == up->group_addr.s_addr) {
|
||||
if ((up->source_addr.s_addr == INADDR_ANY) ||
|
||||
(source_addr.s_addr == up->source_addr.s_addr)) {
|
||||
if (group_addr.s_addr == up->sg.u.sg.grp.s_addr) {
|
||||
if ((up->sg.u.sg.src.s_addr == INADDR_ANY) ||
|
||||
(source_addr.s_addr == up->sg.u.sg.src.s_addr)) {
|
||||
return up;
|
||||
}
|
||||
}
|
||||
@ -563,16 +529,12 @@ void pim_upstream_rpf_genid_changed(struct in_addr neigh_addr)
|
||||
|
||||
if (PIM_DEBUG_PIM_TRACE) {
|
||||
char neigh_str[100];
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
char rpf_addr_str[100];
|
||||
pim_inet4_dump("<neigh?>", neigh_addr, neigh_str, sizeof(neigh_str));
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
pim_inet4_dump("<rpf?>", up->rpf.rpf_addr, rpf_addr_str, sizeof(rpf_addr_str));
|
||||
zlog_debug("%s: matching neigh=%s against upstream (S,G)=(%s,%s) joined=%d rpf_addr=%s",
|
||||
zlog_debug("%s: matching neigh=%s against upstream (S,G)=%s joined=%d rpf_addr=%s",
|
||||
__PRETTY_FUNCTION__,
|
||||
neigh_str, src_str, grp_str,
|
||||
neigh_str, pim_str_sg_dump (&up->sg),
|
||||
up->join_state == PIM_UPSTREAM_JOINED,
|
||||
rpf_addr_str);
|
||||
}
|
||||
@ -726,9 +688,9 @@ pim_upstream_keep_alive_timer (struct thread *t)
|
||||
|
||||
up = THREAD_ARG(t);
|
||||
|
||||
if (I_am_RP (up->group_addr))
|
||||
if (I_am_RP (up->sg.u.sg.grp))
|
||||
{
|
||||
pim_br_clear_pmbr (up->source_addr, up->group_addr);
|
||||
pim_br_clear_pmbr (up->sg.u.sg.src, up->sg.u.sg.grp);
|
||||
/*
|
||||
* We need to do more here :)
|
||||
* But this is the start.
|
||||
@ -830,13 +792,8 @@ pim_upstream_register_stop_timer (struct thread *t)
|
||||
|
||||
if (PIM_DEBUG_TRACE)
|
||||
{
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
zlog_debug ("%s: (S,G)=(%s,%s) upstream register stop timer %d",
|
||||
__PRETTY_FUNCTION__, src_str, grp_str, up->join_state);
|
||||
zlog_debug ("%s: (S,G)=%s upstream register stop timer %d",
|
||||
__PRETTY_FUNCTION__, pim_str_sg_dump (&up->sg), up->join_state);
|
||||
}
|
||||
|
||||
switch (up->join_state)
|
||||
@ -848,13 +805,13 @@ pim_upstream_register_stop_timer (struct thread *t)
|
||||
up->join_state = PIM_UPSTREAM_JOIN_PENDING;
|
||||
pim_upstream_start_register_stop_timer (up, 1);
|
||||
|
||||
rpg = RP (up->group_addr);
|
||||
rpg = RP (up->sg.u.sg.grp);
|
||||
memset (&ip_hdr, 0, sizeof (struct ip));
|
||||
ip_hdr.ip_p = PIM_IP_PROTO_PIM;
|
||||
ip_hdr.ip_hl = 5;
|
||||
ip_hdr.ip_v = 4;
|
||||
ip_hdr.ip_src = up->source_addr;
|
||||
ip_hdr.ip_dst = up->group_addr;
|
||||
ip_hdr.ip_src = up->sg.u.sg.src;
|
||||
ip_hdr.ip_dst = up->sg.u.sg.grp;
|
||||
ip_hdr.ip_len = 20;
|
||||
// checksum is broken
|
||||
pim_register_send ((uint8_t *)&ip_hdr, sizeof (struct ip), rpg, 1);
|
||||
@ -889,13 +846,8 @@ pim_upstream_start_register_stop_timer (struct pim_upstream *up, int null_regist
|
||||
|
||||
if (PIM_DEBUG_TRACE)
|
||||
{
|
||||
char src_str[100];
|
||||
char grp_str[100];
|
||||
|
||||
pim_inet4_dump("<src?>", up->source_addr, src_str, sizeof(src_str));
|
||||
pim_inet4_dump("<grp?>", up->group_addr, grp_str, sizeof(grp_str));
|
||||
zlog_debug ("%s: (S,G)=(%s,%s) Starting upstream register stop timer %d",
|
||||
__PRETTY_FUNCTION__, src_str, grp_str, time);
|
||||
zlog_debug ("%s: (S,G)=%s Starting upstream register stop timer %d",
|
||||
__PRETTY_FUNCTION__, pim_str_sg_dump (&up->sg), time);
|
||||
}
|
||||
THREAD_TIMER_ON (master, up->t_rs_timer,
|
||||
pim_upstream_register_stop_timer,
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define PIM_UPSTREAM_H
|
||||
|
||||
#include <zebra.h>
|
||||
#include <prefix.h>
|
||||
|
||||
#define PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED (1 << 0)
|
||||
#define PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED (2 << 0)
|
||||
@ -89,8 +90,9 @@ enum pim_upstream_sptbit {
|
||||
struct pim_upstream {
|
||||
int fhr;
|
||||
struct in_addr upstream_addr;/* Who we are talking to */
|
||||
struct in_addr source_addr; /* (S,G) source key */
|
||||
struct in_addr group_addr; /* (S,G) group key */
|
||||
struct prefix sg;
|
||||
//struct in_addr source_addr; /* (S,G) source key */
|
||||
//struct in_addr group_addr; /* (S,G) group key */
|
||||
uint32_t flags;
|
||||
struct channel_oil *channel_oil;
|
||||
|
||||
|
@ -360,15 +360,13 @@ static void scan_upstream_rpf_cache()
|
||||
/* send Prune(S,G) to the old upstream neighbor */
|
||||
pim_joinprune_send(up->rpf.source_nexthop.interface,
|
||||
old_rpf_addr,
|
||||
up->source_addr,
|
||||
up->group_addr,
|
||||
&up->sg,
|
||||
0 /* prune */);
|
||||
|
||||
/* send Join(S,G) to the current upstream neighbor */
|
||||
pim_joinprune_send(up->rpf.source_nexthop.interface,
|
||||
up->rpf.rpf_addr,
|
||||
up->source_addr,
|
||||
up->group_addr,
|
||||
&up->sg,
|
||||
1 /* join */);
|
||||
|
||||
pim_upstream_join_timer_restart(up);
|
||||
@ -951,16 +949,16 @@ static int del_oif(struct channel_oil *channel_oil,
|
||||
void igmp_source_forward_start(struct igmp_source *source)
|
||||
{
|
||||
struct igmp_group *group;
|
||||
struct prefix sg;
|
||||
int result;
|
||||
|
||||
sg.u.sg.src = source->source_addr;
|
||||
sg.u.sg.grp = source->source_group->group_addr;
|
||||
|
||||
if (PIM_DEBUG_IGMP_TRACE) {
|
||||
char source_str[100];
|
||||
char group_str[100];
|
||||
pim_inet4_dump("<source?>", source->source_addr, source_str, sizeof(source_str));
|
||||
pim_inet4_dump("<group?>", source->source_group->group_addr, group_str, sizeof(group_str));
|
||||
zlog_debug("%s: (S,G)=(%s,%s) igmp_sock=%d oif=%s fwd=%d",
|
||||
zlog_debug("%s: (S,G)=%s igmp_sock=%d oif=%s fwd=%d",
|
||||
__PRETTY_FUNCTION__,
|
||||
source_str, group_str,
|
||||
pim_str_sg_dump (&sg),
|
||||
source->source_group->group_igmp_sock->fd,
|
||||
source->source_group->group_igmp_sock->interface->name,
|
||||
IGMP_SOURCE_TEST_FORWARDING(source->source_flags));
|
||||
@ -1013,13 +1011,9 @@ void igmp_source_forward_start(struct igmp_source *source)
|
||||
if (input_iface_vif_index == pim_oif->mroute_vif_index) {
|
||||
/* ignore request for looped MFC entry */
|
||||
if (PIM_DEBUG_IGMP_TRACE) {
|
||||
char source_str[100];
|
||||
char group_str[100];
|
||||
pim_inet4_dump("<source?>", source->source_addr, source_str, sizeof(source_str));
|
||||
pim_inet4_dump("<group?>", source->source_group->group_addr, group_str, sizeof(group_str));
|
||||
zlog_debug("%s: ignoring request for looped MFC entry (S,G)=(%s,%s): igmp_sock=%d oif=%s vif_index=%d",
|
||||
zlog_debug("%s: ignoring request for looped MFC entry (S,G)=%s: igmp_sock=%d oif=%s vif_index=%d",
|
||||
__PRETTY_FUNCTION__,
|
||||
source_str, group_str,
|
||||
pim_str_sg_dump (&sg),
|
||||
source->source_group->group_igmp_sock->fd,
|
||||
source->source_group->group_igmp_sock->interface->name,
|
||||
input_iface_vif_index);
|
||||
@ -1027,17 +1021,12 @@ void igmp_source_forward_start(struct igmp_source *source)
|
||||
return;
|
||||
}
|
||||
|
||||
source->source_channel_oil = pim_channel_oil_add(group->group_addr,
|
||||
source->source_addr,
|
||||
source->source_channel_oil = pim_channel_oil_add(&sg,
|
||||
input_iface_vif_index);
|
||||
if (!source->source_channel_oil) {
|
||||
char group_str[100];
|
||||
char source_str[100];
|
||||
pim_inet4_dump("<group?>", group->group_addr, group_str, sizeof(group_str));
|
||||
pim_inet4_dump("<source?>", source->source_addr, source_str, sizeof(source_str));
|
||||
zlog_warn("%s %s: could not create OIL for channel (S,G)=(%s,%s)",
|
||||
zlog_warn("%s %s: could not create OIL for channel (S,G)=%s",
|
||||
__FILE__, __PRETTY_FUNCTION__,
|
||||
source_str, group_str);
|
||||
pim_str_sg_dump (&sg));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1142,23 +1131,19 @@ void pim_forward_start(struct pim_ifchannel *ch)
|
||||
int input_iface_vif_index = fib_lookup_if_vif_index(up->upstream_addr);
|
||||
if (input_iface_vif_index < 1) {
|
||||
char source_str[100];
|
||||
pim_inet4_dump("<source?>", up->source_addr, source_str, sizeof(source_str));
|
||||
pim_inet4_dump("<source?>", up->sg.u.sg.src, source_str, sizeof(source_str));
|
||||
zlog_warn("%s %s: could not find input interface for source %s",
|
||||
__FILE__, __PRETTY_FUNCTION__,
|
||||
source_str);
|
||||
return;
|
||||
}
|
||||
|
||||
up->channel_oil = pim_channel_oil_add(up->group_addr, up->source_addr,
|
||||
up->channel_oil = pim_channel_oil_add(&up->sg,
|
||||
input_iface_vif_index);
|
||||
if (!up->channel_oil) {
|
||||
char group_str[100];
|
||||
char source_str[100];
|
||||
pim_inet4_dump("<group?>", up->group_addr, group_str, sizeof(group_str));
|
||||
pim_inet4_dump("<source?>", up->source_addr, source_str, sizeof(source_str));
|
||||
zlog_warn("%s %s: could not create OIL for channel (S,G)=(%s,%s)",
|
||||
zlog_warn("%s %s: could not create OIL for channel (S,G)=%s",
|
||||
__FILE__, __PRETTY_FUNCTION__,
|
||||
source_str, group_str);
|
||||
pim_str_sg_dump (&up->sg));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1173,23 +1158,15 @@ void pim_forward_stop(struct pim_ifchannel *ch)
|
||||
struct pim_upstream *up = ch->upstream;
|
||||
|
||||
if (PIM_DEBUG_PIM_TRACE) {
|
||||
char source_str[100];
|
||||
char group_str[100];
|
||||
pim_inet4_dump("<source?>", ch->sg.u.sg.src, source_str, sizeof(source_str));
|
||||
pim_inet4_dump("<group?>", ch->sg.u.sg.grp, group_str, sizeof(group_str));
|
||||
zlog_debug("%s: (S,G)=(%s,%s) oif=%s",
|
||||
zlog_debug("%s: (S,G)=%s oif=%s",
|
||||
__PRETTY_FUNCTION__,
|
||||
source_str, group_str, ch->interface->name);
|
||||
pim_str_sg_dump (&ch->sg), ch->interface->name);
|
||||
}
|
||||
|
||||
if (!up->channel_oil) {
|
||||
char source_str[100];
|
||||
char group_str[100];
|
||||
pim_inet4_dump("<source?>", ch->sg.u.sg.src, source_str, sizeof(source_str));
|
||||
pim_inet4_dump("<group?>", ch->sg.u.sg.grp, group_str, sizeof(group_str));
|
||||
zlog_warn("%s: (S,G)=(%s,%s) oif=%s missing channel OIL",
|
||||
__PRETTY_FUNCTION__,
|
||||
source_str, group_str, ch->interface->name);
|
||||
zlog_warn("%s: (S,G)=%s oif=%s missing channel OIL",
|
||||
__PRETTY_FUNCTION__,
|
||||
pim_str_sg_dump(&ch->sg), ch->interface->name);
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user