mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 18:38:50 +00:00
Merge pull request #1527 from donaldsharp/zserv_thread
Zserv.h modifications
This commit is contained in:
commit
cb9cef73bd
@ -313,6 +313,8 @@ static inline void zebra_if_set_ziftype(struct interface *ifp,
|
|||||||
#define IS_ZEBRA_IF_VRF_SLAVE(ifp) \
|
#define IS_ZEBRA_IF_VRF_SLAVE(ifp) \
|
||||||
(((struct zebra_if *)(ifp->info))->zif_slave_type == ZEBRA_IF_SLAVE_VRF)
|
(((struct zebra_if *)(ifp->info))->zif_slave_type == ZEBRA_IF_SLAVE_VRF)
|
||||||
|
|
||||||
|
extern void zebra_if_init(void);
|
||||||
|
|
||||||
extern struct interface *if_lookup_by_index_per_ns(struct zebra_ns *,
|
extern struct interface *if_lookup_by_index_per_ns(struct zebra_ns *,
|
||||||
u_int32_t);
|
u_int32_t);
|
||||||
extern struct interface *if_lookup_by_name_per_ns(struct zebra_ns *,
|
extern struct interface *if_lookup_by_name_per_ns(struct zebra_ns *,
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include "zebra/zserv.h"
|
#include "zebra/zserv.h"
|
||||||
#include "zebra/zebra_ns.h"
|
#include "zebra/zebra_ns.h"
|
||||||
#include "zebra/zebra_vrf.h"
|
#include "zebra/zebra_vrf.h"
|
||||||
|
#include "zebra/rt.h"
|
||||||
#include "zebra/debug.h"
|
#include "zebra/debug.h"
|
||||||
#include "zebra/kernel_netlink.h"
|
#include "zebra/kernel_netlink.h"
|
||||||
#include "zebra/rt_netlink.h"
|
#include "zebra/rt_netlink.h"
|
||||||
|
@ -295,7 +295,7 @@ int main(int argc, char **argv)
|
|||||||
zebrad.master = frr_init();
|
zebrad.master = frr_init();
|
||||||
|
|
||||||
/* Zebra related initialize. */
|
/* Zebra related initialize. */
|
||||||
zebra_init();
|
zserv_init();
|
||||||
rib_init();
|
rib_init();
|
||||||
zebra_if_init();
|
zebra_if_init();
|
||||||
zebra_debug_init();
|
zebra_debug_init();
|
||||||
|
@ -435,4 +435,8 @@ static inline void rib_tables_iter_cleanup(rib_tables_iter_t *iter)
|
|||||||
DECLARE_HOOK(rib_update, (struct route_node * rn, const char *reason),
|
DECLARE_HOOK(rib_update, (struct route_node * rn, const char *reason),
|
||||||
(rn, reason))
|
(rn, reason))
|
||||||
|
|
||||||
|
|
||||||
|
extern void zebra_vty_init(void);
|
||||||
|
extern pid_t pid;
|
||||||
|
|
||||||
#endif /*_ZEBRA_RIB_H */
|
#endif /*_ZEBRA_RIB_H */
|
||||||
|
14
zebra/rt.h
14
zebra/rt.h
@ -112,4 +112,18 @@ extern int kernel_add_neigh(struct interface *ifp, struct ipaddr *ip,
|
|||||||
struct ethaddr *mac);
|
struct ethaddr *mac);
|
||||||
extern int kernel_del_neigh(struct interface *ifp, struct ipaddr *ip);
|
extern int kernel_del_neigh(struct interface *ifp, struct ipaddr *ip);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Southbound Initialization routines to get initial starting
|
||||||
|
* state.
|
||||||
|
*/
|
||||||
|
extern void interface_list(struct zebra_ns *zns);
|
||||||
|
extern void kernel_init(struct zebra_ns *zns);
|
||||||
|
extern void kernel_terminate(struct zebra_ns *zns);
|
||||||
|
extern void macfdb_read(struct zebra_ns *zns);
|
||||||
|
extern void macfdb_read_for_bridge(struct zebra_ns *zns, struct interface *ifp,
|
||||||
|
struct interface *br_if);
|
||||||
|
extern void neigh_read(struct zebra_ns *zns);
|
||||||
|
extern void neigh_read_for_vlan(struct zebra_ns *zns, struct interface *ifp);
|
||||||
|
extern void route_read(struct zebra_ns *zns);
|
||||||
|
|
||||||
#endif /* _ZEBRA_RT_H */
|
#endif /* _ZEBRA_RT_H */
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "vty.h"
|
#include "vty.h"
|
||||||
|
|
||||||
#include "zebra/rib.h"
|
#include "zebra/rib.h"
|
||||||
#include "zebra/zserv.h"
|
#include "zebra/rt.h"
|
||||||
|
|
||||||
/* Thank you, Solaris, for polluting application symbol namespace. */
|
/* Thank you, Solaris, for polluting application symbol namespace. */
|
||||||
#undef hook_register
|
#undef hook_register
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#ifdef GNU_LINUX
|
#ifdef GNU_LINUX
|
||||||
|
|
||||||
#include "vty.h"
|
#include "vty.h"
|
||||||
#include "zebra/zserv.h"
|
#include "zebra/rt.h"
|
||||||
#include "zebra/rt_netlink.h"
|
#include "zebra/rt_netlink.h"
|
||||||
|
|
||||||
void route_read(struct zebra_ns *zns)
|
void route_read(struct zebra_ns *zns)
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "vrf.h"
|
#include "vrf.h"
|
||||||
|
|
||||||
#include "zebra/zserv.h"
|
|
||||||
#include "zebra/rt.h"
|
#include "zebra/rt.h"
|
||||||
#include "zebra/kernel_socket.h"
|
#include "zebra/kernel_socket.h"
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "zebra_ns.h"
|
#include "zebra_ns.h"
|
||||||
#include "zebra_vrf.h"
|
#include "zebra_vrf.h"
|
||||||
#include "zebra_memory.h"
|
#include "zebra_memory.h"
|
||||||
|
#include "rt.h"
|
||||||
|
|
||||||
DEFINE_MTYPE(ZEBRA, ZEBRA_NS, "Zebra Name Space")
|
DEFINE_MTYPE(ZEBRA, ZEBRA_NS, "Zebra Name Space")
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#ifndef __ZEBRA_ROUTEMAP_H__
|
#ifndef __ZEBRA_ROUTEMAP_H__
|
||||||
#define __ZEBRA_ROUTEMAP_H__
|
#define __ZEBRA_ROUTEMAP_H__
|
||||||
|
|
||||||
|
extern void zebra_route_map_init(void);
|
||||||
extern void zebra_routemap_config_write_protocol(struct vty *vty);
|
extern void zebra_routemap_config_write_protocol(struct vty *vty);
|
||||||
extern char *zebra_get_import_table_route_map(afi_t afi, uint32_t table);
|
extern char *zebra_get_import_table_route_map(afi_t afi, uint32_t table);
|
||||||
extern void zebra_add_import_table_route_map(afi_t afi, const char *rmap_name,
|
extern void zebra_add_import_table_route_map(afi_t afi, const char *rmap_name,
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
#include "zebra/zebra_vty_clippy.c"
|
#include "zebra/zebra_vty_clippy.c"
|
||||||
#endif
|
#endif
|
||||||
#include "zebra/zserv.h"
|
#include "zebra/zserv.h"
|
||||||
|
#include "zebra/router-id.h"
|
||||||
|
#include "zebra/ipforward.h"
|
||||||
|
|
||||||
extern int allow_delete;
|
extern int allow_delete;
|
||||||
|
|
||||||
@ -2325,13 +2327,254 @@ static int config_write_protocol(struct vty *vty)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_NETLINK
|
||||||
|
/* Display default rtm_table for all clients. */
|
||||||
|
DEFUN (show_table,
|
||||||
|
show_table_cmd,
|
||||||
|
"show table",
|
||||||
|
SHOW_STR
|
||||||
|
"default routing table to use for all clients\n")
|
||||||
|
{
|
||||||
|
vty_out(vty, "table %d\n", zebrad.rtm_table_default);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (config_table,
|
||||||
|
config_table_cmd,
|
||||||
|
"table TABLENO",
|
||||||
|
"Configure target kernel routing table\n"
|
||||||
|
"TABLE integer\n")
|
||||||
|
{
|
||||||
|
zebrad.rtm_table_default = strtol(argv[1]->arg, (char **)0, 10);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (no_config_table,
|
||||||
|
no_config_table_cmd,
|
||||||
|
"no table [TABLENO]",
|
||||||
|
NO_STR
|
||||||
|
"Configure target kernel routing table\n"
|
||||||
|
"TABLE integer\n")
|
||||||
|
{
|
||||||
|
zebrad.rtm_table_default = 0;
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DEFUN (show_zebra,
|
||||||
|
show_zebra_cmd,
|
||||||
|
"show zebra",
|
||||||
|
SHOW_STR
|
||||||
|
ZEBRA_STR)
|
||||||
|
{
|
||||||
|
struct vrf *vrf;
|
||||||
|
|
||||||
|
vty_out(vty,
|
||||||
|
" Route Route Neighbor LSP LSP\n");
|
||||||
|
vty_out(vty,
|
||||||
|
"VRF Installs Removals Updates Installs Removals\n");
|
||||||
|
|
||||||
|
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) {
|
||||||
|
struct zebra_vrf *zvrf = vrf->info;
|
||||||
|
|
||||||
|
vty_out(vty, "%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64
|
||||||
|
" %10" PRIu64 " %10" PRIu64 "\n",
|
||||||
|
vrf->name, zvrf->installs, zvrf->removals,
|
||||||
|
zvrf->neigh_updates, zvrf->lsp_installs,
|
||||||
|
zvrf->lsp_removals);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (ip_forwarding,
|
||||||
|
ip_forwarding_cmd,
|
||||||
|
"ip forwarding",
|
||||||
|
IP_STR
|
||||||
|
"Turn on IP forwarding\n")
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = ipforward();
|
||||||
|
if (ret == 0)
|
||||||
|
ret = ipforward_on();
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
vty_out(vty, "Can't turn on IP forwarding\n");
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (no_ip_forwarding,
|
||||||
|
no_ip_forwarding_cmd,
|
||||||
|
"no ip forwarding",
|
||||||
|
NO_STR
|
||||||
|
IP_STR
|
||||||
|
"Turn off IP forwarding\n")
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = ipforward();
|
||||||
|
if (ret != 0)
|
||||||
|
ret = ipforward_off();
|
||||||
|
|
||||||
|
if (ret != 0) {
|
||||||
|
vty_out(vty, "Can't turn off IP forwarding\n");
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Only display ip forwarding is enabled or not. */
|
||||||
|
DEFUN (show_ip_forwarding,
|
||||||
|
show_ip_forwarding_cmd,
|
||||||
|
"show ip forwarding",
|
||||||
|
SHOW_STR
|
||||||
|
IP_STR
|
||||||
|
"IP forwarding status\n")
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = ipforward();
|
||||||
|
|
||||||
|
if (ret == 0)
|
||||||
|
vty_out(vty, "IP forwarding is off\n");
|
||||||
|
else
|
||||||
|
vty_out(vty, "IP forwarding is on\n");
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Only display ipv6 forwarding is enabled or not. */
|
||||||
|
DEFUN (show_ipv6_forwarding,
|
||||||
|
show_ipv6_forwarding_cmd,
|
||||||
|
"show ipv6 forwarding",
|
||||||
|
SHOW_STR
|
||||||
|
"IPv6 information\n"
|
||||||
|
"Forwarding status\n")
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = ipforward_ipv6();
|
||||||
|
|
||||||
|
switch (ret) {
|
||||||
|
case -1:
|
||||||
|
vty_out(vty, "ipv6 forwarding is unknown\n");
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
vty_out(vty, "ipv6 forwarding is %s\n", "off");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
vty_out(vty, "ipv6 forwarding is %s\n", "on");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
vty_out(vty, "ipv6 forwarding is %s\n", "off");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (ipv6_forwarding,
|
||||||
|
ipv6_forwarding_cmd,
|
||||||
|
"ipv6 forwarding",
|
||||||
|
IPV6_STR
|
||||||
|
"Turn on IPv6 forwarding\n")
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = ipforward_ipv6();
|
||||||
|
if (ret == 0)
|
||||||
|
ret = ipforward_ipv6_on();
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
vty_out(vty, "Can't turn on IPv6 forwarding\n");
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (no_ipv6_forwarding,
|
||||||
|
no_ipv6_forwarding_cmd,
|
||||||
|
"no ipv6 forwarding",
|
||||||
|
NO_STR
|
||||||
|
IPV6_STR
|
||||||
|
"Turn off IPv6 forwarding\n")
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = ipforward_ipv6();
|
||||||
|
if (ret != 0)
|
||||||
|
ret = ipforward_ipv6_off();
|
||||||
|
|
||||||
|
if (ret != 0) {
|
||||||
|
vty_out(vty, "Can't turn off IPv6 forwarding\n");
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Table configuration write function. */
|
||||||
|
static int config_write_table(struct vty *vty)
|
||||||
|
{
|
||||||
|
if (zebrad.rtm_table_default)
|
||||||
|
vty_out(vty, "table %d\n", zebrad.rtm_table_default);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IPForwarding configuration write function. */
|
||||||
|
static int config_write_forwarding(struct vty *vty)
|
||||||
|
{
|
||||||
|
/* FIXME: Find better place for that. */
|
||||||
|
router_id_write(vty);
|
||||||
|
|
||||||
|
if (!ipforward())
|
||||||
|
vty_out(vty, "no ip forwarding\n");
|
||||||
|
if (!ipforward_ipv6())
|
||||||
|
vty_out(vty, "no ipv6 forwarding\n");
|
||||||
|
vty_out(vty, "!\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* IP node for static routes. */
|
/* IP node for static routes. */
|
||||||
static struct cmd_node ip_node = {IP_NODE, "", 1};
|
static struct cmd_node ip_node = {IP_NODE, "", 1};
|
||||||
static struct cmd_node protocol_node = {PROTOCOL_NODE, "", 1};
|
static struct cmd_node protocol_node = {PROTOCOL_NODE, "", 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};
|
||||||
|
|
||||||
/* Route VTY. */
|
/* Route VTY. */
|
||||||
void zebra_vty_init(void)
|
void zebra_vty_init(void)
|
||||||
{
|
{
|
||||||
|
/* Install configuration write function. */
|
||||||
|
install_node(&table_node, config_write_table);
|
||||||
|
install_node(&forwarding_node, config_write_forwarding);
|
||||||
|
|
||||||
|
install_element(VIEW_NODE, &show_ip_forwarding_cmd);
|
||||||
|
install_element(CONFIG_NODE, &ip_forwarding_cmd);
|
||||||
|
install_element(CONFIG_NODE, &no_ip_forwarding_cmd);
|
||||||
|
install_element(ENABLE_NODE, &show_zebra_cmd);
|
||||||
|
|
||||||
|
#ifdef HAVE_NETLINK
|
||||||
|
install_element(VIEW_NODE, &show_table_cmd);
|
||||||
|
install_element(CONFIG_NODE, &config_table_cmd);
|
||||||
|
install_element(CONFIG_NODE, &no_config_table_cmd);
|
||||||
|
#endif /* HAVE_NETLINK */
|
||||||
|
|
||||||
|
install_element(VIEW_NODE, &show_ipv6_forwarding_cmd);
|
||||||
|
install_element(CONFIG_NODE, &ipv6_forwarding_cmd);
|
||||||
|
install_element(CONFIG_NODE, &no_ipv6_forwarding_cmd);
|
||||||
|
|
||||||
|
/* Route-map */
|
||||||
|
zebra_route_map_init();
|
||||||
|
|
||||||
install_node(&ip_node, zebra_ip_config);
|
install_node(&ip_node, zebra_ip_config);
|
||||||
install_node(&protocol_node, config_write_protocol);
|
install_node(&protocol_node, config_write_protocol);
|
||||||
|
|
||||||
|
245
zebra/zserv.c
245
zebra/zserv.c
@ -48,7 +48,6 @@
|
|||||||
#include "zebra/router-id.h"
|
#include "zebra/router-id.h"
|
||||||
#include "zebra/redistribute.h"
|
#include "zebra/redistribute.h"
|
||||||
#include "zebra/debug.h"
|
#include "zebra/debug.h"
|
||||||
#include "zebra/ipforward.h"
|
|
||||||
#include "zebra/zebra_rnh.h"
|
#include "zebra/zebra_rnh.h"
|
||||||
#include "zebra/rt_netlink.h"
|
#include "zebra/rt_netlink.h"
|
||||||
#include "zebra/interface.h"
|
#include "zebra/interface.h"
|
||||||
@ -3017,105 +3016,6 @@ struct zserv *zebra_find_client(u_char proto, u_short instance)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NETLINK
|
|
||||||
/* Display default rtm_table for all clients. */
|
|
||||||
DEFUN (show_table,
|
|
||||||
show_table_cmd,
|
|
||||||
"show table",
|
|
||||||
SHOW_STR
|
|
||||||
"default routing table to use for all clients\n")
|
|
||||||
{
|
|
||||||
vty_out(vty, "table %d\n", zebrad.rtm_table_default);
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (config_table,
|
|
||||||
config_table_cmd,
|
|
||||||
"table TABLENO",
|
|
||||||
"Configure target kernel routing table\n"
|
|
||||||
"TABLE integer\n")
|
|
||||||
{
|
|
||||||
zebrad.rtm_table_default = strtol(argv[1]->arg, (char **)0, 10);
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (no_config_table,
|
|
||||||
no_config_table_cmd,
|
|
||||||
"no table [TABLENO]",
|
|
||||||
NO_STR
|
|
||||||
"Configure target kernel routing table\n"
|
|
||||||
"TABLE integer\n")
|
|
||||||
{
|
|
||||||
zebrad.rtm_table_default = 0;
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DEFUN (ip_forwarding,
|
|
||||||
ip_forwarding_cmd,
|
|
||||||
"ip forwarding",
|
|
||||||
IP_STR
|
|
||||||
"Turn on IP forwarding\n")
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = ipforward();
|
|
||||||
if (ret == 0)
|
|
||||||
ret = ipforward_on();
|
|
||||||
|
|
||||||
if (ret == 0) {
|
|
||||||
vty_out(vty, "Can't turn on IP forwarding\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (no_ip_forwarding,
|
|
||||||
no_ip_forwarding_cmd,
|
|
||||||
"no ip forwarding",
|
|
||||||
NO_STR
|
|
||||||
IP_STR
|
|
||||||
"Turn off IP forwarding\n")
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = ipforward();
|
|
||||||
if (ret != 0)
|
|
||||||
ret = ipforward_off();
|
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
vty_out(vty, "Can't turn off IP forwarding\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (show_zebra,
|
|
||||||
show_zebra_cmd,
|
|
||||||
"show zebra",
|
|
||||||
SHOW_STR
|
|
||||||
ZEBRA_STR)
|
|
||||||
{
|
|
||||||
struct vrf *vrf;
|
|
||||||
|
|
||||||
vty_out(vty,
|
|
||||||
" Route Route Neighbor LSP LSP\n");
|
|
||||||
vty_out(vty,
|
|
||||||
"VRF Installs Removals Updates Installs Removals\n");
|
|
||||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
|
||||||
struct zebra_vrf *zvrf = vrf->info;
|
|
||||||
vty_out(vty, "%-25s %10" PRIu64 " %10" PRIu64 " %10" PRIu64
|
|
||||||
" %10" PRIu64 " %10" PRIu64 "\n",
|
|
||||||
vrf->name, zvrf->installs, zvrf->removals,
|
|
||||||
zvrf->neigh_updates, zvrf->lsp_installs,
|
|
||||||
zvrf->lsp_removals);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This command is for debugging purpose. */
|
/* This command is for debugging purpose. */
|
||||||
DEFUN (show_zebra_client,
|
DEFUN (show_zebra_client,
|
||||||
show_zebra_client_cmd,
|
show_zebra_client_cmd,
|
||||||
@ -3157,127 +3057,6 @@ DEFUN (show_zebra_client_summary,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Table configuration write function. */
|
|
||||||
static int config_write_table(struct vty *vty)
|
|
||||||
{
|
|
||||||
if (zebrad.rtm_table_default)
|
|
||||||
vty_out(vty, "table %d\n", zebrad.rtm_table_default);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* table node for routing tables. */
|
|
||||||
static struct cmd_node table_node = {TABLE_NODE,
|
|
||||||
"", /* This node has no interface. */
|
|
||||||
1};
|
|
||||||
|
|
||||||
/* Only display ip forwarding is enabled or not. */
|
|
||||||
DEFUN (show_ip_forwarding,
|
|
||||||
show_ip_forwarding_cmd,
|
|
||||||
"show ip forwarding",
|
|
||||||
SHOW_STR
|
|
||||||
IP_STR
|
|
||||||
"IP forwarding status\n")
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = ipforward();
|
|
||||||
|
|
||||||
if (ret == 0)
|
|
||||||
vty_out(vty, "IP forwarding is off\n");
|
|
||||||
else
|
|
||||||
vty_out(vty, "IP forwarding is on\n");
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Only display ipv6 forwarding is enabled or not. */
|
|
||||||
DEFUN (show_ipv6_forwarding,
|
|
||||||
show_ipv6_forwarding_cmd,
|
|
||||||
"show ipv6 forwarding",
|
|
||||||
SHOW_STR
|
|
||||||
"IPv6 information\n"
|
|
||||||
"Forwarding status\n")
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = ipforward_ipv6();
|
|
||||||
|
|
||||||
switch (ret) {
|
|
||||||
case -1:
|
|
||||||
vty_out(vty, "ipv6 forwarding is unknown\n");
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
vty_out(vty, "ipv6 forwarding is %s\n", "off");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
vty_out(vty, "ipv6 forwarding is %s\n", "on");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
vty_out(vty, "ipv6 forwarding is %s\n", "off");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (ipv6_forwarding,
|
|
||||||
ipv6_forwarding_cmd,
|
|
||||||
"ipv6 forwarding",
|
|
||||||
IPV6_STR
|
|
||||||
"Turn on IPv6 forwarding\n")
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = ipforward_ipv6();
|
|
||||||
if (ret == 0)
|
|
||||||
ret = ipforward_ipv6_on();
|
|
||||||
|
|
||||||
if (ret == 0) {
|
|
||||||
vty_out(vty, "Can't turn on IPv6 forwarding\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (no_ipv6_forwarding,
|
|
||||||
no_ipv6_forwarding_cmd,
|
|
||||||
"no ipv6 forwarding",
|
|
||||||
NO_STR
|
|
||||||
IPV6_STR
|
|
||||||
"Turn off IPv6 forwarding\n")
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = ipforward_ipv6();
|
|
||||||
if (ret != 0)
|
|
||||||
ret = ipforward_ipv6_off();
|
|
||||||
|
|
||||||
if (ret != 0) {
|
|
||||||
vty_out(vty, "Can't turn off IPv6 forwarding\n");
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IPForwarding configuration write function. */
|
|
||||||
static int config_write_forwarding(struct vty *vty)
|
|
||||||
{
|
|
||||||
/* FIXME: Find better place for that. */
|
|
||||||
router_id_write(vty);
|
|
||||||
|
|
||||||
if (!ipforward())
|
|
||||||
vty_out(vty, "no ip forwarding\n");
|
|
||||||
if (!ipforward_ipv6())
|
|
||||||
vty_out(vty, "no ipv6 forwarding\n");
|
|
||||||
vty_out(vty, "!\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* table node for routing tables. */
|
|
||||||
static struct cmd_node forwarding_node = {FORWARDING_NODE,
|
|
||||||
"", /* This node has no interface. */
|
|
||||||
1};
|
|
||||||
|
|
||||||
#if defined(HANDLE_ZAPI_FUZZING)
|
#if defined(HANDLE_ZAPI_FUZZING)
|
||||||
void zserv_read_file(char *input)
|
void zserv_read_file(char *input)
|
||||||
{
|
{
|
||||||
@ -3298,34 +3077,12 @@ void zserv_read_file(char *input)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialisation of zebra and installation of commands. */
|
void zserv_init(void)
|
||||||
void zebra_init(void)
|
|
||||||
{
|
{
|
||||||
/* Client list init. */
|
/* Client list init. */
|
||||||
zebrad.client_list = list_new();
|
zebrad.client_list = list_new();
|
||||||
zebrad.client_list->del = (void (*)(void *))zebra_client_free;
|
zebrad.client_list->del = (void (*)(void *))zebra_client_free;
|
||||||
|
|
||||||
/* Install configuration write function. */
|
|
||||||
install_node(&table_node, config_write_table);
|
|
||||||
install_node(&forwarding_node, config_write_forwarding);
|
|
||||||
|
|
||||||
install_element(VIEW_NODE, &show_ip_forwarding_cmd);
|
|
||||||
install_element(CONFIG_NODE, &ip_forwarding_cmd);
|
|
||||||
install_element(CONFIG_NODE, &no_ip_forwarding_cmd);
|
|
||||||
install_element(ENABLE_NODE, &show_zebra_cmd);
|
|
||||||
install_element(ENABLE_NODE, &show_zebra_client_cmd);
|
install_element(ENABLE_NODE, &show_zebra_client_cmd);
|
||||||
install_element(ENABLE_NODE, &show_zebra_client_summary_cmd);
|
install_element(ENABLE_NODE, &show_zebra_client_summary_cmd);
|
||||||
|
|
||||||
#ifdef HAVE_NETLINK
|
|
||||||
install_element(VIEW_NODE, &show_table_cmd);
|
|
||||||
install_element(CONFIG_NODE, &config_table_cmd);
|
|
||||||
install_element(CONFIG_NODE, &no_config_table_cmd);
|
|
||||||
#endif /* HAVE_NETLINK */
|
|
||||||
|
|
||||||
install_element(VIEW_NODE, &show_ipv6_forwarding_cmd);
|
|
||||||
install_element(CONFIG_NODE, &ipv6_forwarding_cmd);
|
|
||||||
install_element(CONFIG_NODE, &no_ipv6_forwarding_cmd);
|
|
||||||
|
|
||||||
/* Route-map */
|
|
||||||
zebra_route_map_init();
|
|
||||||
}
|
}
|
||||||
|
@ -148,22 +148,8 @@ extern struct zebra_t zebrad;
|
|||||||
extern unsigned int multipath_num;
|
extern unsigned int multipath_num;
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
extern void zebra_init(void);
|
extern void zserv_init(void);
|
||||||
extern void zebra_if_init(void);
|
|
||||||
extern void zebra_zserv_socket_init(char *path);
|
extern void zebra_zserv_socket_init(char *path);
|
||||||
extern void hostinfo_get(void);
|
|
||||||
extern void rib_init(void);
|
|
||||||
extern void interface_list(struct zebra_ns *);
|
|
||||||
extern void route_read(struct zebra_ns *);
|
|
||||||
extern void macfdb_read(struct zebra_ns *);
|
|
||||||
extern void macfdb_read_for_bridge(struct zebra_ns *, struct interface *,
|
|
||||||
struct interface *);
|
|
||||||
extern void neigh_read(struct zebra_ns *);
|
|
||||||
extern void neigh_read_for_vlan(struct zebra_ns *, struct interface *);
|
|
||||||
extern void kernel_init(struct zebra_ns *);
|
|
||||||
extern void kernel_terminate(struct zebra_ns *);
|
|
||||||
extern void zebra_route_map_init(void);
|
|
||||||
extern void zebra_vty_init(void);
|
|
||||||
|
|
||||||
extern int zsend_vrf_add(struct zserv *, struct zebra_vrf *);
|
extern int zsend_vrf_add(struct zserv *, struct zebra_vrf *);
|
||||||
extern int zsend_vrf_delete(struct zserv *, struct zebra_vrf *);
|
extern int zsend_vrf_delete(struct zserv *, struct zebra_vrf *);
|
||||||
@ -189,8 +175,6 @@ extern int zsend_route_notify_owner(u_char proto, u_short instance,
|
|||||||
vrf_id_t vrf_id, struct prefix *p,
|
vrf_id_t vrf_id, struct prefix *p,
|
||||||
enum zapi_route_notify_owner note);
|
enum zapi_route_notify_owner note);
|
||||||
|
|
||||||
extern pid_t pid;
|
|
||||||
|
|
||||||
extern void zserv_create_header(struct stream *s, uint16_t cmd,
|
extern void zserv_create_header(struct stream *s, uint16_t cmd,
|
||||||
vrf_id_t vrf_id);
|
vrf_id_t vrf_id);
|
||||||
extern void zserv_nexthop_num_warn(const char *, const struct prefix *,
|
extern void zserv_nexthop_num_warn(const char *, const struct prefix *,
|
||||||
|
Loading…
Reference in New Issue
Block a user