-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pim6d: (WIP) PIM Zebra Interface changes #10594
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,7 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) | |
pim_ifp = c->ifp->info; | ||
p = c->address; | ||
|
||
#if PIM_IPV == 4 | ||
if (PIM_DEBUG_ZEBRA) { | ||
zlog_debug("%s: %s(%u) connected IP address %pFX flags %u %s", | ||
__func__, c->ifp->name, vrf_id, p, c->flags, | ||
|
@@ -144,7 +145,8 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) | |
if (!CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)) { | ||
/* trying to add primary address */ | ||
|
||
struct in_addr primary_addr = pim_find_primary_addr(c->ifp); | ||
pim_addr primary_addr = pim_find_primary_addr(c->ifp); | ||
|
||
if (p->family != AF_INET | ||
|| primary_addr.s_addr != p->u.prefix4.s_addr) { | ||
if (PIM_DEBUG_ZEBRA) | ||
|
@@ -153,7 +155,9 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) | |
__func__, c->ifp->name, p); | ||
SET_FLAG(c->flags, ZEBRA_IFA_SECONDARY); | ||
} | ||
|
||
} | ||
#endif | ||
|
||
pim_if_addr_add(c); | ||
if (pim_ifp) { | ||
|
@@ -200,6 +204,8 @@ static int pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS) | |
return 0; | ||
|
||
p = c->address; | ||
|
||
#if PIM_IPV == 4 | ||
if (p->family == AF_INET) { | ||
if (PIM_DEBUG_ZEBRA) { | ||
zlog_debug( | ||
|
@@ -214,10 +220,13 @@ static int pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS) | |
#endif | ||
} | ||
|
||
pim_if_addr_del(c, 0); | ||
pim_rp_setup(pim); | ||
pim_i_am_rp_re_evaluate(pim); | ||
} | ||
#endif /* PIM_IPV == 4 */ | ||
|
||
pim_if_addr_del(c, 0); | ||
pim_rp_setup(pim); | ||
pim_i_am_rp_re_evaluate(pim); | ||
|
||
|
||
connected_free(&c); | ||
return 0; | ||
|
@@ -240,7 +249,11 @@ void pim_zebra_update_all_interfaces(struct pim_instance *pim) | |
struct pim_rpf rpf; | ||
|
||
rpf.source_nexthop.interface = ifp; | ||
#if PIM_IPV == 4 | ||
rpf.rpf_addr.u.prefix4 = us->address; | ||
#else | ||
rpf.rpf_addr.u.prefix6 = us->address; | ||
#endif | ||
pim_joinprune_send(&rpf, us->us); | ||
pim_jp_agg_clear_group(us->us); | ||
} | ||
|
@@ -254,8 +267,14 @@ void pim_zebra_upstream_rpf_changed(struct pim_instance *pim, | |
if (old->source_nexthop.interface) { | ||
struct pim_neighbor *nbr; | ||
|
||
#if PIM_IPV == 4 | ||
nbr = pim_neighbor_find(old->source_nexthop.interface, | ||
old->rpf_addr.u.prefix4); | ||
#else | ||
nbr = pim_neighbor_find(old->source_nexthop.interface, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use pim_neighbor_find_prefix() |
||
old->rpf_addr.u.prefix6); | ||
#endif | ||
|
||
if (nbr) | ||
pim_jp_agg_remove_group(nbr->upstream_jp_agg, up, nbr); | ||
|
||
|
@@ -337,8 +356,14 @@ static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS) | |
s = zclient->ibuf; | ||
|
||
prefixlen = stream_getl(s); | ||
|
||
#if PIM_IPV == 4 | ||
stream_get(&sg.src.s_addr, s, prefixlen); | ||
stream_get(&sg.grp.s_addr, s, prefixlen); | ||
#else | ||
stream_get(&sg.src.s6_addr, s, prefixlen); | ||
stream_get(&sg.grp.s6_addr, s, prefixlen); | ||
#endif | ||
|
||
if (PIM_DEBUG_ZEBRA) | ||
zlog_debug("%u:recv SG %s %pSG", vrf_id, | ||
|
@@ -451,6 +476,7 @@ static zclient_handler *const pim_handlers[] = { | |
|
||
void pim_zebra_init(void) | ||
{ | ||
#if PIM_IPV == 4 | ||
/* Socket for receiving updates from Zebra daemon */ | ||
zclient = zclient_new(router->master, &zclient_options_default, | ||
pim_handlers, array_size(pim_handlers)); | ||
|
@@ -464,6 +490,22 @@ void pim_zebra_init(void) | |
} | ||
|
||
zclient_lookup_new(); | ||
#else | ||
/* Socket for receiving updates from Zebra daemon */ | ||
zclient = zclient_new(router->master, &zclient_options_default, | ||
pim_handlers, array_size(pim_handlers)); | ||
|
||
zclient->zebra_capabilities = pim_zebra_capabilities; | ||
zclient->zebra_connected = pim_zebra_connected; | ||
|
||
zclient_init(zclient, ZEBRA_ROUTE_PIM6, 0, &pimd_privs); | ||
if (PIM_DEBUG_PIM_TRACE) { | ||
zlog_notice("%s: zclient socket initialized", __func__); | ||
} | ||
|
||
zclient_lookup_new(); | ||
|
||
#endif | ||
} | ||
|
||
void igmp_anysource_forward_start(struct pim_instance *pim, | ||
|
@@ -606,7 +648,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,13 +661,23 @@ void igmp_source_forward_start(struct pim_instance *pim, | |
} | ||
|
||
else { | ||
#if PIM_IPV == 4 | ||
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; | ||
#else | ||
|
||
src.family = AF_INET6; | ||
src.prefixlen = IPV6_MAX_BITLEN; | ||
src.u.prefix6 = vif_source; // RP or Src address | ||
grp.family = AF_INET6; | ||
grp.prefixlen = IPV6_MAX_BITLEN; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use pim_addr_to_prefix |
||
grp.u.prefix6 = sg.grp; | ||
|
||
#endif | ||
up = pim_upstream_find(pim, &sg); | ||
if (up) { | ||
memcpy(&nexthop, &up->rpf.source_nexthop, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to introduce another protocol, why not just leave it ZEBRA_ROUTE_PIM?