diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 307fb6c0a6..ddc03716e3 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -146,7 +146,6 @@ static struct stream * bgp_update_packet_eor (struct peer *peer, afi_t afi, safi_t safi) { struct stream *s; - struct stream *packet; if (DISABLE_BGP_ANNOUNCE) return NULL; @@ -179,10 +178,8 @@ bgp_update_packet_eor (struct peer *peer, afi_t afi, safi_t safi) } bgp_packet_set_size (s); - packet = stream_dup (s); - bgp_packet_add (peer, packet); - stream_free (s); - return packet; + bgp_packet_add (peer, s); + return s; } /* Get next packet to be written. */ @@ -676,7 +673,6 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi, u_char orf_type, u_char when_to_refresh, int remove) { struct stream *s; - struct stream *packet; struct bgp_filter *filter; int orf_refresh = 0; @@ -753,12 +749,8 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi, peer->host, afi, safi); } - /* Make real packet. */ - packet = stream_dup (s); - stream_free (s); - /* Add packet to the peer. */ - bgp_packet_add (peer, packet); + bgp_packet_add (peer, s); BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd); } @@ -769,7 +761,6 @@ bgp_capability_send (struct peer *peer, afi_t afi, safi_t safi, int capability_code, int action) { struct stream *s; - struct stream *packet; /* Adjust safi code. */ if (safi == SAFI_MPLS_VPN) @@ -799,12 +790,8 @@ bgp_capability_send (struct peer *peer, afi_t afi, safi_t safi, /* Set packet size. */ (void)bgp_packet_set_size (s); - /* Make real packet. */ - packet = stream_dup (s); - stream_free (s); - /* Add packet to the peer. */ - bgp_packet_add (peer, packet); + bgp_packet_add (peer, s); BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd); } diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index 979a823f17..43aea264eb 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -944,7 +944,6 @@ subgroup_default_update_packet (struct update_subgroup *subgrp, struct attr *attr, struct peer *from) { struct stream *s; - struct stream *packet; struct peer *peer; struct prefix p; unsigned long pos; @@ -1010,9 +1009,7 @@ subgroup_default_update_packet (struct update_subgroup *subgrp, /* Set size. */ bgp_packet_set_size (s); - packet = stream_dup (s); - stream_free (s); - (void) bpacket_queue_add (SUBGRP_PKTQ (subgrp), packet, &vecarr); + (void) bpacket_queue_add (SUBGRP_PKTQ (subgrp), s, &vecarr); subgroup_trigger_write(subgrp); } @@ -1021,7 +1018,6 @@ subgroup_default_withdraw_packet (struct update_subgroup *subgrp) { struct peer *peer; struct stream *s; - struct stream *packet; struct prefix p; unsigned long attrlen_pos = 0; unsigned long cp; @@ -1102,10 +1098,7 @@ subgroup_default_withdraw_packet (struct update_subgroup *subgrp) bgp_packet_set_size (s); - packet = stream_dup (s); - stream_free (s); - - (void) bpacket_queue_add (SUBGRP_PKTQ (subgrp), packet, NULL); + (void) bpacket_queue_add (SUBGRP_PKTQ (subgrp), s, NULL); subgroup_trigger_write(subgrp); } diff --git a/configure.ac b/configure.ac index a2cd6ad2f8..e44823262c 100755 --- a/configure.ac +++ b/configure.ac @@ -273,6 +273,8 @@ AC_ARG_ENABLE(configfile_mask, [ --enable-configfile-mask=ARG set mask for config files]) AC_ARG_ENABLE(logfile_mask, [ --enable-logfile-mask=ARG set mask for log files]) +AC_ARG_ENABLE(shell_access +[ --enable-shell-access Allow users to access shell/telnet/ssh]) AC_ARG_ENABLE(rtadv, [ --disable-rtadv disable IPV6 router advertisement feature]) @@ -322,6 +324,10 @@ if test x"${enable_time_check}" != x"no" ; then fi fi +if test "${enable_shell_access}" = "yes"; then + AC_DEFINE(HAVE_SHELL_ACCESS,,Allow user to use ssh/telnet/bash) +fi + if test "${enable_fpm}" = "yes"; then AC_DEFINE(HAVE_FPM,,Forwarding Plane Manager support) fi diff --git a/lib/memory.c b/lib/memory.c index 620bdee51e..a9149e10ff 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -392,12 +392,11 @@ show_memory_mallinfo (struct vty *vty) } #endif /* HAVE_MALLINFO */ -DEFUN (show_memory_all, - show_memory_all_cmd, - "show memory all", +DEFUN (show_memory, + show_memory_cmd, + "show memory", "Show running system information\n" - "Memory statistics\n" - "All memory statistics\n") + "Memory statistics\n") { struct mlist *ml; int needsep = 0; @@ -416,147 +415,15 @@ DEFUN (show_memory_all, return CMD_SUCCESS; } -ALIAS (show_memory_all, - show_memory_cmd, - "show memory", - "Show running system information\n" - "Memory statistics\n") - -DEFUN (show_memory_lib, - show_memory_lib_cmd, - "show memory lib", - SHOW_STR - "Memory statistics\n" - "Library memory\n") -{ - show_memory_vty (vty, memory_list_lib); - return CMD_SUCCESS; -} - -DEFUN (show_memory_zebra, - show_memory_zebra_cmd, - "show memory zebra", - SHOW_STR - "Memory statistics\n" - "Zebra memory\n") -{ - show_memory_vty (vty, memory_list_zebra); - return CMD_SUCCESS; -} - -DEFUN (show_memory_rip, - show_memory_rip_cmd, - "show memory rip", - SHOW_STR - "Memory statistics\n" - "RIP memory\n") -{ - show_memory_vty (vty, memory_list_rip); - return CMD_SUCCESS; -} - -DEFUN (show_memory_ripng, - show_memory_ripng_cmd, - "show memory ripng", - SHOW_STR - "Memory statistics\n" - "RIPng memory\n") -{ - show_memory_vty (vty, memory_list_ripng); - return CMD_SUCCESS; -} - -DEFUN (show_memory_babel, - show_memory_babel_cmd, - "show memory babel", - SHOW_STR - "Memory statistics\n" - "Babel memory\n") -{ - show_memory_vty (vty, memory_list_babel); - return CMD_SUCCESS; -} - -DEFUN (show_memory_bgp, - show_memory_bgp_cmd, - "show memory bgp", - SHOW_STR - "Memory statistics\n" - "BGP memory\n") -{ - show_memory_vty (vty, memory_list_bgp); - return CMD_SUCCESS; -} - -DEFUN (show_memory_ospf, - show_memory_ospf_cmd, - "show memory ospf", - SHOW_STR - "Memory statistics\n" - "OSPF memory\n") -{ - show_memory_vty (vty, memory_list_ospf); - return CMD_SUCCESS; -} - -DEFUN (show_memory_ospf6, - show_memory_ospf6_cmd, - "show memory ospf6", - SHOW_STR - "Memory statistics\n" - "OSPF6 memory\n") -{ - show_memory_vty (vty, memory_list_ospf6); - return CMD_SUCCESS; -} - -DEFUN (show_memory_isis, - show_memory_isis_cmd, - "show memory isis", - SHOW_STR - "Memory statistics\n" - "ISIS memory\n") -{ - show_memory_vty (vty, memory_list_isis); - return CMD_SUCCESS; -} void memory_init (void) { install_element (RESTRICTED_NODE, &show_memory_cmd); - install_element (RESTRICTED_NODE, &show_memory_all_cmd); - install_element (RESTRICTED_NODE, &show_memory_lib_cmd); - install_element (RESTRICTED_NODE, &show_memory_rip_cmd); - install_element (RESTRICTED_NODE, &show_memory_ripng_cmd); - install_element (RESTRICTED_NODE, &show_memory_babel_cmd); - install_element (RESTRICTED_NODE, &show_memory_bgp_cmd); - install_element (RESTRICTED_NODE, &show_memory_ospf_cmd); - install_element (RESTRICTED_NODE, &show_memory_ospf6_cmd); - install_element (RESTRICTED_NODE, &show_memory_isis_cmd); install_element (VIEW_NODE, &show_memory_cmd); - install_element (VIEW_NODE, &show_memory_all_cmd); - install_element (VIEW_NODE, &show_memory_lib_cmd); - install_element (VIEW_NODE, &show_memory_rip_cmd); - install_element (VIEW_NODE, &show_memory_ripng_cmd); - install_element (VIEW_NODE, &show_memory_babel_cmd); - install_element (VIEW_NODE, &show_memory_bgp_cmd); - install_element (VIEW_NODE, &show_memory_ospf_cmd); - install_element (VIEW_NODE, &show_memory_ospf6_cmd); - install_element (VIEW_NODE, &show_memory_isis_cmd); install_element (ENABLE_NODE, &show_memory_cmd); - install_element (ENABLE_NODE, &show_memory_all_cmd); - install_element (ENABLE_NODE, &show_memory_lib_cmd); - install_element (ENABLE_NODE, &show_memory_zebra_cmd); - install_element (ENABLE_NODE, &show_memory_rip_cmd); - install_element (ENABLE_NODE, &show_memory_ripng_cmd); - install_element (ENABLE_NODE, &show_memory_babel_cmd); - install_element (ENABLE_NODE, &show_memory_bgp_cmd); - install_element (ENABLE_NODE, &show_memory_ospf_cmd); - install_element (ENABLE_NODE, &show_memory_ospf6_cmd); - install_element (ENABLE_NODE, &show_memory_isis_cmd); } /* Stats querying from users */ diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index d134c027b6..5d8d319f57 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2319,6 +2319,7 @@ DEFUN (vtysh_traceroute6, } #endif +#if defined(HAVE_SHELL_ACCESS) DEFUN (vtysh_telnet, vtysh_telnet_cmd, "telnet WORD", @@ -2378,6 +2379,7 @@ DEFUN (vtysh_start_zsh, execute_command ("zsh", 0, NULL, NULL); return CMD_SUCCESS; } +#endif static void vtysh_install_default (enum node_type node) @@ -2808,9 +2810,11 @@ vtysh_init_vty (void) install_element (VIEW_NODE, &vtysh_ping6_cmd); install_element (VIEW_NODE, &vtysh_traceroute6_cmd); #endif +#if defined(HAVE_SHELL_ACCESS) install_element (VIEW_NODE, &vtysh_telnet_cmd); install_element (VIEW_NODE, &vtysh_telnet_port_cmd); install_element (VIEW_NODE, &vtysh_ssh_cmd); +#endif install_element (ENABLE_NODE, &vtysh_ping_cmd); install_element (ENABLE_NODE, &vtysh_ping_ip_cmd); install_element (ENABLE_NODE, &vtysh_traceroute_cmd); @@ -2819,13 +2823,15 @@ vtysh_init_vty (void) install_element (ENABLE_NODE, &vtysh_ping6_cmd); install_element (ENABLE_NODE, &vtysh_traceroute6_cmd); #endif +#if defined(HAVE_SHELL_ACCESS) install_element (ENABLE_NODE, &vtysh_telnet_cmd); install_element (ENABLE_NODE, &vtysh_telnet_port_cmd); install_element (ENABLE_NODE, &vtysh_ssh_cmd); install_element (ENABLE_NODE, &vtysh_start_shell_cmd); install_element (ENABLE_NODE, &vtysh_start_bash_cmd); install_element (ENABLE_NODE, &vtysh_start_zsh_cmd); - +#endif + install_element (VIEW_NODE, &vtysh_show_memory_cmd); install_element (ENABLE_NODE, &vtysh_show_memory_cmd);