Skip to content
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

Allow retrieval of v4/v6 forwarding state via NB #18253

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions yang/frr-zebra.yang
Original file line number Diff line number Diff line change
Expand Up @@ -2854,29 +2854,15 @@ module frr-zebra {
16 bit number";
}
leaf ip-forwarding {
config false;
type boolean;
description
"IP forwarding status.";
}
leaf ipv6-forwarding {
type enumeration {
enum unknown {
value -1;
description
"Unknown state.";
}
enum off {
value 0;
description
"IPv6 forwarding disabled.";
}
enum on {
value 1;
description
"IPv6 forwarding enabled.";
}
}
description
config false;
type boolean;
description
"IPv6 forwarding status.";
}
leaf workqueue-hold-timer {
Expand Down
10 changes: 6 additions & 4 deletions zebra/zebra_nb.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ const struct frr_yang_module_info frr_zebra_info = {
{
.xpath = "/frr-zebra:zebra/ip-forwarding",
.cbs = {
.modify = zebra_ip_forwarding_modify,
.destroy = zebra_ip_forwarding_destroy,
//.modify = zebra_ip_forwarding_modify,
//.destroy = zebra_ip_forwarding_destroy,
.get_elem = zebra_ip_forwarding_get_elem,
}
},
{
.xpath = "/frr-zebra:zebra/ipv6-forwarding",
.cbs = {
.modify = zebra_ipv6_forwarding_modify,
.destroy = zebra_ipv6_forwarding_destroy,
//.modify = zebra_ipv6_forwarding_modify,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we drop these lines at all then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm planning on a followup commit to address this exact problem.

//.destroy = zebra_ipv6_forwarding_destroy,
.get_elem = zebra_ipv6_forwarding_get_elem,
}
},
{
Expand Down
2 changes: 2 additions & 0 deletions zebra/zebra_nb.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ int get_debugs_rpc(struct nb_cb_rpc_args *args);
int zebra_mcast_rpf_lookup_modify(struct nb_cb_modify_args *args);
int zebra_ip_forwarding_modify(struct nb_cb_modify_args *args);
int zebra_ip_forwarding_destroy(struct nb_cb_destroy_args *args);
struct yang_data *zebra_ip_forwarding_get_elem(struct nb_cb_get_elem_args *args);
int zebra_ipv6_forwarding_modify(struct nb_cb_modify_args *args);
int zebra_ipv6_forwarding_destroy(struct nb_cb_destroy_args *args);
int zebra_workqueue_hold_timer_modify(struct nb_cb_modify_args *args);
struct yang_data *zebra_ipv6_forwarding_get_elem(struct nb_cb_get_elem_args *args);
int zebra_zapi_packets_modify(struct nb_cb_modify_args *args);
int zebra_import_kernel_table_table_id_modify(struct nb_cb_modify_args *args);
int zebra_import_kernel_table_table_id_destroy(struct nb_cb_destroy_args *args);
Expand Down
20 changes: 20 additions & 0 deletions zebra/zebra_nb_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "printfrr.h"
#include "zebra/zebra_vxlan.h"
#include "zebra/zebra_vxlan_if.h"
#include "zebra/ipforward.h"

/*
* XPath: /frr-interface:lib/interface/frr-zebra:zebra/state/up-count
Expand Down Expand Up @@ -1166,3 +1167,22 @@ struct yang_data *zebra_max_multipath_get_elem(struct nb_cb_get_elem_args *args)
{
return yang_data_new_uint16(args->xpath, zrouter.multipath_num);
}

/*
* XPath:
* /frr-zebra:zebra/ip_forwarding
*/
struct yang_data *zebra_ip_forwarding_get_elem(struct nb_cb_get_elem_args *args)
{
return yang_data_new_bool(args->xpath, ipforward());
}


/*
* XPath:
* /frr-zebra:zebra/ipv6_forwarding
*/
struct yang_data *zebra_ipv6_forwarding_get_elem(struct nb_cb_get_elem_args *args)
{
return yang_data_new_bool(args->xpath, ipforward_ipv6());
}
Loading