mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 12:37:10 +00:00
zebra: Pass afi received for netconf updates
When Zebra receives the netconf update an afi is passed let's seperate that out and track the v4/v6 specific data to save and store appropriately. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
4c84aa5ebd
commit
d53dc9bd81
@ -1407,7 +1407,9 @@ static void zebra_if_netconf_update_ctx(struct zebra_dplane_ctx *ctx,
|
||||
struct interface *ifp)
|
||||
{
|
||||
struct zebra_if *zif;
|
||||
afi_t afi;
|
||||
enum dplane_netconf_status_e mpls, mcast_on, linkdown;
|
||||
bool *mcast_set, *linkdown_set;
|
||||
|
||||
zif = ifp->info;
|
||||
if (!zif) {
|
||||
@ -1417,6 +1419,7 @@ static void zebra_if_netconf_update_ctx(struct zebra_dplane_ctx *ctx,
|
||||
return;
|
||||
}
|
||||
|
||||
afi = dplane_ctx_get_afi(ctx);
|
||||
mpls = dplane_ctx_get_netconf_mpls(ctx);
|
||||
|
||||
if (mpls == DPLANE_NETCONF_STATUS_ENABLED)
|
||||
@ -1424,25 +1427,32 @@ static void zebra_if_netconf_update_ctx(struct zebra_dplane_ctx *ctx,
|
||||
else if (mpls == DPLANE_NETCONF_STATUS_DISABLED)
|
||||
zif->mpls = false;
|
||||
|
||||
if (afi == AFI_IP) {
|
||||
mcast_set = &zif->v4mcast_on;
|
||||
linkdown_set = &zif->linkdown;
|
||||
} else {
|
||||
mcast_set = &zif->v6mcast_on;
|
||||
linkdown_set = &zif->linkdownv6;
|
||||
}
|
||||
|
||||
linkdown = dplane_ctx_get_netconf_linkdown(ctx);
|
||||
if (linkdown == DPLANE_NETCONF_STATUS_ENABLED)
|
||||
zif->linkdown = true;
|
||||
*linkdown_set = true;
|
||||
else if (linkdown == DPLANE_NETCONF_STATUS_DISABLED)
|
||||
zif->linkdown = false;
|
||||
*linkdown_set = false;
|
||||
|
||||
mcast_on = dplane_ctx_get_netconf_mcast(ctx);
|
||||
if (mcast_on == DPLANE_NETCONF_STATUS_ENABLED)
|
||||
zif->v4mcast_on = true;
|
||||
*mcast_set = true;
|
||||
else if (mcast_on == DPLANE_NETCONF_STATUS_DISABLED)
|
||||
zif->v4mcast_on = false;
|
||||
*mcast_set = false;
|
||||
|
||||
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||
zlog_debug(
|
||||
"%s: if %s, ifindex %d, mpls %s mc_forwarding: %s linkdown %s",
|
||||
__func__, ifp->name, ifp->ifindex,
|
||||
(zif->mpls ? "ON" : "OFF"),
|
||||
(zif->v4mcast_on ? "ON" : "OFF"),
|
||||
(zif->linkdown ? "ON" : "OFF"));
|
||||
"%s: afi: %d if %s, ifindex %d, mpls %s mc_forwarding: %s linkdown %s",
|
||||
__func__, afi, ifp->name, ifp->ifindex,
|
||||
(zif->mpls ? "ON" : "OFF"), (*mcast_set ? "ON" : "OFF"),
|
||||
(*linkdown_set ? "ON" : "OFF"));
|
||||
}
|
||||
|
||||
void zebra_if_dplane_result(struct zebra_dplane_ctx *ctx)
|
||||
@ -1906,10 +1916,14 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
|
||||
vty_out(vty, " MPLS enabled\n");
|
||||
|
||||
if (zebra_if->linkdown)
|
||||
vty_out(vty, " Ignore all routes with linkdown\n");
|
||||
vty_out(vty, " Ignore all v4 routes with linkdown\n");
|
||||
if (zebra_if->linkdownv6)
|
||||
vty_out(vty, " Ignore all v6 routes with linkdown\n");
|
||||
|
||||
if (zebra_if->v4mcast_on)
|
||||
vty_out(vty, " v4 Multicast forwarding is on\n");
|
||||
if (zebra_if->v6mcast_on)
|
||||
vty_out(vty, " v6 Multicast forwarding is on\n");
|
||||
|
||||
/* Hardware address. */
|
||||
vty_out(vty, " Type: %s\n", if_link_type_str(ifp->ll_type));
|
||||
@ -2233,7 +2247,11 @@ static void if_dump_vty_json(struct vty *vty, struct interface *ifp,
|
||||
|
||||
json_object_boolean_add(json_if, "mplsEnabled", zebra_if->mpls);
|
||||
json_object_boolean_add(json_if, "linkDown", zebra_if->linkdown);
|
||||
json_object_boolean_add(json_if, "mcForwarding", zebra_if->v4mcast_on);
|
||||
json_object_boolean_add(json_if, "linkDownV6", zebra_if->linkdownv6);
|
||||
json_object_boolean_add(json_if, "mcForwardingV4",
|
||||
zebra_if->v4mcast_on);
|
||||
json_object_boolean_add(json_if, "mcForwardingV6",
|
||||
zebra_if->v6mcast_on);
|
||||
|
||||
if (ifp->ifindex == IFINDEX_INTERNAL) {
|
||||
json_object_boolean_add(json_if, "pseudoInterface", true);
|
||||
|
@ -130,10 +130,10 @@ struct zebra_if {
|
||||
bool mpls;
|
||||
|
||||
/* Linkdown status */
|
||||
bool linkdown;
|
||||
bool linkdown, linkdownv6;
|
||||
|
||||
/* Is Multicast Forwarding on? */
|
||||
bool v4mcast_on;
|
||||
bool v4mcast_on, v6mcast_on;
|
||||
|
||||
/* Router advertise configuration. */
|
||||
uint8_t rtadv_enable;
|
||||
|
@ -46,7 +46,7 @@ static struct rtattr *netconf_rta(struct netconfmsg *ncm)
|
||||
* context, and enqueue for processing in the main zebra pthread.
|
||||
*/
|
||||
static int
|
||||
netlink_netconf_dplane_update(ns_id_t ns_id, ifindex_t ifindex,
|
||||
netlink_netconf_dplane_update(ns_id_t ns_id, afi_t afi, ifindex_t ifindex,
|
||||
enum dplane_netconf_status_e mpls_on,
|
||||
enum dplane_netconf_status_e mcast_on,
|
||||
enum dplane_netconf_status_e linkdown_on)
|
||||
@ -56,6 +56,7 @@ netlink_netconf_dplane_update(ns_id_t ns_id, ifindex_t ifindex,
|
||||
ctx = dplane_ctx_alloc();
|
||||
dplane_ctx_set_op(ctx, DPLANE_OP_INTF_NETCONFIG);
|
||||
dplane_ctx_set_ns_id(ctx, ns_id);
|
||||
dplane_ctx_set_afi(ctx, afi);
|
||||
dplane_ctx_set_ifindex(ctx, ifindex);
|
||||
|
||||
dplane_ctx_set_netconf_mpls(ctx, mpls_on);
|
||||
@ -78,6 +79,7 @@ int netlink_netconf_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
|
||||
int len;
|
||||
ifindex_t ifindex;
|
||||
uint32_t ival;
|
||||
afi_t afi;
|
||||
enum dplane_netconf_status_e mpls_on = DPLANE_NETCONF_STATUS_UNKNOWN;
|
||||
enum dplane_netconf_status_e mcast_on = DPLANE_NETCONF_STATUS_UNKNOWN;
|
||||
enum dplane_netconf_status_e linkdown_on =
|
||||
@ -96,6 +98,18 @@ int netlink_netconf_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
|
||||
|
||||
ncm = NLMSG_DATA(h);
|
||||
|
||||
/*
|
||||
* FRR does not have an internal representation of afi_t for
|
||||
* the MPLS Address Family that the kernel has. So let's
|
||||
* just call it v4. This is ok because the kernel appears
|
||||
* to do a good job of not sending data that is mixed/matched
|
||||
* across families
|
||||
*/
|
||||
if (ncm->ncm_family == AF_MPLS)
|
||||
afi = AFI_IP;
|
||||
else
|
||||
afi = family2afi(ncm->ncm_family);
|
||||
|
||||
netlink_parse_rtattr(tb, NETCONFA_MAX, netconf_rta(ncm), len);
|
||||
|
||||
if (!tb[NETCONFA_IFINDEX]) {
|
||||
@ -153,7 +167,7 @@ int netlink_netconf_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
|
||||
__func__, ifindex, mpls_on, mcast_on, linkdown_on);
|
||||
|
||||
/* Create a dplane context and pass it along for processing */
|
||||
netlink_netconf_dplane_update(ns_id, ifindex, mpls_on, mcast_on,
|
||||
netlink_netconf_dplane_update(ns_id, afi, ifindex, mpls_on, mcast_on,
|
||||
linkdown_on);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user