diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-13 20:08:37 +0300 |
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-13 20:12:35 +0300 |
| commit | 2560505196b924f5c447f6c1d493ed9b74a13108 (patch) | |
| tree | 515278e4362bf4f9c9418168df90a90b74946c20 /vrrpd | |
| parent | d7374bd3b1be5edfc20534ae5a301a0160c017bf (diff) | |
lib: northbound cli show/cmd functions must not modify data nodes
To ensure this, add a const modifier to functions' arguments. Would be
great do this initially and avoid this large code change, but better
late than never.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'vrrpd')
| -rw-r--r-- | vrrpd/vrrp_vty.c | 16 | ||||
| -rw-r--r-- | vrrpd/vrrp_vty.h | 18 |
2 files changed, 19 insertions, 15 deletions
diff --git a/vrrpd/vrrp_vty.c b/vrrpd/vrrp_vty.c index 91ff6fe28e..a612b0205a 100644 --- a/vrrpd/vrrp_vty.c +++ b/vrrpd/vrrp_vty.c @@ -75,7 +75,7 @@ DEFPY_YANG(vrrp_vrid, return nb_cli_apply_changes(vty, VRRP_XPATH_ENTRY, vrid); } -void cli_show_vrrp(struct vty *vty, struct lyd_node *dnode, bool show_defaults) +void cli_show_vrrp(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { const char *vrid = yang_dnode_get_string(dnode, "./virtual-router-id"); const char *ver = yang_dnode_get_string(dnode, "./version"); @@ -103,7 +103,7 @@ DEFPY_YANG(vrrp_shutdown, return nb_cli_apply_changes(vty, VRRP_XPATH_ENTRY, vrid); } -void cli_show_shutdown(struct vty *vty, struct lyd_node *dnode, +void cli_show_shutdown(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { const char *vrid = yang_dnode_get_string(dnode, "../virtual-router-id"); @@ -145,7 +145,7 @@ DEFPY_YANG(no_vrrp_priority, return nb_cli_apply_changes(vty, VRRP_XPATH_ENTRY, vrid); } -void cli_show_priority(struct vty *vty, struct lyd_node *dnode, +void cli_show_priority(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { const char *vrid = yang_dnode_get_string(dnode, "../virtual-router-id"); @@ -191,7 +191,7 @@ DEFPY_YANG(no_vrrp_advertisement_interval, return nb_cli_apply_changes(vty, VRRP_XPATH_ENTRY, vrid); } -void cli_show_advertisement_interval(struct vty *vty, struct lyd_node *dnode, +void cli_show_advertisement_interval(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { const char *vrid = yang_dnode_get_string(dnode, "../virtual-router-id"); @@ -220,7 +220,7 @@ DEFPY_YANG(vrrp_ip, return nb_cli_apply_changes(vty, VRRP_XPATH_ENTRY, vrid); } -void cli_show_ip(struct vty *vty, struct lyd_node *dnode, bool show_defaults) +void cli_show_ip(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { const char *vrid = yang_dnode_get_string(dnode, "../../virtual-router-id"); @@ -248,7 +248,7 @@ DEFPY_YANG(vrrp_ip6, return nb_cli_apply_changes(vty, VRRP_XPATH_ENTRY, vrid); } -void cli_show_ipv6(struct vty *vty, struct lyd_node *dnode, bool show_defaults) +void cli_show_ipv6(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { const char *vrid = yang_dnode_get_string(dnode, "../../virtual-router-id"); @@ -274,7 +274,7 @@ DEFPY_YANG(vrrp_preempt, return nb_cli_apply_changes(vty, VRRP_XPATH_ENTRY, vrid); } -void cli_show_preempt(struct vty *vty, struct lyd_node *dnode, +void cli_show_preempt(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { const char *vrid = yang_dnode_get_string(dnode, "../virtual-router-id"); @@ -727,7 +727,7 @@ static int vrrp_config_write_interface(struct vty *vty) struct interface *ifp; FOR_ALL_INTERFACES (vrf, ifp) { - struct lyd_node *dnode; + const struct lyd_node *dnode; dnode = yang_dnode_getf( running_config->dnode, diff --git a/vrrpd/vrrp_vty.h b/vrrpd/vrrp_vty.h index 6c6eef0327..587537a6f3 100644 --- a/vrrpd/vrrp_vty.h +++ b/vrrpd/vrrp_vty.h @@ -25,16 +25,20 @@ void vrrp_vty_init(void); /* Northbound callbacks */ -void cli_show_vrrp(struct vty *vty, struct lyd_node *dnode, bool show_defaults); -void cli_show_shutdown(struct vty *vty, struct lyd_node *dnode, +void cli_show_vrrp(struct vty *vty, const struct lyd_node *dnode, + bool show_defaults); +void cli_show_shutdown(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_priority(struct vty *vty, struct lyd_node *dnode, +void cli_show_priority(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); -void cli_show_advertisement_interval(struct vty *vty, struct lyd_node *dnode, +void cli_show_advertisement_interval(struct vty *vty, + const struct lyd_node *dnode, bool show_defaults); -void cli_show_ip(struct vty *vty, struct lyd_node *dnode, bool show_defaults); -void cli_show_ipv6(struct vty *vty, struct lyd_node *dnode, bool show_defaults); -void cli_show_preempt(struct vty *vty, struct lyd_node *dnode, +void cli_show_ip(struct vty *vty, const struct lyd_node *dnode, + bool show_defaults); +void cli_show_ipv6(struct vty *vty, const struct lyd_node *dnode, + bool show_defaults); +void cli_show_preempt(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); #endif /* __VRRP_VTY_H__ */ |
