diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2018-09-08 21:46:23 +0200 | 
|---|---|---|
| committer | David Lamparter <equinox@diac24.net> | 2020-04-16 12:53:00 +0200 | 
| commit | 62b346eefa1b9e09c9372f5b6376e1bca4162015 (patch) | |
| tree | 2e3bc16d1d0765ab033c7ffd24ca58b3b5d35168 | |
| parent | 4c749d99dcdc7f0d811d0bbd2858b87f41e4feba (diff) | |
*: clean up cmd_node initializers
... and use named assignments everywhere (so I can change the struct.)
Signed-off-by: David Lamparter <equinox@diac24.net>
51 files changed, 604 insertions, 249 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index 7f9a13c271..a009af3203 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -58,11 +58,10 @@ static void babel_interface_free (babel_interface_nfo *bi);  static vector babel_enable_if;                 /* enable interfaces (by cmd). */ -static struct cmd_node babel_interface_node =  /* babeld's interface node.    */ -{ -    INTERFACE_NODE, -    "%s(config-if)# ", -    1 /* VTYSH */ +static struct cmd_node babel_interface_node = { +    .node = INTERFACE_NODE, +    .prompt = "%s(config-if)# ", +    .vtysh = 1,  }; diff --git a/bfdd/bfdd_vty.c b/bfdd/bfdd_vty.c index f539c6d270..fddefb750c 100644 --- a/bfdd/bfdd_vty.c +++ b/bfdd/bfdd_vty.c @@ -886,15 +886,15 @@ DEFUN_NOSH(show_debugging_bfd,  }  struct cmd_node bfd_node = { -	BFD_NODE, -	"%s(config-bfd)# ", -	1, +	.node = BFD_NODE, +	.prompt = "%s(config-bfd)# ", +	.vtysh = 1,  };  struct cmd_node bfd_peer_node = { -	BFD_PEER_NODE, -	"%s(config-bfd-peer)# ", -	1, +	.node = BFD_PEER_NODE, +	.prompt = "%s(config-bfd-peer)# ", +	.vtysh = 1,  };  static int bfdd_write_config(struct vty *vty) diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index a6fc4ebd03..871a693bc8 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -1772,7 +1772,10 @@ static void bmp_active_setup(struct bmp_active *ba)  	}  } -static struct cmd_node bmp_node = {BMP_NODE, "%s(config-bgp-bmp)# "}; +static struct cmd_node bmp_node = { +	.node = BMP_NODE, +	.prompt = "%s(config-bgp-bmp)# " +};  #define BMP_STR "BGP Monitoring Protocol\n" diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 5104e23515..4cb86e38e0 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -2282,7 +2282,11 @@ static int bgp_config_write_debug(struct vty *vty)  	return write;  } -static struct cmd_node debug_node = {DEBUG_NODE, "", 1}; +static struct cmd_node debug_node = { +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  void bgp_debug_init(void)  { diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index cd1722ccca..d5609e04ea 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -778,7 +778,11 @@ DEFUN (no_dump_bgp_all,  }  /* BGP node structure. */ -static struct cmd_node bgp_dump_node = {DUMP_NODE, "", 1}; +static struct cmd_node bgp_dump_node = { +	.node = DUMP_NODE, +	.prompt = "", +	.vtysh = 1, +};  #if 0  char * diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 7de8dc2c80..49912583dd 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -667,7 +667,11 @@ static int config_write_as_list(struct vty *vty)  	return write;  } -static struct cmd_node as_list_node = {AS_LIST_NODE, "", 1}; +static struct cmd_node as_list_node = { +	.node = AS_LIST_NODE, +	.prompt = "", +	.vtysh = 1, +};  /* Register functions. */  void bgp_filter_init(void) diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index e40c7231a7..d626d731f2 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -143,7 +143,11 @@ static unsigned int retry_interval;  static int rpki_sync_socket_rtr;  static int rpki_sync_socket_bgpd; -static struct cmd_node rpki_node = {RPKI_NODE, "%s(config-rpki)# ", 1}; +static struct cmd_node rpki_node = { +	.node = RPKI_NODE, +	.prompt = "%s(config-rpki)# ", +	.vtysh = 1, +};  static const struct route_map_rule_cmd route_match_rpki_cmd = {  	"rpki", route_match, route_match_compile, route_match_free}; diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 8f06fdf86c..6700b632a5 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -15335,50 +15335,82 @@ int bgp_config_write(struct vty *vty)  /* BGP node structure. */  static struct cmd_node bgp_node = { -	BGP_NODE, "%s(config-router)# ", 1, +	.node = BGP_NODE, +	.prompt = "%s(config-router)# ", +	.vtysh = 1,  };  static struct cmd_node bgp_ipv4_unicast_node = { -	BGP_IPV4_NODE, "%s(config-router-af)# ", 1, +	.node = BGP_IPV4_NODE, +	.prompt = "%s(config-router-af)# ", +	.vtysh = 1,  };  static struct cmd_node bgp_ipv4_multicast_node = { -	BGP_IPV4M_NODE, "%s(config-router-af)# ", 1, +	.node = BGP_IPV4M_NODE, +	.prompt = "%s(config-router-af)# ", +	.vtysh = 1,  };  static struct cmd_node bgp_ipv4_labeled_unicast_node = { -	BGP_IPV4L_NODE, "%s(config-router-af)# ", 1, +	.node = BGP_IPV4L_NODE, +	.prompt = "%s(config-router-af)# ", +	.vtysh = 1,  };  static struct cmd_node bgp_ipv6_unicast_node = { -	BGP_IPV6_NODE, "%s(config-router-af)# ", 1, +	.node = BGP_IPV6_NODE, +	.prompt = "%s(config-router-af)# ", +	.vtysh = 1,  };  static struct cmd_node bgp_ipv6_multicast_node = { -	BGP_IPV6M_NODE, "%s(config-router-af)# ", 1, +	.node = BGP_IPV6M_NODE, +	.prompt = "%s(config-router-af)# ", +	.vtysh = 1,  };  static struct cmd_node bgp_ipv6_labeled_unicast_node = { -	BGP_IPV6L_NODE, "%s(config-router-af)# ", 1, +	.node = BGP_IPV6L_NODE, +	.prompt = "%s(config-router-af)# ", +	.vtysh = 1,  }; -static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE, -					 "%s(config-router-af)# ", 1}; +static struct cmd_node bgp_vpnv4_node = { +	.node = BGP_VPNV4_NODE, +	.prompt = "%s(config-router-af)# ", +	.vtysh = 1, +}; -static struct cmd_node bgp_vpnv6_node = {BGP_VPNV6_NODE, -					 "%s(config-router-af-vpnv6)# ", 1}; +static struct cmd_node bgp_vpnv6_node = { +	.node = BGP_VPNV6_NODE, +	.prompt = "%s(config-router-af-vpnv6)# ", +	.vtysh = 1, +}; -static struct cmd_node bgp_evpn_node = {BGP_EVPN_NODE, -					"%s(config-router-evpn)# ", 1}; +static struct cmd_node bgp_evpn_node = { +	.node = BGP_EVPN_NODE, +	.prompt = "%s(config-router-evpn)# ", +	.vtysh = 1, +}; -static struct cmd_node bgp_evpn_vni_node = {BGP_EVPN_VNI_NODE, -					    "%s(config-router-af-vni)# ", 1}; +static struct cmd_node bgp_evpn_vni_node = { +	.node = BGP_EVPN_VNI_NODE, +	.prompt = "%s(config-router-af-vni)# ", +	.vtysh = 1, +}; -static struct cmd_node bgp_flowspecv4_node = {BGP_FLOWSPECV4_NODE, -					 "%s(config-router-af)# ", 1}; +static struct cmd_node bgp_flowspecv4_node = { +	.node = BGP_FLOWSPECV4_NODE, +	.prompt = "%s(config-router-af)# ", +	.vtysh = 1, +}; -static struct cmd_node bgp_flowspecv6_node = {BGP_FLOWSPECV6_NODE, -					 "%s(config-router-af-vpnv6)# ", 1}; +static struct cmd_node bgp_flowspecv6_node = { +	.node = BGP_FLOWSPECV6_NODE, +	.prompt = "%s(config-router-af-vpnv6)# ", +	.vtysh = 1, +};  static void community_list_vty(void); @@ -17859,7 +17891,9 @@ static int community_list_config_write(struct vty *vty)  }  static struct cmd_node community_list_node = { -	COMMUNITY_LIST_NODE, "", 1 /* Export to vtysh.  */ +	.node = COMMUNITY_LIST_NODE, +	.prompt = "", +	.vtysh = 1,  };  static void community_list_vty(void) diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index acfab53d2b..6f949775fd 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -2965,10 +2965,16 @@ DEFUN_NOSH (exit_vnc,  }  static struct cmd_node bgp_vnc_defaults_node = { -	BGP_VNC_DEFAULTS_NODE, "%s(config-router-vnc-defaults)# ", 1}; +	.node = BGP_VNC_DEFAULTS_NODE, +	.prompt = "%s(config-router-vnc-defaults)# ", +	.vtysh = 1, +};  static struct cmd_node bgp_vnc_nve_group_node = { -	BGP_VNC_NVE_GROUP_NODE, "%s(config-router-vnc-nve-group)# ", 1}; +	.node = BGP_VNC_NVE_GROUP_NODE, +	.prompt = "%s(config-router-vnc-nve-group)# ", +	.vtysh = 1, +};  /*-------------------------------------------------------------------------   *			VNC nve-group @@ -3388,7 +3394,10 @@ DEFUN_NOSH (exit_vrf_policy,  }  static struct cmd_node bgp_vrf_policy_node = { -	BGP_VRF_POLICY_NODE, "%s(config-router-vrf-policy)# ", 1}; +	.node = BGP_VRF_POLICY_NODE, +	.prompt = "%s(config-router-vrf-policy)# ", +	.vtysh = 1, +};  /*-------------------------------------------------------------------------   *			vnc-l2-group @@ -3624,7 +3633,10 @@ DEFUN (vnc_l2_group_rt,  static struct cmd_node bgp_vnc_l2_group_node = { -	BGP_VNC_L2_GROUP_NODE, "%s(config-router-vnc-l2-group)# ", 1}; +	.node = BGP_VNC_L2_GROUP_NODE, +	.prompt = "%s(config-router-vnc-l2-group)# ", +	.vtysh = 1, +};  struct rfapi_l2_group_cfg *  bgp_rfapi_get_group_by_lni_label(struct bgp *bgp, uint32_t logical_net_id, diff --git a/bgpd/rfapi/vnc_debug.c b/bgpd/rfapi/vnc_debug.c index 2c5e188328..abc97786b9 100644 --- a/bgpd/rfapi/vnc_debug.c +++ b/bgpd/rfapi/vnc_debug.c @@ -173,7 +173,11 @@ static int bgp_vnc_config_write_debug(struct vty *vty)  	return write;  } -static struct cmd_node debug_node = {DEBUG_VNC_NODE, "", 1}; +static struct cmd_node debug_node = { +	.node = DEBUG_VNC_NODE, +	.prompt = "", +	.vtysh = 1, +};  void vnc_debug_init(void)  { diff --git a/eigrpd/eigrp_cli.c b/eigrpd/eigrp_cli.c index a93d4c8280..9b7d65c9ca 100644 --- a/eigrpd/eigrp_cli.c +++ b/eigrpd/eigrp_cli.c @@ -838,7 +838,11 @@ void eigrp_cli_show_keychain(struct vty *vty, struct lyd_node *dnode,  /*   * CLI installation procedures.   */ -static struct cmd_node eigrp_node = {EIGRP_NODE, "%s(config-router)# ", 1}; +static struct cmd_node eigrp_node = { +	.node = EIGRP_NODE, +	.prompt = "%s(config-router)# ", +	.vtysh = 1, +};  static int eigrp_config_write(struct vty *vty)  { @@ -854,8 +858,11 @@ static int eigrp_config_write(struct vty *vty)  	return written;  } -static struct cmd_node eigrp_interface_node = {INTERFACE_NODE, -					       "%s(config-if)# ", 1}; +static struct cmd_node eigrp_interface_node = { +	.node = INTERFACE_NODE, +	.prompt = "%s(config-if)# ", +	.vtysh = 1, +};  static int eigrp_write_interface(struct vty *vty) diff --git a/eigrpd/eigrp_dump.c b/eigrpd/eigrp_dump.c index 7278b002d8..c37e0fae57 100644 --- a/eigrpd/eigrp_dump.c +++ b/eigrpd/eigrp_dump.c @@ -556,7 +556,9 @@ DEFUN (no_debug_eigrp_packets,  /* Debug node. */  static struct cmd_node eigrp_debug_node = { -	DEBUG_NODE, "", 1 /* VTYSH */ +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1,  };  /* Initialize debug commands. */ diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 7d4f7b355d..2d3bd89fa8 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -1336,7 +1336,9 @@ ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,  }  struct cmd_node interface_node = { -	INTERFACE_NODE, "%s(config-if)# ", 1, +	.node = INTERFACE_NODE, +	.prompt = "%s(config-if)# ", +	.vtysh = 1,  };  void isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type) diff --git a/isisd/isisd.c b/isisd/isisd.c index c61c7f0e0c..b56f889827 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -785,7 +785,11 @@ DEFUN_NOSH (show_debugging,  }  /* Debug node. */ -static struct cmd_node debug_node = {DEBUG_NODE, "", 1}; +static struct cmd_node debug_node = { +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_debug(struct vty *vty)  { @@ -2141,7 +2145,11 @@ int isis_config_write(struct vty *vty)  }  #endif /* ifdef FABRICD */ -struct cmd_node router_node = {ROUTER_NODE, "%s(config-router)# ", 1}; +struct cmd_node router_node = { +	.node = ROUTER_NODE, +	.prompt = "%s(config-router)# ", +	.vtysh = 1, +};  void isis_init(void)  { diff --git a/ldpd/ldp_debug.c b/ldpd/ldp_debug.c index ec70ef510a..78d40b8ff5 100644 --- a/ldpd/ldp_debug.c +++ b/ldpd/ldp_debug.c @@ -30,11 +30,10 @@ struct ldp_debug conf_ldp_debug;  struct ldp_debug ldp_debug;  /* Debug node. */ -struct cmd_node ldp_debug_node = -{ -	DEBUG_NODE, -	"", -	1 +struct cmd_node ldp_debug_node = { +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1,  };  int diff --git a/ldpd/ldp_vty_conf.c b/ldpd/ldp_vty_conf.c index 84a5c0b1b2..3b8c3404ed 100644 --- a/ldpd/ldp_vty_conf.c +++ b/ldpd/ldp_vty_conf.c @@ -37,53 +37,46 @@ static void	 ldp_l2vpn_pw_config_write(struct vty *, struct l2vpn_pw *);  static int	 ldp_vty_get_af(struct vty *);  static int	 ldp_iface_is_configured(struct ldpd_conf *, const char *); -struct cmd_node ldp_node = -{ -	LDP_NODE, -	"%s(config-ldp)# ", -	1, +struct cmd_node ldp_node = { +	.node = LDP_NODE, +	.prompt = "%s(config-ldp)# ", +	.vtysh = 1,  }; -struct cmd_node ldp_ipv4_node = -{ -	LDP_IPV4_NODE, -	"%s(config-ldp-af)# ", -	1, +struct cmd_node ldp_ipv4_node = { +	.node = LDP_IPV4_NODE, +	.prompt = "%s(config-ldp-af)# ", +	.vtysh = 1,  }; -struct cmd_node ldp_ipv6_node = -{ -	LDP_IPV6_NODE, -	"%s(config-ldp-af)# ", -	1, +struct cmd_node ldp_ipv6_node = { +	.node = LDP_IPV6_NODE, +	.prompt = "%s(config-ldp-af)# ", +	.vtysh = 1,  }; -struct cmd_node ldp_ipv4_iface_node = -{ -	LDP_IPV4_IFACE_NODE, -	"%s(config-ldp-af-if)# ", -	1, +struct cmd_node ldp_ipv4_iface_node = { +	.node = LDP_IPV4_IFACE_NODE, +	.prompt = "%s(config-ldp-af-if)# ", +	.vtysh = 1,  }; -struct cmd_node ldp_ipv6_iface_node = -{ -	LDP_IPV6_IFACE_NODE, -	"%s(config-ldp-af-if)# ", -	1, +struct cmd_node ldp_ipv6_iface_node = { +	.node = LDP_IPV6_IFACE_NODE, +	.prompt = "%s(config-ldp-af-if)# ", +	.vtysh = 1,  }; -struct cmd_node ldp_l2vpn_node = -{ -	LDP_L2VPN_NODE, -	"%s(config-l2vpn)# ", -	1, +struct cmd_node ldp_l2vpn_node = { +	.node = LDP_L2VPN_NODE, +	.prompt = "%s(config-l2vpn)# ", +	.vtysh = 1,  }; -struct cmd_node ldp_pseudowire_node = -{ -	LDP_PSEUDOWIRE_NODE, -	"%s(config-l2vpn-pw)# ", -	1, +struct cmd_node ldp_pseudowire_node = { +	.node = LDP_PSEUDOWIRE_NODE, +	.prompt = "%s(config-l2vpn-pw)# ", +	.vtysh = 1,  };  int diff --git a/lib/agentx.c b/lib/agentx.c index d1b801fe8c..0215affd9e 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -158,9 +158,11 @@ static void agentx_events_update(void)  }  /* AgentX node. */ -static struct cmd_node agentx_node = {SMUX_NODE, -				      "", /* AgentX has no interface. */ -				      1}; +static struct cmd_node agentx_node = { +	.node = SMUX_NODE, +	.prompt = "", +	.vtysh = 1, +};  /* Logging NetSNMP messages */  static int agentx_log_callback(int major, int minor, void *serverarg, diff --git a/lib/command.c b/lib/command.c index 8811b3a791..85ccbbf191 100644 --- a/lib/command.c +++ b/lib/command.c @@ -181,22 +181,30 @@ const char *cmd_domainname_get(void)  /* Standard command node structures. */  static struct cmd_node auth_node = { -	AUTH_NODE, "Password: ", +	.node = AUTH_NODE, +	.prompt = "Password: ",  };  static struct cmd_node view_node = { -	VIEW_NODE, "%s> ", +	.node = VIEW_NODE, +	.prompt = "%s> ",  };  static struct cmd_node auth_enable_node = { -	AUTH_ENABLE_NODE, "Password: ", +	.node = AUTH_ENABLE_NODE, +	.prompt = "Password: ",  };  static struct cmd_node enable_node = { -	ENABLE_NODE, "%s# ", +	.node = ENABLE_NODE, +	.prompt = "%s# ",  }; -static struct cmd_node config_node = {CONFIG_NODE, "%s(config)# ", 1}; +static struct cmd_node config_node = { +	.node = CONFIG_NODE, +	.prompt = "%s(config)# ", +	.vtysh = 1, +};  static const struct facility_map {  	int facility; diff --git a/lib/filter.c b/lib/filter.c index 3226fb2f5e..381f9829bb 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -2813,8 +2813,10 @@ static int config_write_access(struct vty *vty, afi_t afi)  }  static struct cmd_node access_mac_node = { -	ACCESS_MAC_NODE, "", /* Access list has no interface. */ -	1}; +	.node = ACCESS_MAC_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_access_mac(struct vty *vty)  { @@ -2863,9 +2865,11 @@ static void access_list_init_mac(void)  }  /* Access-list node. */ -static struct cmd_node access_node = {ACCESS_NODE, -				      "", /* Access list has no interface. */ -				      1}; +static struct cmd_node access_node = { +	.node = ACCESS_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_access_ipv4(struct vty *vty)  { @@ -2948,7 +2952,11 @@ static void access_list_init_ipv4(void)  	install_element(CONFIG_NODE, &no_access_list_remark_comment_cmd);  } -static struct cmd_node access_ipv6_node = {ACCESS_IPV6_NODE, "", 1}; +static struct cmd_node access_ipv6_node = { +	.node = ACCESS_IPV6_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_access_ipv6(struct vty *vty)  { diff --git a/lib/keychain.c b/lib/keychain.c index ea512a2699..c0af630c4b 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -959,11 +959,17 @@ DEFUN (no_send_lifetime,  	return CMD_SUCCESS;  } -static struct cmd_node keychain_node = {KEYCHAIN_NODE, "%s(config-keychain)# ", -					1}; - -static struct cmd_node keychain_key_node = {KEYCHAIN_KEY_NODE, -					    "%s(config-keychain-key)# ", 1}; +static struct cmd_node keychain_node = { +	.node = KEYCHAIN_NODE, +	.prompt = "%s(config-keychain)# ", +	.vtysh = 1, +}; + +static struct cmd_node keychain_key_node = { +	.node = KEYCHAIN_KEY_NODE, +	.prompt = "%s(config-keychain-key)# ", +	.vtysh = 1, +};  static int keychain_strftime(char *buf, int bufsiz, time_t *time)  { diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c index a4c823e37a..7c7914a723 100644 --- a/lib/nexthop_group.c +++ b/lib/nexthop_group.c @@ -934,9 +934,9 @@ DEFPY(ecmp_nexthops, ecmp_nexthops_cmd,  }  static struct cmd_node nexthop_group_node = { -	NH_GROUP_NODE, -	"%s(config-nh-group)# ", -	1 +	.node = NH_GROUP_NODE, +	.prompt = "%s(config-nh-group)# ", +	.vtysh = 1,  };  void nexthop_group_write_nexthop(struct vty *vty, struct nexthop *nh) diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index 17dc256281..9c001a3b08 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -1674,7 +1674,11 @@ static int nb_debug_config_write(struct vty *vty)  }  static struct debug_callbacks nb_dbg_cbs = {.debug_set_all = nb_debug_set_all}; -static struct cmd_node nb_debug_node = {NORTHBOUND_DEBUG_NODE, "", 1}; +static struct cmd_node nb_debug_node = { +	.node = NORTHBOUND_DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  void nb_cli_install_default(int node)  { diff --git a/lib/plist.c b/lib/plist.c index b7a020c6f7..15a79a1cdc 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -2045,9 +2045,11 @@ static void prefix_list_reset_afi(afi_t afi, int orf)  /* Prefix-list node. */ -static struct cmd_node prefix_node = {PREFIX_NODE, -				      "", /* Prefix list has no interface. */ -				      1}; +static struct cmd_node prefix_node = { +	.node = PREFIX_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_prefix_ipv4(struct vty *vty)  { @@ -2109,8 +2111,10 @@ static void prefix_list_init_ipv4(void)  /* Prefix-list node. */  static struct cmd_node prefix_ipv6_node = { -	PREFIX_IPV6_NODE, "", /* Prefix list has no interface. */ -	1}; +	.node = PREFIX_IPV6_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_prefix_ipv6(struct vty *vty)  { diff --git a/lib/resolver.c b/lib/resolver.c index 1be47bd6e1..83e2f52690 100644 --- a/lib/resolver.c +++ b/lib/resolver.c @@ -245,7 +245,11 @@ DEFUN(debug_resolver,  	return CMD_SUCCESS;  } -static struct cmd_node resolver_debug_node = {RESOLVER_DEBUG_NODE, "", 1}; +static struct cmd_node resolver_debug_node = { +	.node = RESOLVER_DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int resolver_config_write_debug(struct vty *vty)  { diff --git a/lib/routemap.c b/lib/routemap.c index e2baa36f24..dc73b1e0d1 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -3015,7 +3015,11 @@ DEFUN (no_debug_rmap,  }  /* Debug node. */ -static struct cmd_node rmap_debug_node = {RMAP_DEBUG_NODE, "", 1}; +static struct cmd_node rmap_debug_node = { +	.node = RMAP_DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  /* Configuration write function. */  static int rmap_config_write_debug(struct vty *vty) diff --git a/lib/routemap_cli.c b/lib/routemap_cli.c index 41e8cacd81..b7db1d4dd5 100644 --- a/lib/routemap_cli.c +++ b/lib/routemap_cli.c @@ -1064,7 +1064,11 @@ static int route_map_config_write(struct vty *vty)  }  /* Route map node structure. */ -static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# ", 1}; +static struct cmd_node rmap_node = { +	.node = RMAP_NODE, +	.prompt = "%s(config-route-map)# ", +	.vtysh = 1, +};  static void rmap_autocomplete(vector comps, struct cmd_token *token)  { @@ -758,7 +758,11 @@ DEFUN (no_vrf,  } -static struct cmd_node vrf_node = {VRF_NODE, "%s(config-vrf)# ", 1}; +static struct cmd_node vrf_node = { +	.node = VRF_NODE, +	.prompt = "%s(config-vrf)# ", +	.vtysh = 1, +};  DEFUN_NOSH (vrf_netns,         vrf_netns_cmd, @@ -848,7 +852,11 @@ static int vrf_write_host(struct vty *vty)  	return 1;  } -static struct cmd_node vrf_debug_node = {VRF_DEBUG_NODE, "", 1}; +static struct cmd_node vrf_debug_node = { +	.node = VRF_DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  void vrf_install_commands(void)  { @@ -2990,7 +2990,9 @@ static int vty_config_write(struct vty *vty)  }  struct cmd_node vty_node = { -	VTY_NODE, "%s(config-line)# ", 1, +	.node = VTY_NODE, +	.prompt = "%s(config-line)# ", +	.vtysh = 1,  };  /* Reset all VTY status. */ diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 93265afc43..a0dd396cc3 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1944,7 +1944,9 @@ static int config_write_ospf6_interface(struct vty *vty)  }  static struct cmd_node interface_node = { -	INTERFACE_NODE, "%s(config-if)# ", 1 /* VTYSH */ +	.node = INTERFACE_NODE, +	.prompt = "%s(config-if)# ", +	.vtysh = 1,  };  static int ospf6_ifp_create(struct interface *ifp) diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index dc10fa52cb..2f646ce443 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -1114,7 +1114,9 @@ static int config_write_ospf6(struct vty *vty)  /* OSPF6 node structure. */  static struct cmd_node ospf6_node = { -	OSPF6_NODE, "%s(config-ospf6)# ", 1 /* VTYSH */ +	.node = OSPF6_NODE, +	.prompt = "%s(config-ospf6)# ", +	.vtysh = 1,  };  /* Install ospf related commands. */ diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index db61fe087b..1beadca795 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -70,7 +70,9 @@ struct route_node *route_prev(struct route_node *node)  }  static struct cmd_node debug_node = { -	DEBUG_NODE, "", 1 /* VTYSH */ +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1,  };  static int config_write_ospf6_debug(struct vty *vty) diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index a712ecde95..fda96a80df 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -1642,7 +1642,9 @@ DEFUN_NOSH (show_debugging_ospf_instance,  /* Debug node. */  static struct cmd_node debug_node = { -	DEBUG_NODE, "", 1 /* VTYSH */ +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1,  };  static int config_write_debug(struct vty *vty) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index ea73834a66..c2b08cab77 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -10556,7 +10556,11 @@ void ospf_vty_show_init(void)  /* ospfd's interface node. */ -static struct cmd_node interface_node = {INTERFACE_NODE, "%s(config-if)# ", 1}; +static struct cmd_node interface_node = { +	.node = INTERFACE_NODE, +	.prompt = "%s(config-if)# ", +	.vtysh = 1, +};  /* Initialization of OSPF interface. */  static void ospf_vty_if_init(void) @@ -10668,7 +10672,11 @@ static void ospf_vty_zebra_init(void)  #endif /* 0 */  } -static struct cmd_node ospf_node = {OSPF_NODE, "%s(config-router)# ", 1}; +static struct cmd_node ospf_node = { +	.node = OSPF_NODE, +	.prompt = "%s(config-router)# ", +	.vtysh = 1, +};  static void ospf_interface_clear(struct interface *ifp)  { diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c index 4a3a9ca382..0ef856bd04 100644 --- a/pbrd/pbr_vty.c +++ b/pbrd/pbr_vty.c @@ -677,7 +677,11 @@ DEFPY (show_pbr_interface,  /* PBR debugging CLI ------------------------------------------------------- */ -static struct cmd_node debug_node = {DEBUG_NODE, "", 1}; +static struct cmd_node debug_node = { +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  DEFPY(debug_pbr,        debug_pbr_cmd, @@ -726,7 +730,9 @@ DEFUN_NOSH(show_debugging_pbr,  static struct cmd_node interface_node = { -	INTERFACE_NODE, "%s(config-if)# ", 1 /* vtysh ? yes */ +	.node = INTERFACE_NODE, +	.prompt = "%s(config-if)# ", +	.vtysh = 1,  };  static int pbr_interface_config_write(struct vty *vty) @@ -755,7 +761,11 @@ static int pbr_interface_config_write(struct vty *vty)  }  /* PBR map node structure. */ -static struct cmd_node pbr_map_node = {PBRMAP_NODE, "%s(config-pbr-map)# ", 1}; +static struct cmd_node pbr_map_node = { +	.node = PBRMAP_NODE, +	.prompt = "%s(config-pbr-map)# ", +	.vtysh = 1, +};  static int pbr_vty_map_config_write_sequence(struct vty *vty,  					     struct pbr_map *pbrm, diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index d6c500cdb0..248fb95435 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -70,10 +70,16 @@  #endif  static struct cmd_node interface_node = { -	INTERFACE_NODE, "%s(config-if)# ", 1 /* vtysh ? yes */ +	.node = INTERFACE_NODE, +	.prompt = "%s(config-if)# ", +	.vtysh = 1,  }; -static struct cmd_node debug_node = {DEBUG_NODE, "", 1}; +static struct cmd_node debug_node = { +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  static struct vrf *pim_cmd_lookup_vrf(struct vty *vty, struct cmd_token *argv[],  				      const int argc, int *idx) diff --git a/ripd/rip_debug.c b/ripd/rip_debug.c index 3356d99c2a..fe6b534c9d 100644 --- a/ripd/rip_debug.c +++ b/ripd/rip_debug.c @@ -173,9 +173,11 @@ DEFUN (no_debug_rip_zebra,  }  /* Debug node. */ -static struct cmd_node debug_node = {DEBUG_NODE, -				     "", /* Debug node has no interface. */ -				     1}; +static struct cmd_node debug_node = { +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_debug(struct vty *vty)  { diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index c05d776eb1..99b7c78d6d 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1194,7 +1194,9 @@ int rip_show_network_config(struct vty *vty, struct rip *rip)  }  static struct cmd_node interface_node = { -	INTERFACE_NODE, "%s(config-if)# ", 1, +	.node = INTERFACE_NODE, +	.prompt = "%s(config-if)# ", +	.vtysh = 1,  };  void rip_interface_sync(struct interface *ifp) diff --git a/ripd/ripd.c b/ripd/ripd.c index f092da847d..ecb3fa2d33 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -3328,7 +3328,11 @@ static int config_write_rip(struct vty *vty)  }  /* RIP node structure. */ -static struct cmd_node rip_node = {RIP_NODE, "%s(config-router)# ", 1}; +static struct cmd_node rip_node = { +	.node = RIP_NODE, +	.prompt = "%s(config-router)# ", +	.vtysh = 1, +};  /* Distribute-list update functions. */  static void rip_distribute_update(struct distribute_ctx *ctx, diff --git a/ripngd/ripng_debug.c b/ripngd/ripng_debug.c index fe63d8fdea..fe4ec256ba 100644 --- a/ripngd/ripng_debug.c +++ b/ripngd/ripng_debug.c @@ -176,8 +176,9 @@ DEFUN (no_debug_ripng_zebra,  /* Debug node. */  static struct cmd_node debug_node = { -	DEBUG_NODE, "", /* Debug node has no interface. */ -	1		/* VTYSH */ +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1,  };  static int config_write_debug(struct vty *vty) diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index 25d9ed2b9e..d322a6ddb0 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -956,7 +956,9 @@ static int interface_config_write(struct vty *vty)  /* ripngd's interface node. */  static struct cmd_node interface_node = { -	INTERFACE_NODE, "%s(config-if)# ", 1 /* VTYSH */ +	.node = INTERFACE_NODE, +	.prompt = "%s(config-if)# ", +	.vtysh = 1,  };  /* Initialization of interface. */ diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 1ea006abd6..12f8b268fb 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -2436,7 +2436,9 @@ static int ripng_config_write(struct vty *vty)  /* RIPng node structure. */  static struct cmd_node cmd_ripng_node = { -	RIPNG_NODE, "%s(config-router)# ", 1, +	.node = RIPNG_NODE, +	.prompt = "%s(config-router)# ", +	.vtysh = 1,  };  static void ripng_distribute_update(struct distribute_ctx *ctx, diff --git a/staticd/static_vty.c b/staticd/static_vty.c index a950b0473e..82d8997dac 100644 --- a/staticd/static_vty.c +++ b/staticd/static_vty.c @@ -1470,7 +1470,11 @@ DEFUN_NOSH (show_debugging_static,  	return CMD_SUCCESS;  } -static struct cmd_node debug_node = {DEBUG_NODE, "", 1}; +static struct cmd_node debug_node = { +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  void static_vty_init(void)  { diff --git a/tests/lib/cli/test_commands.c b/tests/lib/cli/test_commands.c index 779a7539e9..3ebe46a9ab 100644 --- a/tests/lib/cli/test_commands.c +++ b/tests/lib/cli/test_commands.c @@ -49,50 +49,84 @@ static vector test_cmds;  static char test_buf[32768];  static struct cmd_node bgp_node = { -	BGP_NODE, "%s(config-router)# ", +	.node = BGP_NODE, +	.prompt = "%s(config-router)# ",  };  static struct cmd_node rip_node = { -	RIP_NODE, "%s(config-router)# ", +	.node = RIP_NODE, +	.prompt = "%s(config-router)# ",  };  static struct cmd_node isis_node = { -	ISIS_NODE, "%s(config-router)# ", +	.node = ISIS_NODE, +	.prompt = "%s(config-router)# ",  };  static struct cmd_node interface_node = { -	INTERFACE_NODE, "%s(config-if)# ", +	.node = INTERFACE_NODE, +	.prompt = "%s(config-if)# ",  }; -static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# "}; +static struct cmd_node rmap_node = { +	.node = RMAP_NODE, +	.prompt = "%s(config-route-map)# ", +}; -static struct cmd_node zebra_node = {ZEBRA_NODE, "%s(config-router)# "}; +static struct cmd_node zebra_node = { +	.node = ZEBRA_NODE, +	.prompt = "%s(config-router)# ", +}; -static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE, -					 "%s(config-router-af)# "}; +static struct cmd_node bgp_vpnv4_node = { +	.node = BGP_VPNV4_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv4_node = {BGP_IPV4_NODE, -					"%s(config-router-af)# "}; +static struct cmd_node bgp_ipv4_node = { +	.node = BGP_IPV4_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv4m_node = {BGP_IPV4M_NODE, -					 "%s(config-router-af)# "}; +static struct cmd_node bgp_ipv4m_node = { +	.node = BGP_IPV4M_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv6_node = {BGP_IPV6_NODE, -					"%s(config-router-af)# "}; +static struct cmd_node bgp_ipv6_node = { +	.node = BGP_IPV6_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv6m_node = {BGP_IPV6M_NODE, -					 "%s(config-router-af)# "}; +static struct cmd_node bgp_ipv6m_node = { +	.node = BGP_IPV6M_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node ospf_node = {OSPF_NODE, "%s(config-router)# "}; +static struct cmd_node ospf_node = { +	.node = OSPF_NODE, +	.prompt = "%s(config-router)# ", +}; -static struct cmd_node ripng_node = {RIPNG_NODE, "%s(config-router)# "}; +static struct cmd_node ripng_node = { +	.node = RIPNG_NODE, +	.prompt = "%s(config-router)# ", +}; -static struct cmd_node ospf6_node = {OSPF6_NODE, "%s(config-ospf6)# "}; +static struct cmd_node ospf6_node = { +	.node = OSPF6_NODE, +	.prompt = "%s(config-ospf6)# ", +}; -static struct cmd_node keychain_node = {KEYCHAIN_NODE, "%s(config-keychain)# "}; +static struct cmd_node keychain_node = { +	.node = KEYCHAIN_NODE, +	.prompt = "%s(config-keychain)# ", +}; -static struct cmd_node keychain_key_node = {KEYCHAIN_KEY_NODE, -					    "%s(config-keychain-key)# "}; +static struct cmd_node keychain_key_node = { +	.node = KEYCHAIN_KEY_NODE, +	.prompt = "%s(config-keychain-key)# ", +};  static int test_callback(const struct cmd_element *cmd, struct vty *vty,  			 int argc, struct cmd_token *argv[]) diff --git a/vrrpd/vrrp_vty.c b/vrrpd/vrrp_vty.c index 892c8dadd4..98e0e598e9 100644 --- a/vrrpd/vrrp_vty.c +++ b/vrrpd/vrrp_vty.c @@ -744,9 +744,23 @@ static int vrrp_config_write_interface(struct vty *vty)  	return write;  } -static struct cmd_node interface_node = {INTERFACE_NODE, "%s(config-if)# ", 1}; -static struct cmd_node debug_node = {DEBUG_NODE, "", 1}; -static struct cmd_node vrrp_node = {VRRP_NODE, "", 1}; +static struct cmd_node interface_node = { +	.node = INTERFACE_NODE, +	.prompt = "%s(config-if)# ", +	.vtysh = 1, +}; + +static struct cmd_node debug_node = { +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +}; + +static struct cmd_node vrrp_node = { +	.node = VRRP_NODE, +	.prompt = "", +	.vtysh = 1, +};  void vrrp_vty_init(void)  { diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index a5fa686eb5..b8fd311422 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1173,141 +1173,235 @@ static char **new_completion(const char *text, int start, int end)  /* Vty node structures. */  static struct cmd_node bgp_node = { -	BGP_NODE, "%s(config-router)# ", +	.node = BGP_NODE, +	.prompt = "%s(config-router)# ",  };  static struct cmd_node rip_node = { -	RIP_NODE, "%s(config-router)# ", +	.node = RIP_NODE, +	.prompt = "%s(config-router)# ",  };  static struct cmd_node isis_node = { -	ISIS_NODE, "%s(config-router)# ", +	.node = ISIS_NODE, +	.prompt = "%s(config-router)# ",  };  static struct cmd_node openfabric_node = { -	OPENFABRIC_NODE, "%s(config-router)# ", +	.node = OPENFABRIC_NODE, +	.prompt = "%s(config-router)# ",  };  static struct cmd_node interface_node = { -	INTERFACE_NODE, "%s(config-if)# ", +	.node = INTERFACE_NODE, +	.prompt = "%s(config-if)# ",  };  static struct cmd_node pw_node = { -	PW_NODE, "%s(config-pw)# ", +	.node = PW_NODE, +	.prompt = "%s(config-pw)# ",  };  static struct cmd_node vrf_node = { -	VRF_NODE, "%s(config-vrf)# ", +	.node = VRF_NODE, +	.prompt = "%s(config-vrf)# ",  };  static struct cmd_node nh_group_node = { -	NH_GROUP_NODE, -	"%s(config-nh-group)# ", +	.node = NH_GROUP_NODE, +	.prompt = "%s(config-nh-group)# ",  }; -static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# "}; +static struct cmd_node rmap_node = { +	.node = RMAP_NODE, +	.prompt = "%s(config-route-map)# ", +}; -static struct cmd_node pbr_map_node = {PBRMAP_NODE, "%s(config-pbr-map)# "}; +static struct cmd_node pbr_map_node = { +	.node = PBRMAP_NODE, +	.prompt = "%s(config-pbr-map)# ", +}; -static struct cmd_node zebra_node = {ZEBRA_NODE, "%s(config-router)# "}; +static struct cmd_node zebra_node = { +	.node = ZEBRA_NODE, +	.prompt = "%s(config-router)# ", +}; -static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE, -					 "%s(config-router-af)# "}; +static struct cmd_node bgp_vpnv4_node = { +	.node = BGP_VPNV4_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_vpnv6_node = {BGP_VPNV6_NODE, -					 "%s(config-router-af)# "}; +static struct cmd_node bgp_vpnv6_node = { +	.node = BGP_VPNV6_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_flowspecv4_node = {BGP_FLOWSPECV4_NODE, -					"%s(config-router-af)# "}; +static struct cmd_node bgp_flowspecv4_node = { +	.node = BGP_FLOWSPECV4_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_flowspecv6_node = {BGP_FLOWSPECV6_NODE, -					"%s(config-router-af)# "}; +static struct cmd_node bgp_flowspecv6_node = { +	.node = BGP_FLOWSPECV6_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv4_node = {BGP_IPV4_NODE, -					"%s(config-router-af)# "}; +static struct cmd_node bgp_ipv4_node = { +	.node = BGP_IPV4_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv4m_node = {BGP_IPV4M_NODE, -					 "%s(config-router-af)# "}; +static struct cmd_node bgp_ipv4m_node = { +	.node = BGP_IPV4M_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv4l_node = {BGP_IPV4L_NODE, -					 "%s(config-router-af)# "}; +static struct cmd_node bgp_ipv4l_node = { +	.node = BGP_IPV4L_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv6_node = {BGP_IPV6_NODE, -					"%s(config-router-af)# "}; +static struct cmd_node bgp_ipv6_node = { +	.node = BGP_IPV6_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv6m_node = {BGP_IPV6M_NODE, -					 "%s(config-router-af)# "}; +static struct cmd_node bgp_ipv6m_node = { +	.node = BGP_IPV6M_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_evpn_node = {BGP_EVPN_NODE, -					"%s(config-router-af)# "}; +static struct cmd_node bgp_evpn_node = { +	.node = BGP_EVPN_NODE, +	.prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_evpn_vni_node = {BGP_EVPN_VNI_NODE, -					    "%s(config-router-af-vni)# "}; +static struct cmd_node bgp_evpn_vni_node = { +	.node = BGP_EVPN_VNI_NODE, +	.prompt = "%s(config-router-af-vni)# ", +}; -static struct cmd_node bgp_ipv6l_node = {BGP_IPV6L_NODE, -					 "%s(config-router-af)# "}; +static struct cmd_node bgp_ipv6l_node = { +	.node = BGP_IPV6L_NODE, +	.prompt = "%s(config-router-af)# ", +};  static struct cmd_node bgp_vnc_defaults_node = { -	BGP_VNC_DEFAULTS_NODE, "%s(config-router-vnc-defaults)# "}; +	.node = BGP_VNC_DEFAULTS_NODE, +	.prompt = "%s(config-router-vnc-defaults)# ", +};  static struct cmd_node bgp_vnc_nve_group_node = { -	BGP_VNC_NVE_GROUP_NODE, "%s(config-router-vnc-nve-group)# "}; +	.node = BGP_VNC_NVE_GROUP_NODE, +	.prompt = "%s(config-router-vnc-nve-group)# ", +}; -static struct cmd_node bgp_vrf_policy_node = {BGP_VRF_POLICY_NODE, -					      "%s(config-router-vrf-policy)# "}; +static struct cmd_node bgp_vrf_policy_node = { +	.node = BGP_VRF_POLICY_NODE, +	.prompt = "%s(config-router-vrf-policy)# ", +};  static struct cmd_node bgp_vnc_l2_group_node = { -	BGP_VNC_L2_GROUP_NODE, "%s(config-router-vnc-l2-group)# "}; +	.node = BGP_VNC_L2_GROUP_NODE, +	.prompt = "%s(config-router-vnc-l2-group)# ", +}; -static struct cmd_node bmp_node = {BMP_NODE, "%s(config-bgp-bmp)# "}; +static struct cmd_node bmp_node = { +	.node = BMP_NODE, +	.prompt = "%s(config-bgp-bmp)# " +}; -static struct cmd_node ospf_node = {OSPF_NODE, "%s(config-router)# "}; +static struct cmd_node ospf_node = { +	.node = OSPF_NODE, +	.prompt = "%s(config-router)# ", +}; -static struct cmd_node eigrp_node = {EIGRP_NODE, "%s(config-router)# "}; +static struct cmd_node eigrp_node = { +	.node = EIGRP_NODE, +	.prompt = "%s(config-router)# ", +}; -static struct cmd_node babel_node = {BABEL_NODE, "%s(config-router)# "}; +static struct cmd_node babel_node = { +	.node = BABEL_NODE, +	.prompt = "%s(config-router)# ", +}; -static struct cmd_node ripng_node = {RIPNG_NODE, "%s(config-router)# "}; +static struct cmd_node ripng_node = { +	.node = RIPNG_NODE, +	.prompt = "%s(config-router)# ", +}; -static struct cmd_node ospf6_node = {OSPF6_NODE, "%s(config-ospf6)# "}; +static struct cmd_node ospf6_node = { +	.node = OSPF6_NODE, +	.prompt = "%s(config-ospf6)# ", +}; -static struct cmd_node ldp_node = {LDP_NODE, "%s(config-ldp)# "}; +static struct cmd_node ldp_node = { +	.node = LDP_NODE, +	.prompt = "%s(config-ldp)# ", +}; -static struct cmd_node ldp_ipv4_node = {LDP_IPV4_NODE, "%s(config-ldp-af)# "}; +static struct cmd_node ldp_ipv4_node = { +	.node = LDP_IPV4_NODE, +	.prompt = "%s(config-ldp-af)# ", +}; -static struct cmd_node ldp_ipv6_node = {LDP_IPV6_NODE, "%s(config-ldp-af)# "}; +static struct cmd_node ldp_ipv6_node = { +	.node = LDP_IPV6_NODE, +	.prompt = "%s(config-ldp-af)# ", +}; -static struct cmd_node ldp_ipv4_iface_node = {LDP_IPV4_IFACE_NODE, -					      "%s(config-ldp-af-if)# "}; +static struct cmd_node ldp_ipv4_iface_node = { +	.node = LDP_IPV4_IFACE_NODE, +	.prompt = "%s(config-ldp-af-if)# ", +}; -static struct cmd_node ldp_ipv6_iface_node = {LDP_IPV6_IFACE_NODE, -					      "%s(config-ldp-af-if)# "}; +static struct cmd_node ldp_ipv6_iface_node = { +	.node = LDP_IPV6_IFACE_NODE, +	.prompt = "%s(config-ldp-af-if)# ", +}; -static struct cmd_node ldp_l2vpn_node = {LDP_L2VPN_NODE, "%s(config-l2vpn)# "}; +static struct cmd_node ldp_l2vpn_node = { +	.node = LDP_L2VPN_NODE, +	.prompt = "%s(config-l2vpn)# ", +}; -static struct cmd_node ldp_pseudowire_node = {LDP_PSEUDOWIRE_NODE, -					      "%s(config-l2vpn-pw)# "}; +static struct cmd_node ldp_pseudowire_node = { +	.node = LDP_PSEUDOWIRE_NODE, +	.prompt = "%s(config-l2vpn-pw)# ", +}; -static struct cmd_node keychain_node = {KEYCHAIN_NODE, "%s(config-keychain)# "}; +static struct cmd_node keychain_node = { +	.node = KEYCHAIN_NODE, +	.prompt = "%s(config-keychain)# ", +}; -static struct cmd_node keychain_key_node = {KEYCHAIN_KEY_NODE, -					    "%s(config-keychain-key)# "}; +static struct cmd_node keychain_key_node = { +	.node = KEYCHAIN_KEY_NODE, +	.prompt = "%s(config-keychain-key)# ", +};  struct cmd_node link_params_node = { -	LINK_PARAMS_NODE, "%s(config-link-params)# ", +	.node = LINK_PARAMS_NODE, +	.prompt = "%s(config-link-params)# ",  }; -static struct cmd_node rpki_node = {RPKI_NODE, "%s(config-rpki)# ", 1}; +static struct cmd_node rpki_node = { +	.node = RPKI_NODE, +	.prompt = "%s(config-rpki)# ", +	.vtysh = 1, +};  #if HAVE_BFDD > 0  static struct cmd_node bfd_node = { -	BFD_NODE, -	"%s(config-bfd)# ", +	.node = BFD_NODE, +	.prompt = "%s(config-bfd)# ",  };  static struct cmd_node bfd_peer_node = { -	BFD_PEER_NODE, -	"%s(config-bfd-peer)# ", +	.node = BFD_PEER_NODE, +	.prompt = "%s(config-bfd-peer)# ",  };  #endif /* HAVE_BFDD */ diff --git a/zebra/debug.c b/zebra/debug.c index 68f6b69305..6e177f8398 100644 --- a/zebra/debug.c +++ b/zebra/debug.c @@ -471,8 +471,11 @@ DEFPY (debug_zebra_nexthop,  }  /* Debug node. */ -struct cmd_node debug_node = {DEBUG_NODE, "", /* Debug node has no interface. */ -			      1}; +struct cmd_node debug_node = { +	.node = DEBUG_NODE, +	.prompt = "", +	.vtysh = 1, +};  static int config_write_debug(struct vty *vty)  { diff --git a/zebra/interface.c b/zebra/interface.c index 59cbfc6854..520d6a3360 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1664,7 +1664,11 @@ static void interface_update_stats(void)  #endif /* HAVE_NET_RT_IFLIST */  } -struct cmd_node interface_node = {INTERFACE_NODE, "%s(config-if)# ", 1}; +struct cmd_node interface_node = { +	.node = INTERFACE_NODE, +	.prompt = "%s(config-if)# ", +	.vtysh = 1, +};  #ifndef VTYSH_EXTRACT_PL  #include "zebra/interface_clippy.c" @@ -2074,7 +2078,9 @@ DEFUN (no_bandwidth_if,  struct cmd_node link_params_node = { -	LINK_PARAMS_NODE, "%s(config-link-params)# ", 1, +	.node = LINK_PARAMS_NODE, +	.prompt = "%s(config-link-params)# ", +	.vtysh = 1,  };  static void link_param_cmd_set_uint32(struct interface *ifp, uint32_t *field, diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 10cdf49d12..d0e1933172 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -1939,7 +1939,11 @@ static int fpm_remote_srv_write(struct vty *vty)  /* Zebra node  */ -static struct cmd_node zebra_node = {ZEBRA_NODE, "", 1}; +static struct cmd_node zebra_node = { +	.node = ZEBRA_NODE, +	.prompt = "", +	.vtysh = 1, +};  /** diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c index 796aa3f666..78a3110eae 100644 --- a/zebra/zebra_mpls_vty.c +++ b/zebra/zebra_mpls_vty.c @@ -450,7 +450,11 @@ DEFUN (no_mpls_label_global_block,  }  /* MPLS node for MPLS LSP. */ -static struct cmd_node mpls_node = {MPLS_NODE, "", 1}; +static struct cmd_node mpls_node = { +	.node = MPLS_NODE, +	.prompt = "", +	.vtysh = 1, +};  /* MPLS VTY.  */  void zebra_mpls_vty_init(void) diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c index 610a052c31..d16082c515 100644 --- a/zebra/zebra_pw.c +++ b/zebra/zebra_pw.c @@ -548,7 +548,9 @@ static int zebra_pw_config(struct vty *vty)  }  static struct cmd_node pw_node = { -	PW_NODE, "%s(config-pw)# ", 1, +	.node = PW_NODE, +	.prompt = "%s(config-pw)# ", +	.vtysh = 1,  };  void zebra_pw_vty_init(void) diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index ef3dc9808f..d663e4c5a9 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -3478,15 +3478,27 @@ DEFUN_HIDDEN (show_frr,  }  /* IP node for static routes. */ -static struct cmd_node ip_node = {IP_NODE, "", 1}; -static struct cmd_node protocol_node = {PROTOCOL_NODE, "", 1}; +static struct cmd_node ip_node = { +	.node = IP_NODE, +	.prompt = "", +	.vtysh = 1, +}; +static struct cmd_node protocol_node = { +	.node = PROTOCOL_NODE, +	.prompt = "", +	.vtysh = 1, +};  /* table node for routing tables. */ -static struct cmd_node table_node = {TABLE_NODE, -				     "", /* This node has no interface. */ -				     1}; -static struct cmd_node forwarding_node = {FORWARDING_NODE, -					  "", /* This node has no interface. */ -					  1}; +static struct cmd_node table_node = { +	.node = TABLE_NODE, +	.prompt = "", +	.vtysh = 1, +}; +static struct cmd_node forwarding_node = { +	.node = FORWARDING_NODE, +	.prompt = "", +	.vtysh = 1, +};  /* Route VTY.  */  void zebra_vty_init(void)  | 
