Merge remote-tracking branch 'origin/cmaster-next' into vtysh-grammar

This commit is contained in:
Donald Sharp 2016-09-20 21:17:34 -04:00
commit 460a768914
151 changed files with 2320 additions and 1704 deletions

View File

@ -69,7 +69,6 @@ deficient is made.
autoconf: 2.59 (2.60 on 2006-06-26 is too recent to require) autoconf: 2.59 (2.60 on 2006-06-26 is too recent to require)
libtool: 1.5.22 (released 2005-12-18) libtool: 1.5.22 (released 2005-12-18)
texinfo: 4.7 (released 2004-04-10; 4.8 is not yet common) texinfo: 4.7 (released 2004-04-10; 4.8 is not yet common)
GNU AWK: 3.1.5 (released 2005-08-12)
For running tests, one also needs: For running tests, one also needs:

View File

@ -11,6 +11,7 @@ sbin_PROGRAMS = bgpd
bin_PROGRAMS = bgp_btoa bin_PROGRAMS = bgp_btoa
libbgp_a_SOURCES = \ libbgp_a_SOURCES = \
bgp_memory.c \
bgpd.c bgp_fsm.c bgp_aspath.c bgp_community.c bgp_attr.c \ bgpd.c bgp_fsm.c bgp_aspath.c bgp_community.c bgp_attr.c \
bgp_debug.c bgp_route.c bgp_zebra.c bgp_open.c bgp_routemap.c \ bgp_debug.c bgp_route.c bgp_zebra.c bgp_open.c bgp_routemap.c \
bgp_packet.c bgp_network.c bgp_filter.c bgp_regex.c bgp_clist.c \ bgp_packet.c bgp_network.c bgp_filter.c bgp_regex.c bgp_clist.c \
@ -20,6 +21,7 @@ libbgp_a_SOURCES = \
bgp_encap.c bgp_encap_tlv.c bgp_encap.c bgp_encap_tlv.c
noinst_HEADERS = \ noinst_HEADERS = \
bgp_memory.h \
bgp_aspath.h bgp_attr.h bgp_community.h bgp_debug.h bgp_fsm.h \ bgp_aspath.h bgp_attr.h bgp_community.h bgp_debug.h bgp_fsm.h \
bgp_network.h bgp_open.h bgp_packet.h bgp_regex.h bgp_route.h \ bgp_network.h bgp_open.h bgp_packet.h bgp_regex.h bgp_route.h \
bgpd.h bgp_filter.h bgp_clist.h bgp_dump.h bgp_zebra.h \ bgpd.h bgp_filter.h bgp_clist.h bgp_dump.h bgp_zebra.h \

View File

@ -21,6 +21,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifndef _QUAGGA_BGP_ADVERTISE_H #ifndef _QUAGGA_BGP_ADVERTISE_H
#define _QUAGGA_BGP_ADVERTISE_H #define _QUAGGA_BGP_ADVERTISE_H
#include <lib/fifo.h>
struct update_subgroup; struct update_subgroup;
/* BGP advertise FIFO. */ /* BGP advertise FIFO. */

View File

@ -23,6 +23,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "hash.h" #include "hash.h"
#include "memory.h" #include "memory.h"
#include "bgpd/bgp_memory.h"
#include "bgpd/bgp_community.h" #include "bgpd/bgp_community.h"
/* Hash of community attribute. */ /* Hash of community attribute. */

View File

@ -51,6 +51,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_updgrp.h" #include "bgpd/bgp_updgrp.h"
#include "bgpd/bgp_nht.h" #include "bgpd/bgp_nht.h"
#include "bgpd/bgp_bfd.h" #include "bgpd/bgp_bfd.h"
#include "bgpd/bgp_memory.h"
/* Definition of display strings corresponding to FSM events. This should be /* Definition of display strings corresponding to FSM events. This should be
* kept consistent with the events defined in bgpd.h * kept consistent with the events defined in bgpd.h
@ -166,12 +167,12 @@ peer_xfer_conn(struct peer *from_peer)
{ {
if (peer->hostname) if (peer->hostname)
{ {
XFREE(MTYPE_HOST, peer->hostname); XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
peer->hostname = NULL; peer->hostname = NULL;
} }
peer->hostname = XSTRDUP(MTYPE_HOST, from_peer->hostname); peer->hostname = XSTRDUP(MTYPE_BGP_PEER_HOST, from_peer->hostname);
XFREE(MTYPE_HOST, from_peer->hostname); XFREE(MTYPE_BGP_PEER_HOST, from_peer->hostname);
from_peer->hostname = NULL; from_peer->hostname = NULL;
} }
@ -179,12 +180,12 @@ peer_xfer_conn(struct peer *from_peer)
{ {
if (peer->domainname) if (peer->domainname)
{ {
XFREE(MTYPE_HOST, peer->domainname); XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer->domainname= NULL; peer->domainname= NULL;
} }
peer->domainname = XSTRDUP(MTYPE_HOST, from_peer->domainname); peer->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST, from_peer->domainname);
XFREE(MTYPE_HOST, from_peer->domainname); XFREE(MTYPE_BGP_PEER_HOST, from_peer->domainname);
from_peer->domainname = NULL; from_peer->domainname = NULL;
} }
@ -1329,10 +1330,10 @@ bgp_start (struct peer *peer)
if (!bgp_find_or_add_nexthop(peer->bgp, family2afi(peer->su.sa.sa_family), if (!bgp_find_or_add_nexthop(peer->bgp, family2afi(peer->su.sa.sa_family),
NULL, peer, connected)) NULL, peer, connected))
{ {
#if defined (HAVE_CUMULUS)
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))
zlog_debug ("%s [FSM] Waiting for NHT", peer->host); zlog_debug ("%s [FSM] Waiting for NHT", peer->host);
#if !defined (HAVE_BGP_STANDALONE)
BGP_EVENT_ADD(peer, TCP_connection_open_failed); BGP_EVENT_ADD(peer, TCP_connection_open_failed);
return 0; return 0;
#endif #endif

View File

@ -27,6 +27,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "thread.h" #include "thread.h"
#include <lib/version.h> #include <lib/version.h>
#include "memory.h" #include "memory.h"
#include "memory_vty.h"
#include "prefix.h" #include "prefix.h"
#include "log.h" #include "log.h"
#include "privs.h" #include "privs.h"

110
bgpd/bgp_memory.c Normal file
View File

@ -0,0 +1,110 @@
/* bgpd memory type definitions
*
* Copyright (C) 2015 David Lamparter
*
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* Quagga is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Quagga; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "bgp_memory.h"
/* this file is temporary in nature; definitions should be moved to the
* files they're used in */
DEFINE_MGROUP(BGPD, "bgpd")
DEFINE_MTYPE(BGPD, BGP, "BGP instance")
DEFINE_MTYPE(BGPD, BGP_LISTENER, "BGP listen socket details")
DEFINE_MTYPE(BGPD, BGP_PEER, "BGP peer")
DEFINE_MTYPE(BGPD, BGP_PEER_HOST, "BGP peer hostname")
DEFINE_MTYPE(BGPD, BGP_PEER_IFNAME, "BGP peer ifname")
DEFINE_MTYPE(BGPD, PEER_GROUP, "Peer group")
DEFINE_MTYPE(BGPD, PEER_GROUP_HOST, "BGP Peer group hostname")
DEFINE_MTYPE(BGPD, PEER_DESC, "Peer description")
DEFINE_MTYPE(BGPD, PEER_PASSWORD, "Peer password string")
DEFINE_MTYPE(BGPD, BGP_PEER_AF, "BGP peer af")
DEFINE_MTYPE(BGPD, BGP_UPDGRP, "BGP update group")
DEFINE_MTYPE(BGPD, BGP_UPD_SUBGRP, "BGP update subgroup")
DEFINE_MTYPE(BGPD, BGP_PACKET, "BGP packet")
DEFINE_MTYPE(BGPD, ATTR, "BGP attribute")
DEFINE_MTYPE(BGPD, ATTR_EXTRA, "BGP extra attributes")
DEFINE_MTYPE(BGPD, AS_PATH, "BGP aspath")
DEFINE_MTYPE(BGPD, AS_SEG, "BGP aspath seg")
DEFINE_MTYPE(BGPD, AS_SEG_DATA, "BGP aspath segment data")
DEFINE_MTYPE(BGPD, AS_STR, "BGP aspath str")
DEFINE_MTYPE(BGPD, BGP_TABLE, "BGP table")
DEFINE_MTYPE(BGPD, BGP_NODE, "BGP node")
DEFINE_MTYPE(BGPD, BGP_ROUTE, "BGP route")
DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA, "BGP ancillary route info")
DEFINE_MTYPE(BGPD, BGP_CONN, "BGP connected")
DEFINE_MTYPE(BGPD, BGP_STATIC, "BGP static")
DEFINE_MTYPE(BGPD, BGP_ADVERTISE_ATTR, "BGP adv attr")
DEFINE_MTYPE(BGPD, BGP_ADVERTISE, "BGP adv")
DEFINE_MTYPE(BGPD, BGP_SYNCHRONISE, "BGP synchronise")
DEFINE_MTYPE(BGPD, BGP_ADJ_IN, "BGP adj in")
DEFINE_MTYPE(BGPD, BGP_ADJ_OUT, "BGP adj out")
DEFINE_MTYPE(BGPD, BGP_MPATH_INFO, "BGP multipath info")
DEFINE_MTYPE(BGPD, AS_LIST, "BGP AS list")
DEFINE_MTYPE(BGPD, AS_FILTER, "BGP AS filter")
DEFINE_MTYPE(BGPD, AS_FILTER_STR, "BGP AS filter str")
DEFINE_MTYPE(BGPD, COMMUNITY, "community")
DEFINE_MTYPE(BGPD, COMMUNITY_VAL, "community val")
DEFINE_MTYPE(BGPD, COMMUNITY_STR, "community str")
DEFINE_MTYPE(BGPD, ECOMMUNITY, "extcommunity")
DEFINE_MTYPE(BGPD, ECOMMUNITY_VAL, "extcommunity val")
DEFINE_MTYPE(BGPD, ECOMMUNITY_STR, "extcommunity str")
DEFINE_MTYPE(BGPD, COMMUNITY_LIST, "community-list")
DEFINE_MTYPE(BGPD, COMMUNITY_LIST_NAME, "community-list name")
DEFINE_MTYPE(BGPD, COMMUNITY_LIST_ENTRY, "community-list entry")
DEFINE_MTYPE(BGPD, COMMUNITY_LIST_CONFIG, "community-list config")
DEFINE_MTYPE(BGPD, COMMUNITY_LIST_HANDLER, "community-list handler")
DEFINE_MTYPE(BGPD, CLUSTER, "Cluster list")
DEFINE_MTYPE(BGPD, CLUSTER_VAL, "Cluster list val")
DEFINE_MTYPE(BGPD, BGP_PROCESS_QUEUE, "BGP Process queue")
DEFINE_MTYPE(BGPD, BGP_CLEAR_NODE_QUEUE, "BGP node clear queue")
DEFINE_MTYPE(BGPD, TRANSIT, "BGP transit attr")
DEFINE_MTYPE(BGPD, TRANSIT_VAL, "BGP transit val")
DEFINE_MTYPE(BGPD, BGP_DEBUG_FILTER, "BGP debug filter")
DEFINE_MTYPE(BGPD, BGP_DEBUG_STR, "BGP debug filter string")
DEFINE_MTYPE(BGPD, BGP_DISTANCE, "BGP distance")
DEFINE_MTYPE(BGPD, BGP_NEXTHOP_CACHE, "BGP nexthop")
DEFINE_MTYPE(BGPD, BGP_CONFED_LIST, "BGP confed list")
DEFINE_MTYPE(BGPD, PEER_UPDATE_SOURCE, "BGP peer update interface")
DEFINE_MTYPE(BGPD, PEER_CONF_IF, "BGP peer config interface")
DEFINE_MTYPE(BGPD, BGP_DAMP_INFO, "Dampening info")
DEFINE_MTYPE(BGPD, BGP_DAMP_ARRAY, "BGP Dampening array")
DEFINE_MTYPE(BGPD, BGP_REGEXP, "BGP regexp")
DEFINE_MTYPE(BGPD, BGP_AGGREGATE, "BGP aggregate")
DEFINE_MTYPE(BGPD, BGP_ADDR, "BGP own address")
DEFINE_MTYPE(BGPD, BGP_REDIST, "BGP redistribution")
DEFINE_MTYPE(BGPD, BGP_FILTER_NAME, "BGP Filter Information")
DEFINE_MTYPE(BGPD, BGP_DUMP_STR, "BGP Dump String Information")
DEFINE_MTYPE(BGPD, ENCAP_TLV, "ENCAP TLV")

108
bgpd/bgp_memory.h Normal file
View File

@ -0,0 +1,108 @@
/* bgpd memory type declarations
*
* Copyright (C) 2015 David Lamparter
*
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* Quagga is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Quagga; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef _QUAGGA_BGP_MEMORY_H
#define _QUAGGA_BGP_MEMORY_H
#include "memory.h"
DECLARE_MGROUP(BGPD)
DECLARE_MTYPE(BGP)
DECLARE_MTYPE(BGP_LISTENER)
DECLARE_MTYPE(BGP_PEER)
DECLARE_MTYPE(BGP_PEER_HOST)
DECLARE_MTYPE(BGP_PEER_IFNAME)
DECLARE_MTYPE(PEER_GROUP)
DECLARE_MTYPE(PEER_GROUP_HOST)
DECLARE_MTYPE(PEER_DESC)
DECLARE_MTYPE(PEER_PASSWORD)
DECLARE_MTYPE(BGP_PEER_AF)
DECLARE_MTYPE(BGP_UPDGRP)
DECLARE_MTYPE(BGP_UPD_SUBGRP)
DECLARE_MTYPE(BGP_PACKET)
DECLARE_MTYPE(ATTR)
DECLARE_MTYPE(ATTR_EXTRA)
DECLARE_MTYPE(AS_PATH)
DECLARE_MTYPE(AS_SEG)
DECLARE_MTYPE(AS_SEG_DATA)
DECLARE_MTYPE(AS_STR)
DECLARE_MTYPE(BGP_TABLE)
DECLARE_MTYPE(BGP_NODE)
DECLARE_MTYPE(BGP_ROUTE)
DECLARE_MTYPE(BGP_ROUTE_EXTRA)
DECLARE_MTYPE(BGP_CONN)
DECLARE_MTYPE(BGP_STATIC)
DECLARE_MTYPE(BGP_ADVERTISE_ATTR)
DECLARE_MTYPE(BGP_ADVERTISE)
DECLARE_MTYPE(BGP_SYNCHRONISE)
DECLARE_MTYPE(BGP_ADJ_IN)
DECLARE_MTYPE(BGP_ADJ_OUT)
DECLARE_MTYPE(BGP_MPATH_INFO)
DECLARE_MTYPE(AS_LIST)
DECLARE_MTYPE(AS_FILTER)
DECLARE_MTYPE(AS_FILTER_STR)
DECLARE_MTYPE(COMMUNITY)
DECLARE_MTYPE(COMMUNITY_VAL)
DECLARE_MTYPE(COMMUNITY_STR)
DECLARE_MTYPE(ECOMMUNITY)
DECLARE_MTYPE(ECOMMUNITY_VAL)
DECLARE_MTYPE(ECOMMUNITY_STR)
DECLARE_MTYPE(COMMUNITY_LIST)
DECLARE_MTYPE(COMMUNITY_LIST_NAME)
DECLARE_MTYPE(COMMUNITY_LIST_ENTRY)
DECLARE_MTYPE(COMMUNITY_LIST_CONFIG)
DECLARE_MTYPE(COMMUNITY_LIST_HANDLER)
DECLARE_MTYPE(CLUSTER)
DECLARE_MTYPE(CLUSTER_VAL)
DECLARE_MTYPE(BGP_PROCESS_QUEUE)
DECLARE_MTYPE(BGP_CLEAR_NODE_QUEUE)
DECLARE_MTYPE(TRANSIT)
DECLARE_MTYPE(TRANSIT_VAL)
DECLARE_MTYPE(BGP_DEBUG_FILTER)
DECLARE_MTYPE(BGP_DEBUG_STR)
DECLARE_MTYPE(BGP_DISTANCE)
DECLARE_MTYPE(BGP_NEXTHOP_CACHE)
DECLARE_MTYPE(BGP_CONFED_LIST)
DECLARE_MTYPE(PEER_UPDATE_SOURCE)
DECLARE_MTYPE(PEER_CONF_IF)
DECLARE_MTYPE(BGP_DAMP_INFO)
DECLARE_MTYPE(BGP_DAMP_ARRAY)
DECLARE_MTYPE(BGP_REGEXP)
DECLARE_MTYPE(BGP_AGGREGATE)
DECLARE_MTYPE(BGP_ADDR)
DECLARE_MTYPE(BGP_REDIST)
DECLARE_MTYPE(BGP_FILTER_NAME)
DECLARE_MTYPE(BGP_DUMP_STR)
DECLARE_MTYPE(ENCAP_TLV)
#endif /* _QUAGGA_BGP_MEMORY_H */

View File

@ -559,10 +559,9 @@ enum bgp_show_type
}; };
static int static int
bgp_show_mpls_vpn (struct vty *vty, struct prefix_rd *prd, enum bgp_show_type type, bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
void *output_arg, int tags, u_char use_json) enum bgp_show_type type, void *output_arg, int tags, u_char use_json)
{ {
afi_t afi = AFI_IP;
struct bgp *bgp; struct bgp *bgp;
struct bgp_table *table; struct bgp_table *table;
struct bgp_node *rn; struct bgp_node *rn;
@ -572,6 +571,8 @@ bgp_show_mpls_vpn (struct vty *vty, struct prefix_rd *prd, enum bgp_show_type ty
int header = 1; int header = 1;
char v4_header[] = " Network Next Hop Metric LocPrf Weight Path%s"; char v4_header[] = " Network Next Hop Metric LocPrf Weight Path%s";
char v4_header_tag[] = " Network Next Hop In tag/Out tag%s"; char v4_header_tag[] = " Network Next Hop In tag/Out tag%s";
unsigned long output_count = 0;
unsigned long total_count = 0;
json_object *json = NULL; json_object *json = NULL;
json_object *json_mroute = NULL; json_object *json_mroute = NULL;
json_object *json_nroute = NULL; json_object *json_nroute = NULL;
@ -624,6 +625,7 @@ bgp_show_mpls_vpn (struct vty *vty, struct prefix_rd *prd, enum bgp_show_type ty
for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm)) for (rm = bgp_table_top (table); rm; rm = bgp_route_next (rm))
{ {
total_count++;
if (use_json) if (use_json)
json_array = json_object_new_array(); json_array = json_object_new_array();
else else
@ -712,6 +714,7 @@ bgp_show_mpls_vpn (struct vty *vty, struct prefix_rd *prd, enum bgp_show_type ty
route_vty_out_tag (vty, &rm->p, ri, 0, SAFI_MPLS_VPN, json_array); route_vty_out_tag (vty, &rm->p, ri, 0, SAFI_MPLS_VPN, json_array);
else else
route_vty_out (vty, &rm->p, ri, 0, SAFI_MPLS_VPN, json_array); route_vty_out (vty, &rm->p, ri, 0, SAFI_MPLS_VPN, json_array);
output_count++;
} }
if (use_json) if (use_json)
@ -743,9 +746,87 @@ bgp_show_mpls_vpn (struct vty *vty, struct prefix_rd *prd, enum bgp_show_type ty
vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE); vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
json_object_free(json); json_object_free(json);
} }
else
{
if (output_count == 0)
vty_out (vty, "No prefixes displayed, %ld exist%s", total_count, VTY_NEWLINE);
else
vty_out (vty, "%sDisplayed %ld out of %ld total prefixes%s",
VTY_NEWLINE, output_count, total_count, VTY_NEWLINE);
}
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (show_bgp_ivp4_vpn,
show_bgp_ipv4_vpn_cmd,
"show bgp ipv4 vpn {json}",
SHOW_STR
BGP_STR
"Address Family\n"
"Display VPN NLRI specific information\n")
{
return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
}
DEFUN (show_bgp_ipv6_vpn,
show_bgp_ipv6_vpn_cmd,
"show bgp ipv6 vpn {json}",
SHOW_STR
BGP_STR
"Address Family\n"
"Display VPN NLRI specific information\n")
{
return bgp_show_mpls_vpn (vty, AFI_IP6, NULL, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
}
DEFUN (show_bgp_ipv4_vpn_rd,
show_bgp_ipv4_vpn_rd_cmd,
"show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn {json}",
SHOW_STR
BGP_STR
"Address Family\n"
"Display VPN NLRI specific information\n"
"Display information for a route distinguisher\n"
"VPN Route Distinguisher\n"
JSON_STR)
{
int ret;
struct prefix_rd prd;
ret = str2prefix_rd (argv[0], &prd);
if (! ret)
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
}
DEFUN (show_bgp_ipv6_vpn_rd,
show_bgp_ipv6_vpn_rd_cmd,
"show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn {json}",
SHOW_STR
BGP_STR
"Address Family\n"
"Display VPN NLRI specific information\n"
"Display information for a route distinguisher\n"
"VPN Route Distinguisher\n"
JSON_STR)
{
int ret;
struct prefix_rd prd;
ret = str2prefix_rd (argv[0], &prd);
if (!ret)
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
return bgp_show_mpls_vpn (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
}
DEFUN (show_ip_bgp_vpnv4_all, DEFUN (show_ip_bgp_vpnv4_all,
show_ip_bgp_vpnv4_all_cmd, show_ip_bgp_vpnv4_all_cmd,
"show ip bgp vpnv4 all", "show ip bgp vpnv4 all",
@ -755,7 +836,7 @@ DEFUN (show_ip_bgp_vpnv4_all,
"Display VPNv4 NLRI specific information\n" "Display VPNv4 NLRI specific information\n"
"Display information about all VPNv4 NLRIs\n") "Display information about all VPNv4 NLRIs\n")
{ {
return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_normal, NULL, 0, 0); return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0, 0);
} }
DEFUN (show_ip_bgp_vpnv4_rd, DEFUN (show_ip_bgp_vpnv4_rd,
@ -777,7 +858,7 @@ DEFUN (show_ip_bgp_vpnv4_rd,
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;
} }
return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_normal, NULL, 0, 0); return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0, 0);
} }
DEFUN (show_ip_bgp_vpnv4_all_tags, DEFUN (show_ip_bgp_vpnv4_all_tags,
@ -790,7 +871,7 @@ DEFUN (show_ip_bgp_vpnv4_all_tags,
"Display information about all VPNv4 NLRIs\n" "Display information about all VPNv4 NLRIs\n"
"Display BGP tags for prefixes\n") "Display BGP tags for prefixes\n")
{ {
return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_normal, NULL, 1, 0); return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 1, 0);
} }
DEFUN (show_ip_bgp_vpnv4_rd_tags, DEFUN (show_ip_bgp_vpnv4_rd_tags,
@ -813,7 +894,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_tags,
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE); vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING; return CMD_WARNING;
} }
return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_normal, NULL, 1, 0); return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 1, 0);
} }
DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes, DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes,
@ -866,7 +947,7 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes,
return CMD_WARNING; return CMD_WARNING;
} }
return bgp_show_mpls_vpn (vty, NULL, bgp_show_type_neighbor, &su, 0, uj); return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_neighbor, &su, 0, uj);
} }
DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes, DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
@ -937,7 +1018,7 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
return CMD_WARNING; return CMD_WARNING;
} }
return bgp_show_mpls_vpn (vty, &prd, bgp_show_type_neighbor, &su, 0, uj); return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_neighbor, &su, 0, uj);
} }
DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes, DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
@ -1069,7 +1150,10 @@ bgp_mplsvpn_init (void)
install_element (BGP_VPNV4_NODE, &vpnv4_network_route_map_cmd); install_element (BGP_VPNV4_NODE, &vpnv4_network_route_map_cmd);
install_element (BGP_VPNV4_NODE, &no_vpnv4_network_cmd); install_element (BGP_VPNV4_NODE, &no_vpnv4_network_cmd);
install_element (VIEW_NODE, &show_bgp_ipv4_vpn_cmd);
install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_vpn_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_tags_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_tags_cmd);
@ -1079,6 +1163,10 @@ bgp_mplsvpn_init (void)
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd); install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_rd_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_rd_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_tags_cmd); install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_tags_cmd);

View File

@ -253,7 +253,7 @@ bgp_get_instance_for_inc_conn (int sock, struct bgp **bgp_inst)
rc = getsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, name, &name_len); rc = getsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, name, &name_len);
if (rc != 0) if (rc != 0)
{ {
#if !defined (HAVE_BGP_STANDALONE) #if defined (HAVE_CUMULUS)
zlog_err ("[Error] BGP SO_BINDTODEVICE get failed (%s), sock %d", zlog_err ("[Error] BGP SO_BINDTODEVICE get failed (%s), sock %d",
safe_strerror (errno), sock); safe_strerror (errno), sock);
return -1; return -1;
@ -674,9 +674,9 @@ bgp_getsockname (struct peer *peer)
if (bgp_nexthop_set (peer->su_local, peer->su_remote, if (bgp_nexthop_set (peer->su_local, peer->su_remote,
&peer->nexthop, peer)) &peer->nexthop, peer))
{ {
#if defined (HAVE_CUMULUS)
zlog_err ("%s: nexthop_set failed, resetting connection - intf %p", zlog_err ("%s: nexthop_set failed, resetting connection - intf %p",
peer->host, peer->nexthop.ifp); peer->host, peer->nexthop.ifp);
#if !defined (HAVE_BGP_STANDALONE)
return -1; return -1;
#endif #endif
} }

View File

@ -47,8 +47,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "zebra/rib.h" #include "zebra/rib.h"
#include "zebra/zserv.h" /* For ZEBRA_SERV_PATH. */ #include "zebra/zserv.h" /* For ZEBRA_SERV_PATH. */
char * char *
bnc_str (struct bgp_nexthop_cache *bnc, char *buf, int size) bnc_str (struct bgp_nexthop_cache *bnc, char *buf, int size)
{ {
@ -59,14 +57,7 @@ bnc_str (struct bgp_nexthop_cache *bnc, char *buf, int size)
void void
bnc_nexthop_free (struct bgp_nexthop_cache *bnc) bnc_nexthop_free (struct bgp_nexthop_cache *bnc)
{ {
struct nexthop *nexthop; nexthops_free(bnc->nexthop);
struct nexthop *next = NULL;
for (nexthop = bnc->nexthop; nexthop; nexthop = next)
{
next = nexthop->next;
XFREE (MTYPE_NEXTHOP, nexthop);
}
} }
struct bgp_nexthop_cache * struct bgp_nexthop_cache *

View File

@ -39,6 +39,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_open.h" #include "bgpd/bgp_open.h"
#include "bgpd/bgp_aspath.h" #include "bgpd/bgp_aspath.h"
#include "bgpd/bgp_vty.h" #include "bgpd/bgp_vty.h"
#include "bgpd/bgp_memory.h"
/* BGP-4 Multiprotocol Extentions lead us to the complex world. We can /* BGP-4 Multiprotocol Extentions lead us to the complex world. We can
negotiate remote peer supports extentions or not. But if negotiate remote peer supports extentions or not. But if
@ -638,17 +639,17 @@ bgp_capability_hostname (struct peer *peer, struct capability_header *hdr)
if (peer->hostname != NULL) if (peer->hostname != NULL)
{ {
XFREE(MTYPE_HOST, peer->hostname); XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
peer->hostname = NULL; peer->hostname = NULL;
} }
if (peer->domainname != NULL) if (peer->domainname != NULL)
{ {
XFREE(MTYPE_HOST, peer->domainname); XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer->domainname = NULL; peer->domainname = NULL;
} }
peer->hostname = XSTRDUP(MTYPE_HOST, str); peer->hostname = XSTRDUP(MTYPE_BGP_PEER_HOST, str);
} }
if (stream_get_getp(s) +1 > end) if (stream_get_getp(s) +1 > end)
@ -678,7 +679,7 @@ bgp_capability_hostname (struct peer *peer, struct capability_header *hdr)
if (len) if (len)
{ {
str[len] = '\0'; str[len] = '\0';
peer->domainname = XSTRDUP(MTYPE_HOST, str); peer->domainname = XSTRDUP(MTYPE_BGP_PEER_HOST, str);
} }
if (bgp_debug_neighbor_events(peer)) if (bgp_debug_neighbor_events(peer))

View File

@ -1163,7 +1163,7 @@ bgp_open_receive (struct peer *peer, bgp_size_t size)
{ {
if (!peer->nexthop.v4.s_addr) if (!peer->nexthop.v4.s_addr)
{ {
#if !defined (HAVE_BGP_STANDALONE) #if defined (HAVE_CUMULUS)
zlog_err ("%s: No local IPv4 addr resetting connection, fd %d", zlog_err ("%s: No local IPv4 addr resetting connection, fd %d",
peer->host, peer->fd); peer->host, peer->fd);
bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_SUBCODE_UNSPECIFIC); bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_SUBCODE_UNSPECIFIC);
@ -1178,7 +1178,7 @@ bgp_open_receive (struct peer *peer, bgp_size_t size)
{ {
if (IN6_IS_ADDR_UNSPECIFIED (&peer->nexthop.v6_global)) if (IN6_IS_ADDR_UNSPECIFIED (&peer->nexthop.v6_global))
{ {
#if !defined (HAVE_BGP_STANDALONE) #if defined (HAVE_CUMULUS)
zlog_err ("%s: No local IPv6 addr resetting connection, fd %d", zlog_err ("%s: No local IPv6 addr resetting connection, fd %d",
peer->host, peer->fd); peer->host, peer->fd);
bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_SUBCODE_UNSPECIFIC); bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_SUBCODE_UNSPECIFIC);

View File

@ -8022,6 +8022,42 @@ DEFUN (show_bgp_ipv4_safi_route_pathtype,
return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj); return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_UNICAST, NULL, 0, BGP_PATH_MULTIPATH, uj);
} }
DEFUN (show_bgp_ipv4_prefix,
show_bgp_ipv4_prefix_cmd,
"show bgp ipv4 A.B.C.D/M {json}",
SHOW_STR
BGP_STR
IP_STR
"IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
JSON_STR)
{
return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc, argv));
}
DEFUN (show_bgp_ipv6_route,
show_bgp_ipv6_route_cmd,
"show bgp ipv6 X:X::X:X {JSON}",
SHOW_STR
BGP_STR
"Address family\n"
"Network in the BGP routing table to display\n"
JSON_STR)
{
return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json (argc, argv));
}
DEFUN (show_bgp_ipv6_prefix,
show_bgp_ipv6_prefix_cmd,
"show bgp ipv6 X:X::X:X/M {json}",
SHOW_STR
BGP_STR
IP_STR
"IPv6 prefix <network>/<length>\n"
JSON_STR)
{
return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json (argc,argv));
}
DEFUN (show_ip_bgp_ipv4_route, DEFUN (show_ip_bgp_ipv4_route,
show_ip_bgp_ipv4_route_cmd, show_ip_bgp_ipv4_route_cmd,
"show ip bgp ipv4 (unicast|multicast) A.B.C.D {json}", "show ip bgp ipv4 (unicast|multicast) A.B.C.D {json}",
@ -8067,6 +8103,79 @@ DEFUN (show_ip_bgp_vpnv4_all_route,
return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv));
} }
DEFUN (show_bgp_ipv4_vpn_route,
show_bgp_ipv4_vpn_route_cmd,
"show bgp ipv4 vpn A.B.C.D {json}",
SHOW_STR
BGP_STR
"Address Family\n"
"Display VPN NLRI specific information\n"
"Network in the BGP routing table to display\n"
JSON_STR)
{
return bgp_show_route (vty, NULL, argv[0], AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv));
}
DEFUN (show_bgp_ipv6_vpn_route,
show_bgp_ipv6_vpn_route_cmd,
"show bgp ipv6 vpn X:X::X:X {json}",
SHOW_STR
BGP_STR
"Address Family\n"
"Display VPN NLRI specific information\n"
"Network in the BGP routing table to display\n"
JSON_STR)
{
return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json (argc, argv));
}
DEFUN (show_bgp_ipv4_vpn_rd_route,
show_bgp_ipv4_vpn_rd_route_cmd,
"show bgp ipv4 vpn rd ASN:nn_or_IP-address:nn A.B.C.D {json}",
SHOW_STR
BGP_STR
IP_STR
"Display VPN NLRI specific information\n"
"Display information for a route distinguisher\n"
"VPN Route Distinguisher\n"
"Network in the BGP routing table to display\n"
JSON_STR)
{
int ret;
struct prefix_rd prd;
ret = str2prefix_rd (argv[0], &prd);
if (! ret)
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
return bgp_show_route (vty, NULL, argv[1], AFI_IP, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv));
}
DEFUN (show_bgp_ipv6_vpn_rd_route,
show_bgp_ipv6_vpn_rd_route_cmd,
"show bgp ipv6 vpn rd ASN:nn_or_IP-address:nn X:X::X:X {json}",
SHOW_STR
BGP_STR
"Address Family\n"
"Display VPN NLRI specific information\n"
"Display information for a route distinguisher\n"
"VPN Route Distinguisher\n"
"Network in the BGP routing table to display\n"
JSON_STR)
{
int ret;
struct prefix_rd prd;
ret = str2prefix_rd (argv[0], &prd);
if (! ret)
{
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
return CMD_WARNING;
}
return bgp_show_route (vty, NULL, argv[1], AFI_IP6, SAFI_MPLS_VPN, &prd, 0, BGP_PATH_ALL, use_json (argc, argv));
}
DEFUN (show_ip_bgp_vpnv4_rd_route, DEFUN (show_ip_bgp_vpnv4_rd_route,
show_ip_bgp_vpnv4_rd_route_cmd, show_ip_bgp_vpnv4_rd_route_cmd,
@ -8406,15 +8515,6 @@ DEFUN (show_bgp_route,
return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 0, BGP_PATH_ALL, use_json(argc, argv));
} }
ALIAS (show_bgp_route,
show_bgp_ipv6_route_cmd,
"show bgp ipv6 X:X::X:X {json}",
SHOW_STR
BGP_STR
"Address family\n"
"Network in the BGP routing table to display\n"
"JavaScript Object Notation\n")
DEFUN (show_bgp_ipv6_safi_route, DEFUN (show_bgp_ipv6_safi_route,
show_bgp_ipv6_safi_route_cmd, show_bgp_ipv6_safi_route_cmd,
"show bgp ipv6 (unicast|multicast) X:X::X:X {json}", "show bgp ipv6 (unicast|multicast) X:X::X:X {json}",
@ -8512,15 +8612,6 @@ DEFUN (show_bgp_prefix,
return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv)); return bgp_show_route (vty, NULL, argv[0], AFI_IP6, SAFI_UNICAST, NULL, 1, BGP_PATH_ALL, use_json(argc, argv));
} }
ALIAS (show_bgp_prefix,
show_bgp_ipv6_prefix_cmd,
"show bgp ipv6 X:X::X:X/M {json}",
SHOW_STR
BGP_STR
"Address family\n"
"IPv6 prefix <network>/<length>\n"
"JavaScript Object Notation\n")
DEFUN (show_bgp_ipv6_safi_prefix, DEFUN (show_bgp_ipv6_safi_prefix,
show_bgp_ipv6_safi_prefix_cmd, show_bgp_ipv6_safi_prefix_cmd,
"show bgp ipv6 (unicast|multicast) X:X::X:X/M {json}", "show bgp ipv6 (unicast|multicast) X:X::X:X/M {json}",
@ -14757,6 +14848,18 @@ bgp_route_init (void)
install_element (ENABLE_NODE, &show_ip_bgp_neighbor_flap_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_flap_cmd);
install_element (ENABLE_NODE, &show_ip_bgp_neighbor_damp_cmd); install_element (ENABLE_NODE, &show_ip_bgp_neighbor_damp_cmd);
install_element (VIEW_NODE, &show_bgp_ipv4_prefix_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv4_prefix_cmd);
install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_route_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_rd_route_cmd);
install_element (VIEW_NODE, &show_bgp_ipv4_vpn_route_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_route_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_route_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_rd_route_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_vpn_route_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_route_cmd);
/* BGP dampening clear commands */ /* BGP dampening clear commands */
install_element (ENABLE_NODE, &clear_ip_bgp_dampening_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_dampening_cmd);
install_element (ENABLE_NODE, &clear_ip_bgp_dampening_prefix_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_dampening_prefix_cmd);

View File

@ -30,6 +30,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "thread.h" #include "thread.h"
#include "log.h" #include "log.h"
#include "memory.h" #include "memory.h"
#include "memory_vty.h"
#include "hash.h" #include "hash.h"
#include "queue.h" #include "queue.h"
#include "filter.h" #include "filter.h"
@ -10246,7 +10247,7 @@ DEFUN (show_bgp_memory,
count * sizeof (struct peer)), count * sizeof (struct peer)),
VTY_NEWLINE); VTY_NEWLINE);
if ((count = mtype_stats_alloc (MTYPE_BGP_PEER_GROUP))) if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
vty_out (vty, "%ld peer groups, using %s of memory%s", count, vty_out (vty, "%ld peer groups, using %s of memory%s", count,
mtype_memstr (memstrbuf, sizeof (memstrbuf), mtype_memstr (memstrbuf, sizeof (memstrbuf),
count * sizeof (struct peer_group)), count * sizeof (struct peer_group)),
@ -10739,6 +10740,33 @@ ALIAS (show_ip_bgp_ipv4_summary,
"Address Family modifier\n" "Address Family modifier\n"
"Summary of BGP neighbor status\n") "Summary of BGP neighbor status\n")
DEFUN (show_bgp_ipv4_vpn_summary,
show_bgp_ipv4_vpn_summary_cmd,
"show bgp ipv4 vpn summary {json}",
SHOW_STR
BGP_STR
"IPv4\n"
"Display VPN NLRI specific information\n"
"Summary of BGP neighbor status\n"
JSON_STR)
{
return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, use_json (argc, argv));
}
/* `show ip bgp summary' commands. */
DEFUN (show_bgp_ipv6_vpn_summary,
show_bgp_ipv6_vpn_summary_cmd,
"show bgp ipv6 vpn summary {json}",
SHOW_STR
BGP_STR
"IPv6\n"
"Display VPN NLRI specific information\n"
"Summary of BGP neighbor status\n"
JSON_STR)
{
return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN, use_json (argc, argv));
}
DEFUN (show_ip_bgp_instance_ipv4_summary, DEFUN (show_ip_bgp_instance_ipv4_summary,
show_ip_bgp_instance_ipv4_summary_cmd, show_ip_bgp_instance_ipv4_summary_cmd,
"show ip bgp view WORD ipv4 (unicast|multicast) summary {json}", "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}",
@ -16010,6 +16038,12 @@ bgp_vty_init (void)
install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd); install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
#endif /* HAVE_IPV6 */ #endif /* HAVE_IPV6 */
install_element (VIEW_NODE, &show_bgp_ipv4_vpn_summary_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_summary_cmd);
install_element (VIEW_NODE, &show_bgp_ipv6_vpn_summary_cmd);
install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_summary_cmd);
/* "show ip bgp neighbors" commands. */ /* "show ip bgp neighbors" commands. */
install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd); install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd); install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);

View File

@ -21,7 +21,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifndef _QUAGGA_BGP_VTY_H #ifndef _QUAGGA_BGP_VTY_H
#define _QUAGGA_BGP_VTY_H #define _QUAGGA_BGP_VTY_H
#include "bgpd/bgpd.h" struct bgp;
#define CMD_AS_RANGE "<1-4294967295>" #define CMD_AS_RANGE "<1-4294967295>"
#define DYNAMIC_NEIGHBOR_LIMIT_RANGE "<1-5000>" #define DYNAMIC_NEIGHBOR_LIMIT_RANGE "<1-5000>"

View File

@ -73,6 +73,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#endif /* HAVE_SNMP */ #endif /* HAVE_SNMP */
#include "bgpd/bgp_updgrp.h" #include "bgpd/bgp_updgrp.h"
#include "bgpd/bgp_bfd.h" #include "bgpd/bgp_bfd.h"
#include "bgpd/bgp_memory.h"
/* BGP process wide configuration. */ /* BGP process wide configuration. */
static struct bgp_master bgp_master; static struct bgp_master bgp_master;
@ -2083,13 +2084,13 @@ peer_delete (struct peer *peer)
if (peer->hostname) if (peer->hostname)
{ {
XFREE(MTYPE_HOST, peer->hostname); XFREE(MTYPE_BGP_PEER_HOST, peer->hostname);
peer->hostname = NULL; peer->hostname = NULL;
} }
if (peer->domainname) if (peer->domainname)
{ {
XFREE(MTYPE_HOST, peer->domainname); XFREE(MTYPE_BGP_PEER_HOST, peer->domainname);
peer->domainname = NULL; peer->domainname = NULL;
} }
@ -2108,14 +2109,14 @@ peer_group_cmp (struct peer_group *g1, struct peer_group *g2)
static struct peer_group * static struct peer_group *
peer_group_new (void) peer_group_new (void)
{ {
return (struct peer_group *) XCALLOC (MTYPE_BGP_PEER_GROUP, return (struct peer_group *) XCALLOC (MTYPE_PEER_GROUP,
sizeof (struct peer_group)); sizeof (struct peer_group));
} }
static void static void
peer_group_free (struct peer_group *group) peer_group_free (struct peer_group *group)
{ {
XFREE (MTYPE_BGP_PEER_GROUP, group); XFREE (MTYPE_PEER_GROUP, group);
} }
struct peer_group * struct peer_group *
@ -2145,8 +2146,8 @@ peer_group_get (struct bgp *bgp, const char *name)
group = peer_group_new (); group = peer_group_new ();
group->bgp = bgp; group->bgp = bgp;
if (group->name) if (group->name)
XFREE(MTYPE_BGP_PEER_GROUP_HOST, group->name); XFREE(MTYPE_PEER_GROUP_HOST, group->name);
group->name = XSTRDUP(MTYPE_BGP_PEER_GROUP_HOST, name); group->name = XSTRDUP(MTYPE_PEER_GROUP_HOST, name);
group->peer = list_new (); group->peer = list_new ();
for (afi = AFI_IP; afi < AFI_MAX; afi++) for (afi = AFI_IP; afi < AFI_MAX; afi++)
group->listen_range[afi] = list_new (); group->listen_range[afi] = list_new ();

View File

@ -29,6 +29,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "sockunion.h" #include "sockunion.h"
#include "routemap.h" #include "routemap.h"
#include "linklist.h" #include "linklist.h"
#include "bgp_memory.h"
#define BGP_MAX_HOSTNAME 64 /* Linux max, is larger than most other sys */ #define BGP_MAX_HOSTNAME 64 /* Linux max, is larger than most other sys */

View File

@ -26,12 +26,6 @@ AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS(config.h) AC_CONFIG_HEADERS(config.h)
AC_PATH_PROG(PERL, perl) AC_PATH_PROG(PERL, perl)
AC_CHECK_PROG([GAWK],[gawk],[gawk],[not-in-PATH])
if test "x$GAWK" = "xnot-in-PATH" ; then
AC_MSG_ERROR([GNU awk is required for lib/memtype.h made by memtypes.awk.
BSD awk complains: awk: gensub doesn't support backreferences (subst "\1") ])
fi
AC_ARG_VAR([GAWK],[GNU AWK])
dnl default is to match previous behavior dnl default is to match previous behavior
exampledir=${sysconfdir} exampledir=${sysconfdir}
@ -317,8 +311,6 @@ AC_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror], [enable -Werror (recommended for developers only)])) AS_HELP_STRING([--enable-werror], [enable -Werror (recommended for developers only)]))
AC_ARG_ENABLE(cumulus, AC_ARG_ENABLE(cumulus,
AS_HELP_STRING([--enable-cumulus], [enable Cumulus Switch Special Extensions])) AS_HELP_STRING([--enable-cumulus], [enable Cumulus Switch Special Extensions]))
AC_ARG_ENABLE(bgp-standalone,
AS_HELP_STRING([--enable-bgp-standalone], [Modify code to allow BGP to work without Zebra]))
AC_ARG_ENABLE(rr-semantics, AC_ARG_ENABLE(rr-semantics,
AS_HELP_STRING([--disable-rr-semantics], [disable the v6 Route Replace semantics])) AS_HELP_STRING([--disable-rr-semantics], [disable the v6 Route Replace semantics]))
@ -370,10 +362,6 @@ if test "${enable_cumulus}" = "yes" ; then
AC_DEFINE(HAVE_CUMULUS,,Compile Special Cumulus Code in) AC_DEFINE(HAVE_CUMULUS,,Compile Special Cumulus Code in)
fi fi
if test "${enable_bgp_standalone}" = "yes" ; then
AC_DEFINE(HAVE_BGP_STANDALONE,,Allow BGP to work without Zebra)
fi
if test "${enable_shell_access}" = "yes"; then if test "${enable_shell_access}" = "yes"; then
AC_DEFINE(HAVE_SHELL_ACCESS,,Allow user to use ssh/telnet/bash) AC_DEFINE(HAVE_SHELL_ACCESS,,Allow user to use ssh/telnet/bash)
fi fi

View File

@ -50,7 +50,7 @@ quagga_TEXINFOS = appendix.texi basic.texi bgpd.texi filter.texi \
install.texi ipv6.texi kernel.texi main.texi ospf6d.texi ospfd.texi \ install.texi ipv6.texi kernel.texi main.texi ospf6d.texi ospfd.texi \
overview.texi protocol.texi ripd.texi ripngd.texi routemap.texi \ overview.texi protocol.texi ripd.texi ripngd.texi routemap.texi \
snmp.texi vtysh.texi routeserver.texi defines.texi $(figures_png) \ snmp.texi vtysh.texi routeserver.texi defines.texi $(figures_png) \
snmptrap.texi ospf_fundamentals.texi $(figures_txt) snmptrap.texi ospf_fundamentals.texi isisd.texi $(figures_txt)
.png.eps: .png.eps:
$(PNGTOEPS) $< "$@" $(PNGTOEPS) $< "$@"

View File

@ -13,6 +13,7 @@ sbin_PROGRAMS = isisd
SUBDIRS = topology SUBDIRS = topology
libisis_a_SOURCES = \ libisis_a_SOURCES = \
isis_memory.c \
isis_adjacency.c isis_lsp.c dict.c isis_circuit.c isis_pdu.c \ isis_adjacency.c isis_lsp.c dict.c isis_circuit.c isis_pdu.c \
isis_tlv.c isisd.c isis_misc.c isis_zebra.c isis_dr.c \ isis_tlv.c isisd.c isis_misc.c isis_zebra.c isis_dr.c \
isis_flags.c isis_dynhn.c iso_checksum.c isis_csm.c isis_events.c \ isis_flags.c isis_dynhn.c iso_checksum.c isis_csm.c isis_events.c \
@ -21,6 +22,7 @@ libisis_a_SOURCES = \
noinst_HEADERS = \ noinst_HEADERS = \
isis_memory.h \
isisd.h isis_pdu.h isis_tlv.h isis_adjacency.h isis_constants.h \ isisd.h isis_pdu.h isis_tlv.h isis_adjacency.h isis_constants.h \
isis_lsp.h dict.h isis_circuit.h isis_misc.h isis_network.h \ isis_lsp.h dict.h isis_circuit.h isis_misc.h isis_network.h \
isis_zebra.h isis_dr.h isis_flags.h isis_dynhn.h isis_common.h \ isis_zebra.h isis_dr.h isis_flags.h isis_dynhn.h isis_common.h \

View File

@ -18,6 +18,7 @@
#include "zebra.h" #include "zebra.h"
#include "zassert.h" #include "zassert.h"
#include "memory.h" #include "memory.h"
#include "isis_memory.h"
#include "dict.h" #include "dict.h"
/* /*

View File

@ -29,6 +29,7 @@
#include "command.h" #include "command.h"
#include "vty.h" #include "vty.h"
#include "memory.h" #include "memory.h"
#include "memory_vty.h"
#include "stream.h" #include "stream.h"
#include "if.h" #include "if.h"
#include "privs.h" #include "privs.h"

48
isisd/isis_memory.c Normal file
View File

@ -0,0 +1,48 @@
/* isisd memory type definitions
*
* Copyright (C) 2015 David Lamparter
*
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* Quagga is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Quagga; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "isis_memory.h"
DEFINE_MGROUP(ISISD, "isisd")
DEFINE_MTYPE(ISISD, ISIS, "ISIS")
DEFINE_MTYPE(ISISD, ISIS_TMP, "ISIS TMP")
DEFINE_MTYPE(ISISD, ISIS_CIRCUIT, "ISIS circuit")
DEFINE_MTYPE(ISISD, ISIS_LSP, "ISIS LSP")
DEFINE_MTYPE(ISISD, ISIS_ADJACENCY, "ISIS adjacency")
DEFINE_MTYPE(ISISD, ISIS_AREA, "ISIS area")
DEFINE_MTYPE(ISISD, ISIS_AREA_ADDR, "ISIS area address")
DEFINE_MTYPE(ISISD, ISIS_TLV, "ISIS TLV")
DEFINE_MTYPE(ISISD, ISIS_DYNHN, "ISIS dyn hostname")
DEFINE_MTYPE(ISISD, ISIS_SPFTREE, "ISIS SPFtree")
DEFINE_MTYPE(ISISD, ISIS_VERTEX, "ISIS vertex")
DEFINE_MTYPE(ISISD, ISIS_ROUTE_INFO, "ISIS route info")
DEFINE_MTYPE(ISISD, ISIS_NEXTHOP, "ISIS nexthop")
DEFINE_MTYPE(ISISD, ISIS_NEXTHOP6, "ISIS nexthop6")
DEFINE_MTYPE(ISISD, ISIS_DICT, "ISIS dictionary")
DEFINE_MTYPE(ISISD, ISIS_DICT_NODE, "ISIS dictionary node")
DEFINE_MTYPE(ISISD, ISIS_EXT_ROUTE, "ISIS redistributed route")
DEFINE_MTYPE(ISISD, ISIS_EXT_INFO, "ISIS redistributed route info")
DEFINE_MTYPE(ISISD, ISIS_MPLS_TE, "ISIS MPLS_TE parameters")

49
isisd/isis_memory.h Normal file
View File

@ -0,0 +1,49 @@
/* isisd memory type declarations
*
* Copyright (C) 2015 David Lamparter
*
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* Quagga is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Quagga; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef _QUAGGA_ISIS_MEMORY_H
#define _QUAGGA_ISIS_MEMORY_H
#include "memory.h"
DECLARE_MGROUP(ISISD)
DECLARE_MTYPE(ISIS)
DECLARE_MTYPE(ISIS_TMP)
DECLARE_MTYPE(ISIS_CIRCUIT)
DECLARE_MTYPE(ISIS_LSP)
DECLARE_MTYPE(ISIS_ADJACENCY)
DECLARE_MTYPE(ISIS_AREA)
DECLARE_MTYPE(ISIS_AREA_ADDR)
DECLARE_MTYPE(ISIS_TLV)
DECLARE_MTYPE(ISIS_DYNHN)
DECLARE_MTYPE(ISIS_SPFTREE)
DECLARE_MTYPE(ISIS_VERTEX)
DECLARE_MTYPE(ISIS_ROUTE_INFO)
DECLARE_MTYPE(ISIS_NEXTHOP)
DECLARE_MTYPE(ISIS_NEXTHOP6)
DECLARE_MTYPE(ISIS_DICT)
DECLARE_MTYPE(ISIS_DICT_NODE)
DECLARE_MTYPE(ISIS_EXT_ROUTE)
DECLARE_MTYPE(ISIS_EXT_INFO)
DECLARE_MTYPE(ISIS_MPLS_TE)
#endif /* _QUAGGA_ISIS_MEMORY_H */

View File

@ -24,7 +24,7 @@
#include "if.h" #include "if.h"
#include "linklist.h" #include "linklist.h"
#include "memory.h" #include "memory.h"
#include "memtypes.h" #include "isis_memory.h"
#include "prefix.h" #include "prefix.h"
#include "routemap.h" #include "routemap.h"
#include "stream.h" #include "stream.h"
@ -95,7 +95,7 @@ isis_redist_route_node_create(route_table_delegate_t *delegate,
struct route_table *table) struct route_table *table)
{ {
struct route_node *node; struct route_node *node;
node = XCALLOC(MTYPE_ROUTE_NODE, sizeof(*node)); node = XCALLOC(MTYPE_ISIS_EXT_ROUTE, sizeof(*node));
return node; return node;
} }
@ -105,8 +105,8 @@ isis_redist_route_node_destroy(route_table_delegate_t *delegate,
struct route_node *node) struct route_node *node)
{ {
if (node->info) if (node->info)
XFREE(MTYPE_ISIS, node->info); XFREE(MTYPE_ISIS_EXT_INFO, node->info);
XFREE (MTYPE_ROUTE_NODE, node); XFREE (MTYPE_ISIS_EXT_ROUTE, node);
} }
static route_table_delegate_t isis_redist_rt_delegate = { static route_table_delegate_t isis_redist_rt_delegate = {
@ -143,7 +143,7 @@ isis_redist_install(struct isis_area *area, int level,
} }
else else
{ {
er_node->info = XMALLOC(MTYPE_ISIS, sizeof(*info)); er_node->info = XMALLOC(MTYPE_ISIS_EXT_INFO, sizeof(*info));
} }
memcpy(er_node->info, info, sizeof(*info)); memcpy(er_node->info, info, sizeof(*info));
@ -243,7 +243,7 @@ isis_redist_ensure_default(struct isis *isis, int family)
return; return;
} }
ei_node->info = XCALLOC(MTYPE_ISIS, sizeof(struct isis_ext_info)); ei_node->info = XCALLOC(MTYPE_ISIS_EXT_INFO, sizeof(struct isis_ext_info));
info = ei_node->info; info = ei_node->info;
info->origin = DEFAULT_ROUTE; info->origin = DEFAULT_ROUTE;
@ -281,7 +281,7 @@ isis_redist_add(int type, struct prefix *p, u_char distance, uint32_t metric)
if (ei_node->info) if (ei_node->info)
route_unlock_node(ei_node); route_unlock_node(ei_node);
else else
ei_node->info = XCALLOC(MTYPE_ISIS, sizeof(struct isis_ext_info)); ei_node->info = XCALLOC(MTYPE_ISIS_EXT_INFO, sizeof(struct isis_ext_info));
info = ei_node->info; info = ei_node->info;
info->origin = type; info->origin = type;
@ -537,20 +537,20 @@ isis_redist_area_finish(struct isis_area *area)
isis_redist_update_zebra_subscriptions(area->isis); isis_redist_update_zebra_subscriptions(area->isis);
} }
DEFUN(isis_redistribute, DEFUN (isis_redistribute,
isis_redistribute_cmd, isis_redistribute_cmd,
"redistribute (ipv4|ipv6) " QUAGGA_REDIST_STR_ISISD "redistribute (ipv4|ipv6) " QUAGGA_REDIST_STR_ISISD
" (level-1|level-2) {metric <0-16777215>|route-map WORD}", " (level-1|level-2) {metric <0-16777215>|route-map WORD}",
REDIST_STR REDIST_STR
"Redistribute IPv4 routes\n" "Redistribute IPv4 routes\n"
"Redistribute IPv6 routes\n" "Redistribute IPv6 routes\n"
QUAGGA_REDIST_HELP_STR_ISISD QUAGGA_REDIST_HELP_STR_ISISD
"Redistribute into level-1\n" "Redistribute into level-1\n"
"Redistribute into level-2\n" "Redistribute into level-2\n"
"Metric for redistributed routes\n" "Metric for redistributed routes\n"
"ISIS default metric\n" "ISIS default metric\n"
"Route map reference\n" "Route map reference\n"
"Pointer to route-map entries\n") "Pointer to route-map entries\n")
{ {
struct isis_area *area = vty->index; struct isis_area *area = vty->index;
int family; int family;
@ -606,17 +606,17 @@ DEFUN(isis_redistribute,
return 0; return 0;
} }
DEFUN(no_isis_redistribute, DEFUN (no_isis_redistribute,
no_isis_redistribute_cmd, no_isis_redistribute_cmd,
"no redistribute (ipv4|ipv6) " QUAGGA_REDIST_STR_ISISD "no redistribute (ipv4|ipv6) " QUAGGA_REDIST_STR_ISISD
" (level-1|level-2)", " (level-1|level-2)",
NO_STR NO_STR
REDIST_STR REDIST_STR
"Redistribute IPv4 routes\n" "Redistribute IPv4 routes\n"
"Redistribute IPv6 routes\n" "Redistribute IPv6 routes\n"
QUAGGA_REDIST_HELP_STR_ISISD QUAGGA_REDIST_HELP_STR_ISISD
"Redistribute into level-1\n" "Redistribute into level-1\n"
"Redistribute into level-2\n") "Redistribute into level-2\n")
{ {
struct isis_area *area = vty->index; struct isis_area *area = vty->index;
int type; int type;
@ -650,21 +650,21 @@ DEFUN(no_isis_redistribute,
return 0; return 0;
} }
DEFUN(isis_default_originate, DEFUN (isis_default_originate,
isis_default_originate_cmd, isis_default_originate_cmd,
"default-information originate (ipv4|ipv6) (level-1|level-2) " "default-information originate (ipv4|ipv6) (level-1|level-2) "
"{always|metric <0-16777215>|route-map WORD}", "{always|metric <0-16777215>|route-map WORD}",
"Control distribution of default information\n" "Control distribution of default information\n"
"Distribute a default route\n" "Distribute a default route\n"
"Distribute default route for IPv4\n" "Distribute default route for IPv4\n"
"Distribute default route for IPv6\n" "Distribute default route for IPv6\n"
"Distribute default route into level-1\n" "Distribute default route into level-1\n"
"Distribute default route into level-2\n" "Distribute default route into level-2\n"
"Always advertise default route\n" "Always advertise default route\n"
"Metric for default route\n" "Metric for default route\n"
"ISIS default metric\n" "ISIS default metric\n"
"Route map reference\n" "Route map reference\n"
"Pointer to route-map entries\n") "Pointer to route-map entries\n")
{ {
struct isis_area *area = vty->index; struct isis_area *area = vty->index;
int family; int family;
@ -722,16 +722,16 @@ DEFUN(isis_default_originate,
return 0; return 0;
} }
DEFUN(no_isis_default_originate, DEFUN (no_isis_default_originate,
no_isis_default_originate_cmd, no_isis_default_originate_cmd,
"no default-information originate (ipv4|ipv6) (level-1|level-2)", "no default-information originate (ipv4|ipv6) (level-1|level-2)",
NO_STR NO_STR
"Control distribution of default information\n" "Control distribution of default information\n"
"Distribute a default route\n" "Distribute a default route\n"
"Distribute default route for IPv4\n" "Distribute default route for IPv4\n"
"Distribute default route for IPv6\n" "Distribute default route for IPv6\n"
"Distribute default route into level-1\n" "Distribute default route into level-1\n"
"Distribute default route into level-2\n") "Distribute default route into level-2\n")
{ {
struct isis_area *area = vty->index; struct isis_area *area = vty->index;

View File

@ -344,164 +344,160 @@ isis_route_set_delete (struct vty *vty, struct route_map_index *index,
/* ------------------------------------------------------------*/ /* ------------------------------------------------------------*/
DEFUN(match_ip_address, DEFUN (match_ip_address,
match_ip_address_cmd, match_ip_address_cmd,
"match ip address (<1-199>|<1300-2699>|WORD)", "match ip address (<1-199>|<1300-2699>|WORD)",
MATCH_STR MATCH_STR
IP_STR IP_STR
"Match address of route\n" "Match address of route\n"
"IP access-list number\n" "IP access-list number\n"
"IP access-list number (expanded range)\n" "IP access-list number (expanded range)\n"
"IP Access-list name\n") "IP Access-list name\n")
{ {
return isis_route_match_add(vty, vty->index, "ip address", argv[0]); return isis_route_match_add(vty, vty->index, "ip address", argv[0]);
} }
DEFUN(no_match_ip_address, DEFUN (no_match_ip_address,
no_match_ip_address_val_cmd, no_match_ip_address_val_cmd,
"no match ip address (<1-199>|<1300-2699>|WORD)", "no match ip address (<1-199>|<1300-2699>|WORD)",
NO_STR NO_STR
MATCH_STR MATCH_STR
IP_STR IP_STR
"Match address of route\n" "Match address of route\n"
"IP access-list number\n" "IP access-list number\n"
"IP access-list number (expanded range)\n" "IP access-list number (expanded range)\n"
"IP Access-list name\n") "IP Access-list name\n")
{ {
if (argc == 0) if (argc == 0)
return isis_route_match_delete(vty, vty->index, "ip address", NULL); return isis_route_match_delete(vty, vty->index, "ip address", NULL);
return isis_route_match_delete(vty, vty->index, "ip address", argv[0]); return isis_route_match_delete(vty, vty->index, "ip address", argv[0]);
} }
ALIAS(no_match_ip_address, ALIAS (no_match_ip_address,
no_match_ip_address_cmd, no_match_ip_address_cmd,
"no match ip address", "no match ip address",
NO_STR NO_STR
MATCH_STR MATCH_STR
IP_STR IP_STR
"Match address of route\n" "Match address of route\n")
);
/* ------------------------------------------------------------*/ /* ------------------------------------------------------------*/
DEFUN(match_ip_address_prefix_list, DEFUN (match_ip_address_prefix_list,
match_ip_address_prefix_list_cmd, match_ip_address_prefix_list_cmd,
"match ip address prefix-list WORD", "match ip address prefix-list WORD",
MATCH_STR MATCH_STR
IP_STR IP_STR
"Match address of route\n" "Match address of route\n"
"Match entries of prefix-lists\n" "Match entries of prefix-lists\n"
"IP prefix-list name\n") "IP prefix-list name\n")
{ {
return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[0]); return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[0]);
} }
DEFUN(no_match_ip_address_prefix_list, DEFUN (no_match_ip_address_prefix_list,
no_match_ip_address_prefix_list_cmd, no_match_ip_address_prefix_list_cmd,
"no match ip address prefix-list", "no match ip address prefix-list",
NO_STR NO_STR
MATCH_STR MATCH_STR
IP_STR IP_STR
"Match address of route\n" "Match address of route\n"
"Match entries of prefix-lists\n") "Match entries of prefix-lists\n")
{ {
if (argc == 0) if (argc == 0)
return isis_route_match_delete (vty, vty->index, "ip address prefix-list", NULL); return isis_route_match_delete (vty, vty->index, "ip address prefix-list", NULL);
return isis_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]); return isis_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]);
} }
ALIAS(no_match_ip_address_prefix_list, ALIAS (no_match_ip_address_prefix_list,
no_match_ip_address_prefix_list_val_cmd, no_match_ip_address_prefix_list_val_cmd,
"no match ip address prefix-list WORD", "no match ip address prefix-list WORD",
NO_STR NO_STR
MATCH_STR MATCH_STR
IP_STR IP_STR
"Match address of route\n" "Match address of route\n"
"Match entries of prefix-lists\n" "Match entries of prefix-lists\n"
"IP prefix-list name\n" "IP prefix-list name\n")
);
/* ------------------------------------------------------------*/ /* ------------------------------------------------------------*/
DEFUN(match_ipv6_address, DEFUN (match_ipv6_address,
match_ipv6_address_cmd, match_ipv6_address_cmd,
"match ipv6 address WORD", "match ipv6 address WORD",
MATCH_STR MATCH_STR
IPV6_STR IPV6_STR
"Match IPv6 address of route\n" "Match IPv6 address of route\n"
"IPv6 access-list name\n") "IPv6 access-list name\n")
{ {
return isis_route_match_add(vty, vty->index, "ipv6 address", argv[0]); return isis_route_match_add(vty, vty->index, "ipv6 address", argv[0]);
} }
DEFUN(no_match_ipv6_address, DEFUN (no_match_ipv6_address,
no_match_ipv6_address_val_cmd, no_match_ipv6_address_val_cmd,
"no match ipv6 address WORD", "no match ipv6 address WORD",
NO_STR NO_STR
MATCH_STR MATCH_STR
IPV6_STR IPV6_STR
"Match IPv6 address of route\n" "Match IPv6 address of route\n"
"IPv6 access-list name\n") "IPv6 access-list name\n")
{ {
if (argc == 0) if (argc == 0)
return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL); return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL);
return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[0]); return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[0]);
} }
ALIAS(no_match_ipv6_address, ALIAS (no_match_ipv6_address,
no_match_ipv6_address_cmd, no_match_ipv6_address_cmd,
"no match ipv6 address", "no match ipv6 address",
NO_STR NO_STR
MATCH_STR MATCH_STR
IPV6_STR IPV6_STR
"Match IPv6 address of route\n" "Match IPv6 address of route\n")
);
/* ------------------------------------------------------------*/ /* ------------------------------------------------------------*/
DEFUN(match_ipv6_address_prefix_list, DEFUN (match_ipv6_address_prefix_list,
match_ipv6_address_prefix_list_cmd, match_ipv6_address_prefix_list_cmd,
"match ipv6 address prefix-list WORD", "match ipv6 address prefix-list WORD",
MATCH_STR MATCH_STR
IPV6_STR IPV6_STR
"Match address of route\n" "Match address of route\n"
"Match entries of prefix-lists\n" "Match entries of prefix-lists\n"
"IP prefix-list name\n") "IP prefix-list name\n")
{ {
return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[0]); return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[0]);
} }
DEFUN(no_match_ipv6_address_prefix_list, DEFUN (no_match_ipv6_address_prefix_list,
no_match_ipv6_address_prefix_list_cmd, no_match_ipv6_address_prefix_list_cmd,
"no match ipv6 address prefix-list", "no match ipv6 address prefix-list",
NO_STR NO_STR
MATCH_STR MATCH_STR
IPV6_STR IPV6_STR
"Match address of route\n" "Match address of route\n"
"Match entries of prefix-lists\n") "Match entries of prefix-lists\n")
{ {
if (argc == 0) if (argc == 0)
return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", NULL); return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", NULL);
return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", argv[0]); return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", argv[0]);
} }
ALIAS(no_match_ipv6_address_prefix_list, ALIAS (no_match_ipv6_address_prefix_list,
no_match_ipv6_address_prefix_list_val_cmd, no_match_ipv6_address_prefix_list_val_cmd,
"no match ipv6 address prefix-list WORD", "no match ipv6 address prefix-list WORD",
NO_STR NO_STR
MATCH_STR MATCH_STR
IPV6_STR IPV6_STR
"Match address of route\n" "Match address of route\n"
"Match entries of prefix-lists\n" "Match entries of prefix-lists\n"
"IP prefix-list name\n" "IP prefix-list name\n")
);
/* ------------------------------------------------------------*/ /* ------------------------------------------------------------*/
/* set metric already exists e.g. in the ospf routemap. vtysh doesn't cope well with different /* set metric already exists e.g. in the ospf routemap. vtysh doesn't cope well with different
* commands at the same node, therefore add set metric with the same 32-bit range as ospf and * commands at the same node, therefore add set metric with the same 32-bit range as ospf and
* verify that the input is a valid isis metric */ * verify that the input is a valid isis metric */
DEFUN(set_metric, DEFUN (set_metric,
set_metric_cmd, set_metric_cmd,
"set metric <0-4294967295>", "set metric <0-4294967295>",
SET_STR SET_STR
@ -511,7 +507,7 @@ DEFUN(set_metric,
return isis_route_set_add(vty, vty->index, "metric", argv[0]); return isis_route_set_add(vty, vty->index, "metric", argv[0]);
} }
DEFUN(no_set_metric, DEFUN (no_set_metric,
no_set_metric_val_cmd, no_set_metric_val_cmd,
"no set metric <0-4294967295>", "no set metric <0-4294967295>",
NO_STR NO_STR
@ -524,13 +520,12 @@ DEFUN(no_set_metric,
return isis_route_set_delete(vty, vty->index, "metric", argv[0]); return isis_route_set_delete(vty, vty->index, "metric", argv[0]);
} }
ALIAS(no_set_metric, ALIAS (no_set_metric,
no_set_metric_cmd, no_set_metric_cmd,
"no set metric", "no set metric",
NO_STR NO_STR
SET_STR SET_STR
"Metric vale for destination routing protocol\n" "Metric vale for destination routing protocol\n");
);
void void
isis_route_map_init(void) isis_route_map_init(void)

View File

@ -1,7 +1,7 @@
/* /*
* IS-IS Rout(e)ing protocol - isis_te.c * IS-IS Rout(e)ing protocol - isis_te.c
* *
* This is an implementation of RFC5305 * This is an implementation of RFC5305 & RFC 7810
* *
* Copyright (C) 2014 Orange Labs * Copyright (C) 2014 Orange Labs
* http://www.orange.com * http://www.orange.com

View File

@ -1,7 +1,7 @@
/* /*
* IS-IS Rout(e)ing protocol - isis_te.c * IS-IS Rout(e)ing protocol - isis_te.c
* *
* This is an implementation of RFC5305, RFC 5307 and draft-ietf-isis-te-metric-extensions-11 * This is an implementation of RFC5305, RFC 5307 and RFC 7810
* *
* Copyright (C) 2014 Orange Labs * Copyright (C) 2014 Orange Labs
* http://www.orange.com * http://www.orange.com
@ -183,7 +183,7 @@ struct te_subtlv_rip
} __attribute__((__packed__)); } __attribute__((__packed__));
/* draft-ietf-isis-te-metric-extensions-11.txt */ /* TE Metric Extensions - RFC 7810 */
/* Link Sub-TLV: Average Link Delay */ /* Link Sub-TLV: Average Link Delay */
#define TE_SUBTLV_AV_DELAY 33 #define TE_SUBTLV_AV_DELAY 33
struct te_subtlv_av_delay struct te_subtlv_av_delay
@ -305,7 +305,7 @@ struct mpls_te_circuit
/* RFC5316 */ /* RFC5316 */
struct te_subtlv_ras ras; struct te_subtlv_ras ras;
struct te_subtlv_rip rip; struct te_subtlv_rip rip;
/* draft-ietf-isis-te-metric-extension */ /* RFC7810 */
struct te_subtlv_av_delay av_delay; struct te_subtlv_av_delay av_delay;
struct te_subtlv_mm_delay mm_delay; struct te_subtlv_mm_delay mm_delay;
struct te_subtlv_delay_var delay_var; struct te_subtlv_delay_var delay_var;

View File

@ -1566,21 +1566,21 @@ DEFUN (area_lsp_mtu,
return area_lsp_mtu_set(vty, lsp_mtu); return area_lsp_mtu_set(vty, lsp_mtu);
} }
DEFUN(no_area_lsp_mtu, DEFUN (no_area_lsp_mtu,
no_area_lsp_mtu_cmd, no_area_lsp_mtu_cmd,
"no lsp-mtu", "no lsp-mtu",
NO_STR NO_STR
"Configure the maximum size of generated LSPs\n") "Configure the maximum size of generated LSPs\n")
{ {
return area_lsp_mtu_set(vty, DEFAULT_LSP_MTU); return area_lsp_mtu_set(vty, DEFAULT_LSP_MTU);
} }
ALIAS(no_area_lsp_mtu, ALIAS (no_area_lsp_mtu,
no_area_lsp_mtu_arg_cmd, no_area_lsp_mtu_arg_cmd,
"no lsp-mtu <128-4352>", "no lsp-mtu <128-4352>",
NO_STR NO_STR
"Configure the maximum size of generated LSPs\n" "Configure the maximum size of generated LSPs\n"
"Maximum size of generated LSPs\n"); "Maximum size of generated LSPs\n");
DEFUN (is_type, DEFUN (is_type,
is_type_cmd, is_type_cmd,

View File

@ -1236,7 +1236,7 @@ DEFUN (debug_isis_lsp_sched,
DEFUN (no_debug_isis_lsp_sched, DEFUN (no_debug_isis_lsp_sched,
no_debug_isis_lsp_sched_cmd, no_debug_isis_lsp_sched_cmd,
"no debug isis lsp-gen", "no debug isis lsp-sched",
UNDEBUG_STR UNDEBUG_STR
"IS-IS information\n" "IS-IS information\n"
"IS-IS scheduling of LSP generation\n") "IS-IS scheduling of LSP generation\n")

View File

@ -32,6 +32,7 @@
#include "isisd/isis_redist.h" #include "isisd/isis_redist.h"
#include "isis_flags.h" #include "isis_flags.h"
#include "dict.h" #include "dict.h"
#include "isis_memory.h"
/* uncomment if you are a developer in bug hunt */ /* uncomment if you are a developer in bug hunt */
/* #define EXTREME_DEBUG */ /* #define EXTREME_DEBUG */

1
lib/.gitignore vendored
View File

@ -14,7 +14,6 @@ gitversion.h.tmp
.arch-ids .arch-ids
*~ *~
*.loT *.loT
memtypes.h
route_types.h route_types.h
command_lex.c command_lex.c
command_parse.c command_parse.c

View File

@ -13,13 +13,13 @@ libzebra_la_SOURCES = \
checksum.c vector.c linklist.c vty.c \ checksum.c vector.c linklist.c vty.c \
graph.c command_parse.y command_lex.l command_match.c \ graph.c command_parse.y command_lex.l command_match.c \
command.c \ command.c \
sockunion.c prefix.c thread.c if.c memory.c buffer.c table.c hash.c \ sockunion.c prefix.c thread.c if.c buffer.c table.c hash.c \
filter.c routemap.c distribute.c stream.c str.c log.c plist.c \ filter.c routemap.c distribute.c stream.c str.c log.c plist.c \
zclient.c sockopt.c smux.c agentx.c snmp.c md5.c if_rmap.c keychain.c privs.c \ zclient.c sockopt.c smux.c agentx.c snmp.c md5.c if_rmap.c keychain.c privs.c \
sigevent.c pqueue.c jhash.c memtypes.c workqueue.c nexthop.c json.c \ sigevent.c pqueue.c jhash.c workqueue.c nexthop.c json.c \
ptm_lib.c csv.c bfd.c vrf.c systemd.c ns.c ptm_lib.c csv.c bfd.c vrf.c systemd.c ns.c memory.c memory_vty.c
BUILT_SOURCES = memtypes.h route_types.h gitversion.h command_parse.h BUILT_SOURCES = route_types.h gitversion.h command_parse.h
libzebra_la_DEPENDENCIES = @LIB_REGEX@ libzebra_la_DEPENDENCIES = @LIB_REGEX@
@ -33,9 +33,10 @@ pkginclude_HEADERS = \
memory.h network.h prefix.h routemap.h distribute.h sockunion.h \ memory.h network.h prefix.h routemap.h distribute.h sockunion.h \
str.h stream.h table.h thread.h vector.h version.h vty.h zebra.h \ str.h stream.h table.h thread.h vector.h version.h vty.h zebra.h \
plist.h zclient.h sockopt.h smux.h md5.h if_rmap.h keychain.h \ plist.h zclient.h sockopt.h smux.h md5.h if_rmap.h keychain.h \
privs.h sigevent.h pqueue.h jhash.h zassert.h memtypes.h \ privs.h sigevent.h pqueue.h jhash.h zassert.h \
workqueue.h route_types.h libospf.h nexthop.h json.h \ workqueue.h route_types.h libospf.h nexthop.h json.h \
ptm_lib.h csv.h bfd.h vrf.h ns.h systemd.h bitfield.h ptm_lib.h csv.h bfd.h vrf.h ns.h systemd.h bitfield.h \
fifo.h memory_vty.h
noinst_HEADERS = \ noinst_HEADERS = \
plist_int.h plist_int.h
@ -43,13 +44,9 @@ noinst_HEADERS = \
EXTRA_DIST = \ EXTRA_DIST = \
regex.c regex-gnu.h \ regex.c regex-gnu.h \
queue.h \ queue.h \
memtypes.awk \
route_types.pl route_types.txt \ route_types.pl route_types.txt \
gitversion.pl gitversion.pl
memtypes.h: $(srcdir)/memtypes.c $(srcdir)/memtypes.awk
($(GAWK) -f $(srcdir)/memtypes.awk $(srcdir)/memtypes.c > $@)
route_types.h: $(srcdir)/route_types.txt $(srcdir)/route_types.pl route_types.h: $(srcdir)/route_types.txt $(srcdir)/route_types.pl
@PERL@ $(srcdir)/route_types.pl < $(srcdir)/route_types.txt > $@ @PERL@ $(srcdir)/route_types.pl < $(srcdir)/route_types.txt > $@

View File

@ -33,6 +33,8 @@
#include "vty.h" #include "vty.h"
#include "bfd.h" #include "bfd.h"
DEFINE_MTYPE_STATIC(LIB, BFD_INFO, "BFD info")
int bfd_debug = 0; int bfd_debug = 0;
struct bfd_gbl bfd_gbl; struct bfd_gbl bfd_gbl;

View File

@ -28,7 +28,8 @@
#include "network.h" #include "network.h"
#include <stddef.h> #include <stddef.h>
DEFINE_MTYPE_STATIC(LIB, BUFFER, "Buffer")
DEFINE_MTYPE_STATIC(LIB, BUFFER_DATA, "Buffer data")
/* Buffer master. */ /* Buffer master. */
struct buffer struct buffer

View File

@ -34,10 +34,13 @@ Boston, MA 02111-1307, USA. */
#include "command.h" #include "command.h"
#include "workqueue.h" #include "workqueue.h"
#include "vrf.h" #include "vrf.h"
#include "command_match.h" #include "command_match.h"
#include "command_parse.h" #include "command_parse.h"
DEFINE_MTYPE( LIB, HOST, "Host config")
DEFINE_MTYPE( LIB, STRVEC, "String vector")
DEFINE_MTYPE_STATIC(LIB, CMD_TOKENS, "Command desc")
/* Command vector which includes some level of command lists. Normally /* Command vector which includes some level of command lists. Normally
each daemon maintains each own cmdvec. */ each daemon maintains each own cmdvec. */
vector cmdvec = NULL; vector cmdvec = NULL;

View File

@ -27,6 +27,12 @@
#include "vty.h" #include "vty.h"
#include "lib/route_types.h" #include "lib/route_types.h"
#include "graph.h" #include "graph.h"
#include "memory.h"
DECLARE_MTYPE(HOST)
/* for test-commands.c */
DECLARE_MTYPE(STRVEC)
/* Host configuration variable */ /* Host configuration variable */
struct host struct host

View File

@ -23,10 +23,13 @@
*/ */
#include <zebra.h> #include <zebra.h>
#include "command_match.h" #include "command_match.h"
#include "command_parse.h" #include "command_parse.h"
#include "memory.h" #include "memory.h"
DEFINE_MTYPE_STATIC(LIB, CMD_TOKENS, "Command Tokens")
/* matcher helper prototypes */ /* matcher helper prototypes */
static int static int
add_nexthops (struct list *, struct graph_node *); add_nexthops (struct list *, struct graph_node *);

View File

@ -33,9 +33,10 @@
/* required external units */ /* required external units */
%code requires { %code requires {
#include "stdlib.h"
#include "string.h"
#include "command.h" #include "command.h"
#include "graph.h" #include "graph.h"
#include "memory.h"
extern int extern int
yylex (void); yylex (void);
@ -145,7 +146,7 @@
set_lexer_string (element->string); set_lexer_string (element->string);
/* copy docstring and keep a pointer to the copy */ /* copy docstring and keep a pointer to the copy */
docstr = element->doc ? XSTRDUP(MTYPE_TMP, element->doc) : NULL; docstr = element->doc ? strdup(element->doc) : NULL;
docstr_start = docstr; docstr_start = docstr;
} }
@ -174,7 +175,7 @@ start:
sentence_root: WORD sentence_root: WORD
{ {
struct graph_node *root = struct graph_node *root =
new_token_node (graph, WORD_TKN, XSTRDUP (MTYPE_CMD_TOKENS, $1), doc_next()); new_token_node (graph, WORD_TKN, strdup ($1), doc_next());
if ((currnode = add_edge_dedup (startnode, root)) != root) if ((currnode = add_edge_dedup (startnode, root)) != root)
graph_delete_node (graph, root); graph_delete_node (graph, root);
@ -199,7 +200,7 @@ cmd_token:
{ {
graph_add_edge (currnode, $1->start); graph_add_edge (currnode, $1->start);
currnode = $1->end; currnode = $1->end;
XFREE (MTYPE_TMP, $1); free ($1);
} }
; ;
@ -215,7 +216,7 @@ compound_token:
literal_token: WORD literal_token: WORD
{ {
$$ = new_token_node (graph, WORD_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); $$ = new_token_node (graph, WORD_TKN, strdup($1), doc_next());
free ($1); free ($1);
} }
; ;
@ -223,32 +224,32 @@ literal_token: WORD
placeholder_token: placeholder_token:
IPV4 IPV4
{ {
$$ = new_token_node (graph, IPV4_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); $$ = new_token_node (graph, IPV4_TKN, strdup($1), doc_next());
free ($1); free ($1);
} }
| IPV4_PREFIX | IPV4_PREFIX
{ {
$$ = new_token_node (graph, IPV4_PREFIX_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); $$ = new_token_node (graph, IPV4_PREFIX_TKN, strdup($1), doc_next());
free ($1); free ($1);
} }
| IPV6 | IPV6
{ {
$$ = new_token_node (graph, IPV6_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); $$ = new_token_node (graph, IPV6_TKN, strdup($1), doc_next());
free ($1); free ($1);
} }
| IPV6_PREFIX | IPV6_PREFIX
{ {
$$ = new_token_node (graph, IPV6_PREFIX_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); $$ = new_token_node (graph, IPV6_PREFIX_TKN, strdup($1), doc_next());
free ($1); free ($1);
} }
| VARIABLE | VARIABLE
{ {
$$ = new_token_node (graph, VARIABLE_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); $$ = new_token_node (graph, VARIABLE_TKN, strdup($1), doc_next());
free ($1); free ($1);
} }
| RANGE | RANGE
{ {
$$ = new_token_node (graph, RANGE_TKN, XSTRDUP(MTYPE_CMD_TOKENS, $1), doc_next()); $$ = new_token_node (graph, RANGE_TKN, strdup($1), doc_next());
struct cmd_token *token = $$->data; struct cmd_token *token = $$->data;
// get the numbers out // get the numbers out
@ -266,7 +267,7 @@ placeholder_token:
/* <selector|set> productions */ /* <selector|set> productions */
selector: '<' selector_seq_seq '>' selector: '<' selector_seq_seq '>'
{ {
$$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); $$ = malloc (sizeof (struct subgraph));
$$->start = new_token_node (graph, SELECTOR_TKN, NULL, NULL); $$->start = new_token_node (graph, SELECTOR_TKN, NULL, NULL);
$$->end = new_token_node (graph, NUL_TKN, NULL, NULL); $$->end = new_token_node (graph, NUL_TKN, NULL, NULL);
for (unsigned int i = 0; i < vector_active ($2->start->to); i++) for (unsigned int i = 0; i < vector_active ($2->start->to); i++)
@ -278,20 +279,20 @@ selector: '<' selector_seq_seq '>'
} }
graph_delete_node (graph, $2->start); graph_delete_node (graph, $2->start);
graph_delete_node (graph, $2->end); graph_delete_node (graph, $2->end);
XFREE (MTYPE_TMP, $2); free ($2);
}; };
selector_seq_seq: selector_seq_seq:
selector_seq_seq '|' selector_token_seq selector_seq_seq '|' selector_token_seq
{ {
$$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); $$ = malloc (sizeof (struct subgraph));
$$->start = graph_new_node (graph, NULL, NULL); $$->start = graph_new_node (graph, NULL, NULL);
$$->end = graph_new_node (graph, NULL, NULL); $$->end = graph_new_node (graph, NULL, NULL);
// link in last sequence // link in last sequence
graph_add_edge ($$->start, $3->start); graph_add_edge ($$->start, $3->start);
graph_add_edge ($3->end, $$->end); graph_add_edge ($3->end, $$->end);
XFREE (MTYPE_TMP, $3); free ($3);
for (unsigned int i = 0; i < vector_active ($1->start->to); i++) for (unsigned int i = 0; i < vector_active ($1->start->to); i++)
{ {
@ -302,44 +303,44 @@ selector_seq_seq:
} }
graph_delete_node (graph, $1->start); graph_delete_node (graph, $1->start);
graph_delete_node (graph, $1->end); graph_delete_node (graph, $1->end);
XFREE (MTYPE_TMP, $1); free ($1);
XFREE (MTYPE_TMP, $3); free ($3);
} }
| selector_token_seq '|' selector_token_seq | selector_token_seq '|' selector_token_seq
{ {
$$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); $$ = malloc (sizeof (struct subgraph));
$$->start = graph_new_node (graph, NULL, NULL); $$->start = graph_new_node (graph, NULL, NULL);
$$->end = graph_new_node (graph, NULL, NULL); $$->end = graph_new_node (graph, NULL, NULL);
graph_add_edge ($$->start, $1->start); graph_add_edge ($$->start, $1->start);
graph_add_edge ($1->end, $$->end); graph_add_edge ($1->end, $$->end);
graph_add_edge ($$->start, $3->start); graph_add_edge ($$->start, $3->start);
graph_add_edge ($3->end, $$->end); graph_add_edge ($3->end, $$->end);
XFREE (MTYPE_TMP, $1); free ($1);
XFREE (MTYPE_TMP, $3); free ($3);
} }
; ;
selector_token_seq: selector_token_seq:
simple_token simple_token
{ {
$$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); $$ = malloc (sizeof (struct subgraph));
$$->start = $$->end = $1; $$->start = $$->end = $1;
} }
| selector_token_seq selector_token | selector_token_seq selector_token
{ {
$$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); $$ = malloc (sizeof (struct subgraph));
graph_add_edge ($1->end, $2->start); graph_add_edge ($1->end, $2->start);
$$->start = $1->start; $$->start = $1->start;
$$->end = $2->end; $$->end = $2->end;
XFREE (MTYPE_TMP, $1); free ($1);
XFREE (MTYPE_TMP, $2); free ($2);
} }
; ;
selector_token: selector_token:
simple_token simple_token
{ {
$$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); $$ = malloc (sizeof (struct subgraph));
$$->start = $$->end = $1; $$->start = $$->end = $1;
} }
| option | option
@ -349,7 +350,7 @@ selector_token:
option: '[' option_token_seq ']' option: '[' option_token_seq ']'
{ {
// make a new option // make a new option
$$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); $$ = malloc (sizeof (struct subgraph));
$$->start = new_token_node (graph, OPTION_TKN, NULL, NULL); $$->start = new_token_node (graph, OPTION_TKN, NULL, NULL);
$$->end = new_token_node (graph, NUL_TKN, NULL, NULL); $$->end = new_token_node (graph, NUL_TKN, NULL, NULL);
// add a path through the sequence to the end // add a path through the sequence to the end
@ -357,7 +358,7 @@ option: '[' option_token_seq ']'
graph_add_edge ($2->end, $$->end); graph_add_edge ($2->end, $$->end);
// add a path directly from the start to the end // add a path directly from the start to the end
graph_add_edge ($$->start, $$->end); graph_add_edge ($$->start, $$->end);
XFREE (MTYPE_TMP, $2); free ($2);
} }
; ;
@ -365,18 +366,18 @@ option_token_seq:
option_token option_token
| option_token_seq option_token | option_token_seq option_token
{ {
$$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); $$ = malloc (sizeof (struct subgraph));
graph_add_edge ($1->end, $2->start); graph_add_edge ($1->end, $2->start);
$$->start = $1->start; $$->start = $1->start;
$$->end = $2->end; $$->end = $2->end;
XFREE (MTYPE_TMP, $1); free ($1);
} }
; ;
option_token: option_token:
simple_token simple_token
{ {
$$ = XMALLOC (MTYPE_TMP, sizeof (struct subgraph)); $$ = malloc (sizeof (struct subgraph));
$$->start = $$->end = $1; $$->start = $$->end = $1;
} }
| compound_token | compound_token
@ -429,8 +430,8 @@ terminate_graph (struct graph *graph, struct graph_node *finalnode, struct cmd_e
struct graph_node *end_token_node = struct graph_node *end_token_node =
new_token_node (graph, new_token_node (graph,
END_TKN, END_TKN,
XSTRDUP (MTYPE_CMD_TOKENS, CMD_CR_TEXT), strdup (CMD_CR_TEXT),
XSTRDUP (MTYPE_CMD_TOKENS, "")); strdup (""));
struct graph_node *end_element_node = struct graph_node *end_element_node =
graph_new_node (graph, element, (void (*)(void *)) &del_cmd_element); graph_new_node (graph, element, (void (*)(void *)) &del_cmd_element);
@ -446,8 +447,8 @@ doc_next()
{ {
char *piece = NULL; char *piece = NULL;
if (!docstr || !(piece = strsep (&docstr, "\n"))) if (!docstr || !(piece = strsep (&docstr, "\n")))
return XSTRDUP (MTYPE_CMD_TOKENS, ""); return strdup ("");
return XSTRDUP (MTYPE_CMD_TOKENS, piece); return strdup (piece);
} }
static struct graph_node * static struct graph_node *

View File

@ -28,6 +28,10 @@
#include "distribute.h" #include "distribute.h"
#include "memory.h" #include "memory.h"
DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE, "Distribute list")
DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE_IFNAME, "Dist-list ifname")
DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE_NAME, "Dist-list name")
/* Hash of distribute list. */ /* Hash of distribute list. */
struct hash *disthash; struct hash *disthash;

62
lib/fifo.h Normal file
View File

@ -0,0 +1,62 @@
/* FIFO common header.
Copyright (C) 2015 Kunihiro Ishiguro
This file is part of Quagga.
Quagga is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
Quagga is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Zebra; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef __LIB_FIFO_H__
#define __LIB_FIFO_H__
/* FIFO -- first in first out structure and macros. */
struct fifo
{
struct fifo *next;
struct fifo *prev;
};
#define FIFO_INIT(F) \
do { \
struct fifo *Xfifo = (struct fifo *)(F); \
Xfifo->next = Xfifo->prev = Xfifo; \
} while (0)
#define FIFO_ADD(F,N) \
do { \
struct fifo *Xfifo = (struct fifo *)(F); \
struct fifo *Xnode = (struct fifo *)(N); \
Xnode->next = Xfifo; \
Xnode->prev = Xfifo->prev; \
Xfifo->prev = Xfifo->prev->next = Xnode; \
} while (0)
#define FIFO_DEL(N) \
do { \
struct fifo *Xnode = (struct fifo *)(N); \
Xnode->prev->next = Xnode->next; \
Xnode->next->prev = Xnode->prev; \
} while (0)
#define FIFO_HEAD(F) \
((((struct fifo *)(F))->next == (struct fifo *)(F)) \
? NULL : (F)->next)
#define FIFO_EMPTY(F) \
(((struct fifo *)(F))->next == (struct fifo *)(F))
#define FIFO_TOP(F) \
(FIFO_EMPTY(F) ? NULL : ((struct fifo *)(F))->next)
#endif /* __LIB_FIFO_H__ */

View File

@ -30,6 +30,10 @@
#include "log.h" #include "log.h"
#include "routemap.h" #include "routemap.h"
DEFINE_MTYPE_STATIC(LIB, ACCESS_LIST, "Access List")
DEFINE_MTYPE_STATIC(LIB, ACCESS_LIST_STR, "Access List Str")
DEFINE_MTYPE_STATIC(LIB, ACCESS_FILTER, "Access Filter")
struct filter_cisco struct filter_cisco
{ {
/* Cisco access-list */ /* Cisco access-list */

View File

@ -25,6 +25,8 @@
#include "graph.h" #include "graph.h"
#include "memory.h" #include "memory.h"
DEFINE_MTYPE_STATIC(LIB, GRAPH, "Graph")
DEFINE_MTYPE_STATIC(LIB, GRAPH_NODE, "Graph Node")
struct graph * struct graph *
graph_new () graph_new ()
{ {

View File

@ -24,6 +24,10 @@
#include "hash.h" #include "hash.h"
#include "memory.h" #include "memory.h"
DEFINE_MTYPE( LIB, HASH, "Hash")
DEFINE_MTYPE( LIB, HASH_BACKET, "Hash Bucket")
DEFINE_MTYPE_STATIC(LIB, HASH_INDEX, "Hash Index")
/* Allocate a new hash. */ /* Allocate a new hash. */
struct hash * struct hash *
hash_create_size (unsigned int size, unsigned int (*hash_key) (void *), hash_create_size (unsigned int size, unsigned int (*hash_key) (void *),

View File

@ -21,6 +21,11 @@ Boston, MA 02111-1307, USA. */
#ifndef _ZEBRA_HASH_H #ifndef _ZEBRA_HASH_H
#define _ZEBRA_HASH_H #define _ZEBRA_HASH_H
#include "memory.h"
DECLARE_MTYPE(HASH)
DECLARE_MTYPE(HASH_BACKET)
/* Default hash table size. */ /* Default hash table size. */
#define HASH_INITIAL_SIZE 256 /* initial number of backets. */ #define HASH_INITIAL_SIZE 256 /* initial number of backets. */
#define HASH_THRESHOLD 10 /* expand when backet. */ #define HASH_THRESHOLD 10 /* expand when backet. */

View File

@ -37,6 +37,12 @@
#include "str.h" #include "str.h"
#include "log.h" #include "log.h"
DEFINE_MTYPE( LIB, IF, "Interface")
DEFINE_MTYPE_STATIC(LIB, CONNECTED, "Connected")
DEFINE_MTYPE_STATIC(LIB, NBR_CONNECTED, "Neighbor Connected")
DEFINE_MTYPE( LIB, CONNECTED_LABEL, "Connected interface label")
DEFINE_MTYPE_STATIC(LIB, IF_LINK_PARAMS, "Informational Link Parameters")
/* List of interfaces in only the default VRF */ /* List of interfaces in only the default VRF */
int ptm_enable = 0; int ptm_enable = 0;

View File

@ -23,6 +23,10 @@ Boston, MA 02111-1307, USA. */
#include "zebra.h" #include "zebra.h"
#include "linklist.h" #include "linklist.h"
#include "memory.h"
DECLARE_MTYPE(IF)
DECLARE_MTYPE(CONNECTED_LABEL)
/* Interface link-layer type, if known. Derived from: /* Interface link-layer type, if known. Derived from:
* *

View File

@ -27,6 +27,9 @@
#include "if.h" #include "if.h"
#include "if_rmap.h" #include "if_rmap.h"
DEFINE_MTYPE_STATIC(LIB, IF_RMAP, "Interface route map")
DEFINE_MTYPE_STATIC(LIB, IF_RMAP_NAME, "I.f. route map name")
struct hash *ifrmaphash; struct hash *ifrmaphash;
/* Hook functions. */ /* Hook functions. */

View File

@ -40,4 +40,6 @@ extern void json_object_boolean_true_add(struct json_object* obj,
extern struct json_object* json_object_lock(struct json_object *obj); extern struct json_object* json_object_lock(struct json_object *obj);
extern void json_object_free(struct json_object *obj); extern void json_object_free(struct json_object *obj);
#define JSON_STR "JavaScript Object Notation\n"
#endif /* _QUAGGA_JSON_H */ #endif /* _QUAGGA_JSON_H */

View File

@ -25,6 +25,9 @@ Boston, MA 02111-1307, USA. */
#include "linklist.h" #include "linklist.h"
#include "keychain.h" #include "keychain.h"
DEFINE_MTYPE_STATIC(LIB, KEY, "Key")
DEFINE_MTYPE_STATIC(LIB, KEYCHAIN, "Key chain")
/* Master list of key chain. */ /* Master list of key chain. */
struct list *keychain_list; struct list *keychain_list;

View File

@ -24,6 +24,9 @@
#include "linklist.h" #include "linklist.h"
#include "memory.h" #include "memory.h"
DEFINE_MTYPE_STATIC(LIB, LINK_LIST, "Link List")
DEFINE_MTYPE_STATIC(LIB, LINK_NODE, "Link Node")
/* Allocate new list. */ /* Allocate new list. */
struct list * struct list *
list_new (void) list_new (void)

View File

@ -35,6 +35,8 @@
#include <ucontext.h> #include <ucontext.h>
#endif #endif
DEFINE_MTYPE_STATIC(LIB, ZLOG, "Logging")
static int logfile_fd = -1; /* Used in signal handler. */ static int logfile_fd = -1; /* Used in signal handler. */
struct zlog *zlog_default = NULL; struct zlog *zlog_default = NULL;
@ -680,6 +682,14 @@ _zlog_assert_failed (const char *assertion, const char *file,
abort(); abort();
} }
void
memory_oom (size_t size, const char *name)
{
zlog_err("out of memory: failed to allocate %zu bytes for %s"
"object", size, name);
zlog_backtrace(LOG_ERR);
abort();
}
/* Open log stream */ /* Open log stream */
struct zlog * struct zlog *
@ -898,11 +908,6 @@ static const struct zebra_desc_table command_types[] = {
DESC_ENTRY (ZEBRA_REDISTRIBUTE_DELETE), DESC_ENTRY (ZEBRA_REDISTRIBUTE_DELETE),
DESC_ENTRY (ZEBRA_REDISTRIBUTE_DEFAULT_ADD), DESC_ENTRY (ZEBRA_REDISTRIBUTE_DEFAULT_ADD),
DESC_ENTRY (ZEBRA_REDISTRIBUTE_DEFAULT_DELETE), DESC_ENTRY (ZEBRA_REDISTRIBUTE_DEFAULT_DELETE),
DESC_ENTRY (ZEBRA_IPV4_NEXTHOP_LOOKUP),
DESC_ENTRY (ZEBRA_IPV6_NEXTHOP_LOOKUP),
DESC_ENTRY (ZEBRA_IPV4_IMPORT_LOOKUP),
DESC_ENTRY (ZEBRA_IPV6_IMPORT_LOOKUP),
DESC_ENTRY (ZEBRA_INTERFACE_RENAME),
DESC_ENTRY (ZEBRA_ROUTER_ID_ADD), DESC_ENTRY (ZEBRA_ROUTER_ID_ADD),
DESC_ENTRY (ZEBRA_ROUTER_ID_DELETE), DESC_ENTRY (ZEBRA_ROUTER_ID_DELETE),
DESC_ENTRY (ZEBRA_ROUTER_ID_UPDATE), DESC_ENTRY (ZEBRA_ROUTER_ID_UPDATE),

View File

@ -1,487 +1,149 @@
/* /*
* Memory management routine * Copyright (c) 2015-16 David Lamparter, for NetDEF, Inc.
* Copyright (C) 1998 Kunihiro Ishiguro
* *
* This file is part of GNU Zebra. * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
* *
* GNU Zebra is free software; you can redistribute it and/or modify it * The above copyright notice and this permission notice shall be included in
* under the terms of the GNU General Public License as published by the * all copies or substantial portions of the Software.
* Free Software Foundation; either version 2, or (at your option) any
* later version.
* *
* GNU Zebra is distributed in the hope that it will be useful, but * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* WITHOUT ANY WARRANTY; without even the implied warranty of * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* General Public License for more details. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* You should have received a copy of the GNU General Public License * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* along with GNU Zebra; see the file COPYING. If not, write to the Free * DEALINGS IN THE SOFTWARE.
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/ */
#include <zebra.h> #include <zebra.h>
/* malloc.h is generally obsolete, however GNU Libc mallinfo wants it. */
#if !defined(HAVE_STDLIB_H) || (defined(GNU_LINUX) && defined(HAVE_MALLINFO))
#include <malloc.h>
#endif /* !HAVE_STDLIB_H || HAVE_MALLINFO */
#include "log.h" #include <stdlib.h>
#include "memory.h" #include "memory.h"
static void alloc_inc (int); static struct memgroup *mg_first = NULL;
static void alloc_dec (int); struct memgroup **mg_insert = &mg_first;
static void log_memstats(int log_priority);
static const struct message mstr [] = DEFINE_MGROUP(LIB, "libzebra")
DEFINE_MTYPE(LIB, TMP, "Temporary memory")
static inline void
mt_count_alloc (struct memtype *mt, size_t size)
{ {
{ MTYPE_THREAD, "thread" }, mt->n_alloc++;
{ MTYPE_THREAD_MASTER, "thread_master" },
{ MTYPE_VECTOR, "vector" }, if (mt->size == 0)
{ MTYPE_VECTOR_INDEX, "vector_index" }, mt->size = size;
{ MTYPE_IF, "interface" }, else if (mt->size != size)
{ 0, NULL }, mt->size = SIZE_VAR;
}
static inline void
mt_count_free (struct memtype *mt)
{
mt->n_alloc--;
}
static inline void *
mt_checkalloc (struct memtype *mt, void *ptr, size_t size)
{
if (__builtin_expect(ptr == NULL, 0))
{
memory_oom (size, mt->name);
return NULL;
}
mt_count_alloc (mt, size);
return ptr;
}
void *
qmalloc (struct memtype *mt, size_t size)
{
return mt_checkalloc (mt, malloc (size), size);
}
void *
qcalloc (struct memtype *mt, size_t size)
{
return mt_checkalloc (mt, calloc (size, 1), size);
}
void *
qrealloc (struct memtype *mt, void *ptr, size_t size)
{
if (ptr)
mt_count_free (mt);
return mt_checkalloc (mt, ptr ? realloc (ptr, size) : malloc (size), size);
}
void *
qstrdup (struct memtype *mt, const char *str)
{
return mt_checkalloc (mt, strdup (str), strlen (str) + 1);
}
void
qfree (struct memtype *mt, void *ptr)
{
if (ptr)
mt_count_free (mt);
free (ptr);
}
int
qmem_walk (qmem_walk_fn *func, void *arg)
{
struct memgroup *mg;
struct memtype *mt;
int rv;
for (mg = mg_first; mg; mg = mg->next)
{
if ((rv = func (arg, mg, NULL)))
return rv;
for (mt = mg->types; mt; mt = mt->next)
if ((rv = func (arg, mg, mt)))
return rv;
}
return 0;
}
struct exit_dump_args
{
const char *prefix;
int error;
}; };
/* Fatal memory allocation error occured. */ static int
static void __attribute__ ((noreturn)) qmem_exit_walker (void *arg, struct memgroup *mg, struct memtype *mt)
zerror (const char *fname, int type, size_t size)
{ {
zlog_err ("%s : can't allocate memory for `%s' size %d: %s\n", struct exit_dump_args *eda = arg;
fname, lookup (mstr, type), (int) size, safe_strerror(errno));
log_memstats(LOG_WARNING);
/* N.B. It might be preferable to call zlog_backtrace_sigsafe here, since
that function should definitely be safe in an OOM condition. But
unfortunately zlog_backtrace_sigsafe does not support syslog logging at
this time... */
zlog_backtrace(LOG_WARNING);
abort();
}
/* if (!mt)
* Allocate memory of a given size, to be tracked by a given type.
* Effects: Returns a pointer to usable memory. If memory cannot
* be allocated, aborts execution.
*/
void *
zmalloc (int type, size_t size)
{
void *memory;
memory = malloc (size);
if (memory == NULL)
zerror ("malloc", type, size);
alloc_inc (type);
return memory;
}
/*
* Allocate memory as in zmalloc, and also clear the memory.
* Add an extra 'z' prefix to function name to avoid collision when linking
* statically with zlib that exports the 'zcalloc' symbol.
*/
void *
zzcalloc (int type, size_t size)
{
void *memory;
memory = calloc (1, size);
if (memory == NULL)
zerror ("calloc", type, size);
alloc_inc (type);
return memory;
}
/*
* Given a pointer returned by zmalloc or zzcalloc, free it and
* return a pointer to a new size, basically acting like realloc().
* Requires: ptr was returned by zmalloc, zzcalloc, or zrealloc with the
* same type.
* Effects: Returns a pointer to the new memory, or aborts.
*/
void *
zrealloc (int type, void *ptr, size_t size)
{
void *memory;
if (ptr == NULL) /* is really alloc */
return zzcalloc(type, size);
memory = realloc (ptr, size);
if (memory == NULL)
zerror ("realloc", type, size);
if (ptr == NULL)
alloc_inc (type);
return memory;
}
/*
* Free memory allocated by z*alloc or zstrdup.
* Requires: ptr was returned by zmalloc, zzcalloc, or zrealloc with the
* same type.
* Effects: The memory is freed and may no longer be referenced.
*/
void
zfree (int type, void *ptr)
{
if (ptr != NULL)
{ {
alloc_dec (type); fprintf (stderr, "%s: showing active allocations in memory group %s\n",
free (ptr); eda->prefix, mg->name);
} }
} else if (mt->n_alloc)
/*
* Duplicate a string, counting memory usage by type.
* Effects: The string is duplicated, and the return value must
* eventually be passed to zfree with the same type. The function will
* succeed or abort.
*/
char *
zstrdup (int type, const char *str)
{
void *dup;
dup = strdup (str);
if (dup == NULL)
zerror ("strdup", type, strlen (str));
alloc_inc (type);
return dup;
}
#ifdef MEMORY_LOG
static struct
{
const char *name;
long alloc;
unsigned long t_malloc;
unsigned long c_malloc;
unsigned long t_calloc;
unsigned long c_calloc;
unsigned long t_realloc;
unsigned long t_free;
unsigned long c_strdup;
} mstat [MTYPE_MAX];
static void
mtype_log (char *func, void *memory, const char *file, int line, int type)
{
zlog_debug ("%s: %s %p %s %d", func, lookup (mstr, type), memory, file, line);
}
void *
mtype_zmalloc (const char *file, int line, int type, size_t size)
{
void *memory;
mstat[type].c_malloc++;
mstat[type].t_malloc++;
memory = zmalloc (type, size);
mtype_log ("zmalloc", memory, file, line, type);
return memory;
}
void *
mtype_zcalloc (const char *file, int line, int type, size_t size)
{
void *memory;
mstat[type].c_calloc++;
mstat[type].t_calloc++;
memory = zzcalloc (type, size);
mtype_log ("xcalloc", memory, file, line, type);
return memory;
}
void *
mtype_zrealloc (const char *file, int line, int type, void *ptr, size_t size)
{
void *memory;
/* Realloc need before allocated pointer. */
mstat[type].t_realloc++;
memory = zrealloc (type, ptr, size);
mtype_log ("xrealloc", memory, file, line, type);
return memory;
}
/* Important function. */
void
mtype_zfree (const char *file, int line, int type, void *ptr)
{
mstat[type].t_free++;
mtype_log ("xfree", ptr, file, line, type);
zfree (type, ptr);
}
char *
mtype_zstrdup (const char *file, int line, int type, const char *str)
{
char *memory;
mstat[type].c_strdup++;
memory = zstrdup (type, str);
mtype_log ("xstrdup", memory, file, line, type);
return memory;
}
#else
static struct
{
char *name;
long alloc;
} mstat [MTYPE_MAX];
#endif /* MEMORY_LOG */
/* Increment allocation counter. */
static void
alloc_inc (int type)
{
mstat[type].alloc++;
}
/* Decrement allocation counter. */
static void
alloc_dec (int type)
{
mstat[type].alloc--;
}
/* Looking up memory status from vty interface. */
#include "vector.h"
#include "vty.h"
#include "command.h"
static void
log_memstats(int pri)
{
struct mlist *ml;
for (ml = mlists; ml->list; ml++)
{ {
struct memory_list *m; char size[32];
eda->error++;
zlog (NULL, pri, "Memory utilization in module %s:", ml->name); snprintf (size, sizeof (size), "%10zu", mt->size);
for (m = ml->list; m->index >= 0; m++) fprintf (stderr, "%s: %-30s: %6zu * %s\n",
if (m->index && mstat[m->index].alloc) eda->prefix, mt->name, mt->n_alloc,
zlog (NULL, pri, " %-30s: %10ld", m->format, mstat[m->index].alloc); mt->size == SIZE_VAR ? "(variably sized)" : size);
} }
return 0;
} }
void void
log_memstats_stderr (const char *prefix) log_memstats_stderr (const char *prefix)
{ {
struct mlist *ml; struct exit_dump_args eda = { .prefix = prefix, .error = 0 };
struct memory_list *m; qmem_walk (qmem_exit_walker, &eda);
int i;
int j = 0;
for (ml = mlists; ml->list; ml++)
{
i = 0;
for (m = ml->list; m->index >= 0; m++)
if (m->index && mstat[m->index].alloc)
{
if (!i)
fprintf (stderr,
"%s: memstats: Current memory utilization in module %s:\n",
prefix,
ml->name);
fprintf (stderr,
"%s: memstats: %-30s: %10ld%s\n",
prefix,
m->format,
mstat[m->index].alloc,
mstat[m->index].alloc < 0 ? " (REPORT THIS BUG!)" : "");
i = j = 1;
}
}
if (j)
fprintf (stderr,
"%s: memstats: NOTE: If configuration exists, utilization may be "
"expected.\n",
prefix);
else
fprintf (stderr,
"%s: memstats: No remaining tracked memory utilization.\n",
prefix);
}
static void
show_separator(struct vty *vty)
{
vty_out (vty, "-----------------------------\r\n");
}
static int
show_memory_vty (struct vty *vty, struct memory_list *list)
{
struct memory_list *m;
int needsep = 0;
for (m = list; m->index >= 0; m++)
if (m->index == 0)
{
if (needsep)
{
show_separator (vty);
needsep = 0;
}
}
else if (mstat[m->index].alloc)
{
vty_out (vty, "%-30s: %10ld\r\n", m->format, mstat[m->index].alloc);
needsep = 1;
}
return needsep;
}
#ifdef HAVE_MALLINFO
static int
show_memory_mallinfo (struct vty *vty)
{
struct mallinfo minfo = mallinfo();
char buf[MTYPE_MEMSTR_LEN];
vty_out (vty, "System allocator statistics:%s", VTY_NEWLINE);
vty_out (vty, " Total heap allocated: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.arena),
VTY_NEWLINE);
vty_out (vty, " Holding block headers: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.hblkhd),
VTY_NEWLINE);
vty_out (vty, " Used small blocks: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.usmblks),
VTY_NEWLINE);
vty_out (vty, " Used ordinary blocks: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.uordblks),
VTY_NEWLINE);
vty_out (vty, " Free small blocks: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fsmblks),
VTY_NEWLINE);
vty_out (vty, " Free ordinary blocks: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fordblks),
VTY_NEWLINE);
vty_out (vty, " Ordinary blocks: %ld%s",
(unsigned long)minfo.ordblks,
VTY_NEWLINE);
vty_out (vty, " Small blocks: %ld%s",
(unsigned long)minfo.smblks,
VTY_NEWLINE);
vty_out (vty, " Holding blocks: %ld%s",
(unsigned long)minfo.hblks,
VTY_NEWLINE);
vty_out (vty, "(see system documentation for 'mallinfo' for meaning)%s",
VTY_NEWLINE);
return 1;
}
#endif /* HAVE_MALLINFO */
DEFUN (show_memory,
show_memory_cmd,
"show memory",
"Show running system information\n"
"Memory statistics\n")
{
struct mlist *ml;
int needsep = 0;
#ifdef HAVE_MALLINFO
needsep = show_memory_mallinfo (vty);
#endif /* HAVE_MALLINFO */
for (ml = mlists; ml->list; ml++)
{
if (needsep)
show_separator (vty);
needsep = show_memory_vty (vty, ml->list);
}
return CMD_SUCCESS;
}
void
memory_init (void)
{
install_element (RESTRICTED_NODE, &show_memory_cmd);
install_element (VIEW_NODE, &show_memory_cmd);
install_element (ENABLE_NODE, &show_memory_cmd);
}
/* Stats querying from users */
/* Return a pointer to a human friendly string describing
* the byte count passed in. E.g:
* "0 bytes", "2048 bytes", "110kB", "500MiB", "11GiB", etc.
* Up to 4 significant figures will be given.
* The pointer returned may be NULL (indicating an error)
* or point to the given buffer, or point to static storage.
*/
const char *
mtype_memstr (char *buf, size_t len, unsigned long bytes)
{
unsigned int m, k;
/* easy cases */
if (!bytes)
return "0 bytes";
if (bytes == 1)
return "1 byte";
/*
* When we pass the 2gb barrier mallinfo() can no longer report
* correct data so it just does something odd...
* Reporting like Terrabytes of data. Which makes users...
* edgy.. yes edgy that's the term for it.
* So let's just give up gracefully
*/
if (bytes > 0x7fffffff)
return "> 2GB";
m = bytes >> 20;
k = bytes >> 10;
if (m > 10)
{
if (bytes & (1 << 19))
m++;
snprintf (buf, len, "%d MiB", m);
}
else if (k > 10)
{
if (bytes & (1 << 9))
k++;
snprintf (buf, len, "%d KiB", k);
}
else
snprintf (buf, len, "%ld bytes", bytes);
return buf;
}
unsigned long
mtype_stats_alloc (int type)
{
return mstat[type].alloc;
} }

View File

@ -1,96 +1,198 @@
/* Memory management routine /*
Copyright (C) 1998 Kunihiro Ishiguro * Copyright (c) 2015-16 David Lamparter, for NetDEF, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
This file is part of GNU Zebra. #ifndef _QUAGGA_MEMORY_H
#define _QUAGGA_MEMORY_H
GNU Zebra is free software; you can redistribute it and/or modify it #include <stdlib.h>
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
GNU Zebra is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Zebra; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef _ZEBRA_MEMORY_H
#define _ZEBRA_MEMORY_H
#define array_size(ar) (sizeof(ar) / sizeof(ar[0])) #define array_size(ar) (sizeof(ar) / sizeof(ar[0]))
/* For pretty printing of memory allocate information. */ #define SIZE_VAR ~0UL
struct memory_list struct memtype
{ {
int index; struct memtype *next, **ref;
const char *format; const char *name;
size_t n_alloc;
size_t size;
}; };
struct mlist { struct memgroup
struct memory_list *list; {
struct memgroup *next, **ref;
struct memtype *types, **insert;
const char *name; const char *name;
}; };
#include "lib/memtypes.h" #if defined(__clang__)
# if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 5)
# define _RET_NONNULL , returns_nonnull
# endif
# define _CONSTRUCTOR(x) constructor(x)
#elif defined(__GNUC__)
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)
# define _RET_NONNULL , returns_nonnull
# endif
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
# define _CONSTRUCTOR(x) constructor(x)
# define _DESTRUCTOR(x) destructor(x)
# define _ALLOC_SIZE(x) alloc_size(x)
# endif
#endif
extern struct mlist mlists[]; #ifdef __sun
/* Solaris doesn't do constructor priorities due to linker restrictions */
# undef _CONSTRUCTOR
# undef _DESTRUCTOR
#endif
/* #define MEMORY_LOG */ #ifndef _RET_NONNULL
#ifdef MEMORY_LOG # define _RET_NONNULL
#define XMALLOC(mtype, size) \ #endif
mtype_zmalloc (__FILE__, __LINE__, (mtype), (size)) #ifndef _CONSTRUCTOR
#define XCALLOC(mtype, size) \ # define _CONSTRUCTOR(x) constructor
mtype_zcalloc (__FILE__, __LINE__, (mtype), (size)) #endif
#define XREALLOC(mtype, ptr, size) \ #ifndef _DESTRUCTOR
mtype_zrealloc (__FILE__, __LINE__, (mtype), (ptr), (size)) # define _DESTRUCTOR(x) destructor
#define XFREE(mtype, ptr) \ #endif
do { \ #ifndef _ALLOC_SIZE
mtype_zfree (__FILE__, __LINE__, (mtype), (ptr)); \ # define _ALLOC_SIZE(x)
ptr = NULL; } \ #endif
while (0)
#define XSTRDUP(mtype, str) \
mtype_zstrdup (__FILE__, __LINE__, (mtype), (str))
#else
#define XMALLOC(mtype, size) zmalloc ((mtype), (size))
#define XCALLOC(mtype, size) zzcalloc ((mtype), (size))
#define XREALLOC(mtype, ptr, size) zrealloc ((mtype), (ptr), (size))
#define XFREE(mtype, ptr) do { \
zfree ((mtype), (ptr)); \
ptr = NULL; } \
while (0)
#define XSTRDUP(mtype, str) zstrdup ((mtype), (str))
#endif /* MEMORY_LOG */
/* Prototypes of memory function. */ /* macro usage:
extern void *zmalloc (int type, size_t size); *
extern void *zzcalloc (int type, size_t size); * mydaemon.h
extern void *zrealloc (int type, void *ptr, size_t size); * DECLARE_MGROUP(MYDAEMON)
extern void zfree (int type, void *ptr); * DECLARE_MTYPE(MYDAEMON_COMMON)
extern char *zstrdup (int type, const char *str); *
* mydaemon.c
* DEFINE_MGROUP(MYDAEMON, "my daemon memory")
* DEFINE_MTYPE(MYDAEMON, MYDAEMON_COMMON,
* "this mtype is used in multiple files in mydaemon")
* foo = qmalloc (MTYPE_MYDAEMON_COMMON, sizeof (*foo))
*
* mydaemon_io.c
* bar = qmalloc (MTYPE_MYDAEMON_COMMON, sizeof (*bar))
*
* DEFINE_MTYPE_STATIC(MYDAEMON, MYDAEMON_IO,
* "this mtype is used only in this file")
* baz = qmalloc (MTYPE_MYDAEMON_IO, sizeof (*baz))
*
* Note: Naming conventions (MGROUP_ and MTYPE_ prefixes are enforced
* by not having these as part of the macro arguments)
* Note: MTYPE_* are symbols to the compiler (of type struct memtype *),
* but MGROUP_* aren't.
*/
extern void *mtype_zmalloc (const char *file, int line, int type, size_t size); #define DECLARE_MGROUP(name) \
extern struct memgroup _mg_##name;
#define DEFINE_MGROUP(mname, desc) \
struct memgroup _mg_##mname \
__attribute__ ((section (".data.mgroups"))) = { \
.name = desc, \
.types = NULL, .next = NULL, .insert = NULL, .ref = NULL, \
}; \
static void _mginit_##mname (void) \
__attribute__ ((_CONSTRUCTOR (1000))); \
static void _mginit_##mname (void) \
{ extern struct memgroup **mg_insert; \
_mg_##mname.ref = mg_insert; \
*mg_insert = &_mg_##mname; \
mg_insert = &_mg_##mname.next; } \
static void _mgfini_##mname (void) \
__attribute__ ((_DESTRUCTOR (1000))); \
static void _mgfini_##mname (void) \
{ if (_mg_##mname.next) \
_mg_##mname.next->ref = _mg_##mname.ref; \
*_mg_##mname.ref = _mg_##mname.next; }
extern void *mtype_zcalloc (const char *file, int line, int type, size_t size);
extern void *mtype_zrealloc (const char *file, int line, int type, void *ptr, #define DECLARE_MTYPE(name) \
size_t size); extern struct memtype _mt_##name; \
static struct memtype * const MTYPE_ ## name = &_mt_##name;
extern void mtype_zfree (const char *file, int line, int type, #define DEFINE_MTYPE_ATTR(group, mname, attr, desc) \
void *ptr); attr struct memtype _mt_##mname \
__attribute__ ((section (".data.mtypes"))) = { \
.name = desc, \
.next = NULL, .n_alloc = 0, .size = 0, .ref = NULL, \
}; \
static void _mtinit_##mname (void) \
__attribute__ ((_CONSTRUCTOR (1001))); \
static void _mtinit_##mname (void) \
{ if (_mg_##group.insert == NULL) \
_mg_##group.insert = &_mg_##group.types; \
_mt_##mname.ref = _mg_##group.insert; \
*_mg_##group.insert = &_mt_##mname; \
_mg_##group.insert = &_mt_##mname.next; } \
static void _mtfini_##mname (void) \
__attribute__ ((_DESTRUCTOR (1001))); \
static void _mtfini_##mname (void) \
{ if (_mt_##mname.next) \
_mt_##mname.next->ref = _mt_##mname.ref; \
*_mt_##mname.ref = _mt_##mname.next; }
extern char *mtype_zstrdup (const char *file, int line, int type, #define DEFINE_MTYPE(group, name, desc) \
const char *str); DEFINE_MTYPE_ATTR(group, name, , desc)
extern void memory_init (void); #define DEFINE_MTYPE_STATIC(group, name, desc) \
DEFINE_MTYPE_ATTR(group, name, static, desc) \
static struct memtype * const MTYPE_ ## name = &_mt_##name;
DECLARE_MGROUP(LIB)
DECLARE_MTYPE(TMP)
extern void *qmalloc (struct memtype *mt, size_t size)
__attribute__ ((malloc, _ALLOC_SIZE(2), nonnull (1) _RET_NONNULL));
extern void *qcalloc (struct memtype *mt, size_t size)
__attribute__ ((malloc, _ALLOC_SIZE(2), nonnull (1) _RET_NONNULL));
extern void *qrealloc (struct memtype *mt, void *ptr, size_t size)
__attribute__ ((_ALLOC_SIZE(3), nonnull (1) _RET_NONNULL));
extern void *qstrdup (struct memtype *mt, const char *str)
__attribute__ ((malloc, nonnull (1) _RET_NONNULL));
extern void qfree (struct memtype *mt, void *ptr)
__attribute__ ((nonnull (1)));
#define XMALLOC(mtype, size) qmalloc(mtype, size)
#define XCALLOC(mtype, size) qcalloc(mtype, size)
#define XREALLOC(mtype, ptr, size) qrealloc(mtype, ptr, size)
#define XSTRDUP(mtype, str) qstrdup(mtype, str)
#define XFREE(mtype, ptr) do { qfree(mtype, ptr); ptr = NULL; } \
while (0)
static inline size_t mtype_stats_alloc(struct memtype *mt)
{
return mt->n_alloc;
}
/* NB: calls are ordered by memgroup; and there is a call with mt == NULL for
* each memgroup (so that a header can be printed, and empty memgroups show)
*
* return value: 0: continue, !0: abort walk. qmem_walk will return the
* last value from qmem_walk_fn. */
typedef int qmem_walk_fn (void *arg, struct memgroup *mg, struct memtype *mt);
extern int qmem_walk (qmem_walk_fn *func, void *arg);
extern void log_memstats_stderr (const char *); extern void log_memstats_stderr (const char *);
/* return number of allocations outstanding for the type */ extern void memory_oom (size_t size, const char *name);
extern unsigned long mtype_stats_alloc (int);
/* Human friendly string for given byte count */ #endif /* _QUAGGA_MEMORY_H */
#define MTYPE_MEMSTR_LEN 20
extern const char *mtype_memstr (char *, size_t, unsigned long);
#endif /* _ZEBRA_MEMORY_H */

169
lib/memory_vty.c Normal file
View File

@ -0,0 +1,169 @@
/*
* Memory management routine
* Copyright (C) 1998 Kunihiro Ishiguro
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Zebra; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include <zebra.h>
/* malloc.h is generally obsolete, however GNU Libc mallinfo wants it. */
#if !defined(HAVE_STDLIB_H) || (defined(GNU_LINUX) && defined(HAVE_MALLINFO))
#include <malloc.h>
#endif /* !HAVE_STDLIB_H || HAVE_MALLINFO */
#include "log.h"
#include "memory.h"
#include "memory_vty.h"
/* Looking up memory status from vty interface. */
#include "vector.h"
#include "vty.h"
#include "command.h"
#ifdef HAVE_MALLINFO
static int
show_memory_mallinfo (struct vty *vty)
{
struct mallinfo minfo = mallinfo();
char buf[MTYPE_MEMSTR_LEN];
vty_out (vty, "System allocator statistics:%s", VTY_NEWLINE);
vty_out (vty, " Total heap allocated: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.arena),
VTY_NEWLINE);
vty_out (vty, " Holding block headers: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.hblkhd),
VTY_NEWLINE);
vty_out (vty, " Used small blocks: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.usmblks),
VTY_NEWLINE);
vty_out (vty, " Used ordinary blocks: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.uordblks),
VTY_NEWLINE);
vty_out (vty, " Free small blocks: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fsmblks),
VTY_NEWLINE);
vty_out (vty, " Free ordinary blocks: %s%s",
mtype_memstr (buf, MTYPE_MEMSTR_LEN, minfo.fordblks),
VTY_NEWLINE);
vty_out (vty, " Ordinary blocks: %ld%s",
(unsigned long)minfo.ordblks,
VTY_NEWLINE);
vty_out (vty, " Small blocks: %ld%s",
(unsigned long)minfo.smblks,
VTY_NEWLINE);
vty_out (vty, " Holding blocks: %ld%s",
(unsigned long)minfo.hblks,
VTY_NEWLINE);
vty_out (vty, "(see system documentation for 'mallinfo' for meaning)%s",
VTY_NEWLINE);
return 1;
}
#endif /* HAVE_MALLINFO */
static int qmem_walker(void *arg, struct memgroup *mg, struct memtype *mt)
{
struct vty *vty = arg;
if (!mt)
vty_out (vty, "--- qmem %s ---%s", mg->name, VTY_NEWLINE);
else {
char size[32];
snprintf(size, sizeof(size), "%6zu", mt->size);
vty_out (vty, "%-30s: %10zu %s%s",
mt->name, mt->n_alloc,
mt->size == 0 ? "" :
mt->size == SIZE_VAR ? "(variably sized)" :
size, VTY_NEWLINE);
}
return 0;
}
DEFUN (show_memory,
show_memory_cmd,
"show memory",
"Show running system information\n"
"Memory statistics\n")
{
#ifdef HAVE_MALLINFO
show_memory_mallinfo (vty);
#endif /* HAVE_MALLINFO */
qmem_walk(qmem_walker, vty);
return CMD_SUCCESS;
}
void
memory_init (void)
{
install_element (RESTRICTED_NODE, &show_memory_cmd);
install_element (VIEW_NODE, &show_memory_cmd);
install_element (ENABLE_NODE, &show_memory_cmd);
}
/* Stats querying from users */
/* Return a pointer to a human friendly string describing
* the byte count passed in. E.g:
* "0 bytes", "2048 bytes", "110kB", "500MiB", "11GiB", etc.
* Up to 4 significant figures will be given.
* The pointer returned may be NULL (indicating an error)
* or point to the given buffer, or point to static storage.
*/
const char *
mtype_memstr (char *buf, size_t len, unsigned long bytes)
{
unsigned int m, k;
/* easy cases */
if (!bytes)
return "0 bytes";
if (bytes == 1)
return "1 byte";
/*
* When we pass the 2gb barrier mallinfo() can no longer report
* correct data so it just does something odd...
* Reporting like Terrabytes of data. Which makes users...
* edgy.. yes edgy that's the term for it.
* So let's just give up gracefully
*/
if (bytes > 0x7fffffff)
return "> 2GB";
m = bytes >> 20;
k = bytes >> 10;
if (m > 10)
{
if (bytes & (1 << 19))
m++;
snprintf (buf, len, "%d MiB", m);
}
else if (k > 10)
{
if (bytes & (1 << 9))
k++;
snprintf (buf, len, "%d KiB", k);
}
else
snprintf (buf, len, "%ld bytes", bytes);
return buf;
}

31
lib/memory_vty.h Normal file
View File

@ -0,0 +1,31 @@
/* Memory management routine
Copyright (C) 1998 Kunihiro Ishiguro
This file is part of GNU Zebra.
GNU Zebra is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
GNU Zebra is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Zebra; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#ifndef _ZEBRA_MEMORY_VTY_H
#define _ZEBRA_MEMORY_VTY_H
#include "memory.h"
extern void memory_init (void);
/* Human friendly string for given byte count */
#define MTYPE_MEMSTR_LEN 20
extern const char *mtype_memstr (char *, size_t, unsigned long);
#endif /* _ZEBRA_MEMORY_VTY_H */

View File

@ -1,87 +0,0 @@
###
# Copyright (C) Paul Jakma 2005
#
# This file is part of Quagga.
#
# Quagga is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any
# later version.
#
# Quagga is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Quagga; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
###
#
# Scan a file of memory definitions (see eg memtypes.c) and generate
# a corresponding header file with an enum of the MTYPE's and declarations
# for the struct memory_list arrays
#
# struct memory_list's must be declared as:
# '\nstruct memory_list memory_list_<name>[] .....'
#
# Each MTYPE_ within the definition must the second token on the line,
# tokens being delineated by whitespace. It may only consist of the set of
# characters [[:upper:]_[:digit:]]. Eg:
#
# '\n { MTYPE_AWESOME_IPV8 , "Amazing new protocol, says genius" {}..boo'
#
# We try to ignore lines whose first token is /* or *, ie C comment lines.
# So the following should work fine:
#
# '/* This is the best memory_list ever!
# ' * It's got all my MTYPE's */
# '
# 'struct memory_list memory_list_my_amazing_mlist[] = =
# '{
# ' { MTYPE_DONGLE, "Dongle widget" }
# ' { MTYPE_FROB, "Frobulator" },
# '{ MTYPE_WIPPLE, "Wipple combombulator"}
# '}}}
#
# Even if it isn't quite a valid C declaration.
#
BEGIN {
mlistregex = "memory_list_(.*)\\[\\]";
mtyperegex = "^(MTYPE_[[:upper:]_[:digit:]]+).*";
header = "/* Auto-generated from memtypes.c by " ARGV[0] ". */\n";
header = header "/* Do not edit! */\n";
header = header "\n#ifndef _QUAGGA_MEMTYPES_H\n";
header = header "#define _QUAGGA_MEMTYPES_H\n";
footer = "\n#endif /* _QUAGGA_MEMTYPES_H */\n\n";
mlistformat = "extern struct memory_list memory_list_%s[];";
printf ("%s\n", header);
}
# catch lines beginning with 'struct memory list ' and try snag the
# memory_list name. Has to be 3rd field.
($0 ~ /^struct memory_list /) && (NF >= 3) {
mlists[lcount++] = gensub(mlistregex, "\\1", "g",$3);
}
# snag the MTYPE, it must self-standing and the second field,
# though we do manage to tolerate the , C seperator being appended
($1 !~ /^\/?\*/) && ($2 ~ /^MTYPE_/) {
mtype[tcount++] = gensub(mtyperegex, "\\1", "g", $2);
}
END {
printf("enum\n{\n MTYPE_TMP = 1,\n");
for (i = 0; i < tcount; i++) {
if (mtype[i] != "" && mtype[i] != "MTYPE_TMP")
printf (" %s,\n", mtype[i]);
}
printf (" MTYPE_MAX,\n};\n\n");
for (i = 0; i < lcount; i++) {
if (mlists[i] != "")
printf (mlistformat "\n", mlists[i]);
}
printf (footer);
}

View File

@ -1,317 +0,0 @@
/*
* Memory type definitions. This file is parsed by memtypes.awk to extract
* MTYPE_ and memory_list_.. information in order to autogenerate
* memtypes.h.
*
* The script is sensitive to the format (though not whitespace), see
* the top of memtypes.awk for more details.
*/
#include "zebra.h"
#include "memory.h"
struct memory_list memory_list_lib[] =
{
{ MTYPE_TMP, "Temporary memory" },
{ MTYPE_STRVEC, "String vector" },
{ MTYPE_VECTOR, "Vector" },
{ MTYPE_VECTOR_INDEX, "Vector index" },
{ MTYPE_LINK_LIST, "Link List" },
{ MTYPE_LINK_NODE, "Link Node" },
{ MTYPE_THREAD, "Thread" },
{ MTYPE_THREAD_MASTER, "Thread master" },
{ MTYPE_THREAD_STATS, "Thread stats" },
{ MTYPE_VTY, "VTY" },
{ MTYPE_VTY_OUT_BUF, "VTY output buffer" },
{ MTYPE_VTY_HIST, "VTY history" },
{ MTYPE_IF, "Interface" },
{ MTYPE_CONNECTED, "Connected" },
{ MTYPE_NBR_CONNECTED, "Neighbor Connected" },
{ MTYPE_CONNECTED_LABEL, "Connected interface label" },
{ MTYPE_BUFFER, "Buffer" },
{ MTYPE_BUFFER_DATA, "Buffer data" },
{ MTYPE_STREAM, "Stream" },
{ MTYPE_STREAM_DATA, "Stream data" },
{ MTYPE_STREAM_FIFO, "Stream FIFO" },
{ MTYPE_PREFIX, "Prefix" },
{ MTYPE_PREFIX_IPV4, "Prefix IPv4" },
{ MTYPE_PREFIX_IPV6, "Prefix IPv6" },
{ MTYPE_HASH, "Hash" },
{ MTYPE_HASH_BACKET, "Hash Bucket" },
{ MTYPE_HASH_INDEX, "Hash Index" },
{ MTYPE_ROUTE_TABLE, "Route table" },
{ MTYPE_ROUTE_NODE, "Route node" },
{ MTYPE_DISTRIBUTE, "Distribute list" },
{ MTYPE_DISTRIBUTE_IFNAME, "Dist-list ifname" },
{ MTYPE_DISTRIBUTE_NAME, "Dist-list name" },
{ MTYPE_ACCESS_LIST, "Access List" },
{ MTYPE_ACCESS_LIST_STR, "Access List Str" },
{ MTYPE_ACCESS_FILTER, "Access Filter" },
{ MTYPE_PREFIX_LIST, "Prefix List" },
{ MTYPE_PREFIX_LIST_ENTRY, "Prefix List Entry" },
{ MTYPE_PREFIX_LIST_STR, "Prefix List Str" },
{ MTYPE_PREFIX_LIST_TRIE, "Prefix List Trie Table" },
{ MTYPE_ROUTE_MAP, "Route map" },
{ MTYPE_ROUTE_MAP_NAME, "Route map name" },
{ MTYPE_ROUTE_MAP_INDEX, "Route map index" },
{ MTYPE_ROUTE_MAP_RULE, "Route map rule" },
{ MTYPE_ROUTE_MAP_RULE_STR, "Route map rule str" },
{ MTYPE_ROUTE_MAP_COMPILED, "Route map compiled" },
{ MTYPE_ROUTE_MAP_DEP, "Route map dependency" },
{ MTYPE_CMD_TOKENS, "Command desc" },
{ MTYPE_KEY, "Key" },
{ MTYPE_KEYCHAIN, "Key chain" },
{ MTYPE_IF_RMAP, "Interface route map" },
{ MTYPE_IF_RMAP_NAME, "I.f. route map name", },
{ MTYPE_SOCKUNION, "Socket union" },
{ MTYPE_PRIVS, "Privilege information" },
{ MTYPE_ZLOG, "Logging" },
{ MTYPE_ZCLIENT, "Zclient" },
{ MTYPE_WORK_QUEUE, "Work queue" },
{ MTYPE_WORK_QUEUE_ITEM, "Work queue item" },
{ MTYPE_WORK_QUEUE_NAME, "Work queue name string" },
{ MTYPE_PQUEUE, "Priority queue" },
{ MTYPE_PQUEUE_DATA, "Priority queue data" },
{ MTYPE_HOST, "Host config" },
{ MTYPE_BFD_INFO, "BFD info" },
{ MTYPE_VRF, "VRF" },
{ MTYPE_VRF_NAME, "VRF name" },
{ MTYPE_VRF_BITMAP, "VRF bit-map" },
{ MTYPE_NS, "Logical-Router" },
{ MTYPE_NS_NAME, "Logical-Router Name" },
{ MTYPE_NS_BITMAP, "Logical-Router bit-map" },
{ MTYPE_IF_LINK_PARAMS, "Informational Link Parameters" },
{ -1, NULL },
};
struct memory_list memory_list_zebra[] =
{
{ MTYPE_RTADV_PREFIX, "Router Advertisement Prefix" },
{ MTYPE_ZEBRA_NS, "Zebra Name Space" },
{ MTYPE_ZEBRA_VRF, "ZEBRA VRF" },
{ MTYPE_NEXTHOP, "Nexthop" },
{ MTYPE_RIB, "RIB" },
{ MTYPE_RIB_QUEUE, "RIB process work queue" },
{ MTYPE_STATIC_ROUTE, "Static route" },
{ MTYPE_RIB_DEST, "RIB destination" },
{ MTYPE_RIB_TABLE_INFO, "RIB table info" },
{ MTYPE_RNH, "Nexthop tracking object" },
{ MTYPE_NETLINK_NAME, "Netlink name" },
{ -1, NULL },
};
struct memory_list memory_list_bgp[] =
{
{ MTYPE_BGP, "BGP instance" },
{ MTYPE_BGP_LISTENER, "BGP listen socket details" },
{ MTYPE_BGP_PEER, "BGP peer" },
{ MTYPE_BGP_PEER_HOST, "BGP peer hostname" },
{ MTYPE_BGP_PEER_IFNAME, "BGP peer ifname" },
{ MTYPE_BGP_PEER_GROUP, "BGP Peer group" },
{ MTYPE_BGP_PEER_GROUP_HOST, "BGP Peer group hostname" },
{ MTYPE_PEER_DESC, "Peer description" },
{ MTYPE_PEER_PASSWORD, "Peer password string" },
{ MTYPE_BGP_PEER_AF, "BGP peer af" },
{ MTYPE_BGP_UPDGRP, "BGP update group" },
{ MTYPE_BGP_UPD_SUBGRP, "BGP update subgroup" },
{ MTYPE_BGP_PACKET, "BGP packet" },
{ MTYPE_ATTR, "BGP attribute" },
{ MTYPE_ATTR_EXTRA, "BGP extra attributes" },
{ MTYPE_AS_PATH, "BGP aspath" },
{ MTYPE_AS_SEG, "BGP aspath seg" },
{ MTYPE_AS_SEG_DATA, "BGP aspath segment data" },
{ MTYPE_AS_STR, "BGP aspath str" },
{ 0, NULL },
{ MTYPE_BGP_TABLE, "BGP table" },
{ MTYPE_BGP_NODE, "BGP node" },
{ MTYPE_BGP_ROUTE, "BGP route" },
{ MTYPE_BGP_ROUTE_EXTRA, "BGP ancillary route info" },
{ MTYPE_BGP_CONN, "BGP connected" },
{ MTYPE_BGP_STATIC, "BGP static" },
{ MTYPE_BGP_ADVERTISE_ATTR, "BGP adv attr" },
{ MTYPE_BGP_ADVERTISE, "BGP adv" },
{ MTYPE_BGP_SYNCHRONISE, "BGP synchronise" },
{ MTYPE_BGP_ADJ_IN, "BGP adj in" },
{ MTYPE_BGP_ADJ_OUT, "BGP adj out" },
{ MTYPE_BGP_MPATH_INFO, "BGP multipath info" },
{ 0, NULL },
{ MTYPE_AS_LIST, "BGP AS list" },
{ MTYPE_AS_FILTER, "BGP AS filter" },
{ MTYPE_AS_FILTER_STR, "BGP AS filter str" },
{ 0, NULL },
{ MTYPE_COMMUNITY, "community" },
{ MTYPE_COMMUNITY_VAL, "community val" },
{ MTYPE_COMMUNITY_STR, "community str" },
{ 0, NULL },
{ MTYPE_ECOMMUNITY, "extcommunity" },
{ MTYPE_ECOMMUNITY_VAL, "extcommunity val" },
{ MTYPE_ECOMMUNITY_STR, "extcommunity str" },
{ 0, NULL },
{ MTYPE_COMMUNITY_LIST, "community-list" },
{ MTYPE_COMMUNITY_LIST_NAME, "community-list name" },
{ MTYPE_COMMUNITY_LIST_ENTRY, "community-list entry" },
{ MTYPE_COMMUNITY_LIST_CONFIG, "community-list config" },
{ MTYPE_COMMUNITY_LIST_HANDLER, "community-list handler" },
{ 0, NULL },
{ MTYPE_CLUSTER, "Cluster list" },
{ MTYPE_CLUSTER_VAL, "Cluster list val" },
{ 0, NULL },
{ MTYPE_BGP_PROCESS_QUEUE, "BGP Process queue" },
{ MTYPE_BGP_CLEAR_NODE_QUEUE, "BGP node clear queue" },
{ 0, NULL },
{ MTYPE_TRANSIT, "BGP transit attr" },
{ MTYPE_TRANSIT_VAL, "BGP transit val" },
{ 0, NULL },
{ MTYPE_BGP_DEBUG_FILTER, "BGP debug filter" },
{ MTYPE_BGP_DEBUG_STR, "BGP debug filter string" },
{ 0, NULL },
{ MTYPE_BGP_DISTANCE, "BGP distance" },
{ MTYPE_BGP_NEXTHOP_CACHE, "BGP nexthop" },
{ MTYPE_BGP_CONFED_LIST, "BGP confed list" },
{ MTYPE_PEER_UPDATE_SOURCE, "BGP peer update interface" },
{ MTYPE_PEER_CONF_IF, "BGP peer config interface" },
{ MTYPE_BGP_DAMP_INFO, "Dampening info" },
{ MTYPE_BGP_DAMP_ARRAY, "BGP Dampening array" },
{ MTYPE_BGP_REGEXP, "BGP regexp" },
{ MTYPE_BGP_AGGREGATE, "BGP aggregate" },
{ MTYPE_BGP_ADDR, "BGP own address" },
{ 0 , NULL},
{ MTYPE_BGP_REDIST, "BGP redistribution" },
{ MTYPE_BGP_FILTER_NAME, "BGP Filter Information" },
{ MTYPE_BGP_DUMP_STR, "BGP Dump String Information" },
{ MTYPE_ENCAP_TLV, "ENCAP TLV", },
{ -1, NULL }
};
struct memory_list memory_list_rip[] =
{
{ MTYPE_RIP, "RIP structure" },
{ MTYPE_RIP_INFO, "RIP route info" },
{ MTYPE_RIP_INTERFACE, "RIP interface" },
{ MTYPE_RIP_PEER, "RIP peer" },
{ MTYPE_RIP_OFFSET_LIST, "RIP offset list" },
{ MTYPE_RIP_DISTANCE, "RIP distance" },
{ -1, NULL }
};
struct memory_list memory_list_ripng[] =
{
{ MTYPE_RIPNG, "RIPng structure" },
{ MTYPE_RIPNG_ROUTE, "RIPng route info" },
{ MTYPE_RIPNG_AGGREGATE, "RIPng aggregate" },
{ MTYPE_RIPNG_PEER, "RIPng peer" },
{ MTYPE_RIPNG_OFFSET_LIST, "RIPng offset lst" },
{ MTYPE_RIPNG_RTE_DATA, "RIPng rte data" },
{ -1, NULL }
};
struct memory_list memory_list_ospf[] =
{
{ MTYPE_OSPF_TOP, "OSPF top" },
{ MTYPE_OSPF_AREA, "OSPF area" },
{ MTYPE_OSPF_AREA_RANGE, "OSPF area range" },
{ MTYPE_OSPF_NETWORK, "OSPF network" },
{ MTYPE_OSPF_NEIGHBOR_STATIC,"OSPF static nbr" },
{ MTYPE_OSPF_IF, "OSPF interface" },
{ MTYPE_OSPF_NEIGHBOR, "OSPF neighbor" },
{ MTYPE_OSPF_ROUTE, "OSPF route" },
{ MTYPE_OSPF_TMP, "OSPF tmp mem" },
{ MTYPE_OSPF_LSA, "OSPF LSA" },
{ MTYPE_OSPF_LSA_DATA, "OSPF LSA data" },
{ MTYPE_OSPF_LSDB, "OSPF LSDB" },
{ MTYPE_OSPF_PACKET, "OSPF packet" },
{ MTYPE_OSPF_FIFO, "OSPF FIFO queue" },
{ MTYPE_OSPF_VERTEX, "OSPF vertex" },
{ MTYPE_OSPF_VERTEX_PARENT, "OSPF vertex parent", },
{ MTYPE_OSPF_NEXTHOP, "OSPF nexthop" },
{ MTYPE_OSPF_PATH, "OSPF path" },
{ MTYPE_OSPF_VL_DATA, "OSPF VL data" },
{ MTYPE_OSPF_CRYPT_KEY, "OSPF crypt key" },
{ MTYPE_OSPF_EXTERNAL_INFO, "OSPF ext. info" },
{ MTYPE_OSPF_DISTANCE, "OSPF distance" },
{ MTYPE_OSPF_IF_INFO, "OSPF if info" },
{ MTYPE_OSPF_IF_PARAMS, "OSPF if params" },
{ MTYPE_OSPF_MESSAGE, "OSPF message" },
{ MTYPE_OSPF_MPLS_TE, "OSPF MPLS parameters" },
{ MTYPE_OSPF_PCE_PARAMS, "OSPF PCE parameters" },
{ -1, NULL },
};
struct memory_list memory_list_ospf6[] =
{
{ MTYPE_OSPF6_TOP, "OSPF6 top" },
{ MTYPE_OSPF6_AREA, "OSPF6 area" },
{ MTYPE_OSPF6_IF, "OSPF6 interface" },
{ MTYPE_OSPF6_NEIGHBOR, "OSPF6 neighbor" },
{ MTYPE_OSPF6_ROUTE, "OSPF6 route" },
{ MTYPE_OSPF6_PREFIX, "OSPF6 prefix" },
{ MTYPE_OSPF6_MESSAGE, "OSPF6 message" },
{ MTYPE_OSPF6_LSA, "OSPF6 LSA" },
{ MTYPE_OSPF6_LSA_SUMMARY, "OSPF6 LSA summary" },
{ MTYPE_OSPF6_LSDB, "OSPF6 LSA database" },
{ MTYPE_OSPF6_VERTEX, "OSPF6 vertex" },
{ MTYPE_OSPF6_SPFTREE, "OSPF6 SPF tree" },
{ MTYPE_OSPF6_NEXTHOP, "OSPF6 nexthop" },
{ MTYPE_OSPF6_EXTERNAL_INFO,"OSPF6 ext. info" },
{ MTYPE_OSPF6_OTHER, "OSPF6 other" },
{ -1, NULL },
};
struct memory_list memory_list_isis[] =
{
{ MTYPE_ISIS, "ISIS" },
{ MTYPE_ISIS_TMP, "ISIS TMP" },
{ MTYPE_ISIS_CIRCUIT, "ISIS circuit" },
{ MTYPE_ISIS_LSP, "ISIS LSP" },
{ MTYPE_ISIS_ADJACENCY, "ISIS adjacency" },
{ MTYPE_ISIS_AREA, "ISIS area" },
{ MTYPE_ISIS_AREA_ADDR, "ISIS area address" },
{ MTYPE_ISIS_TLV, "ISIS TLV" },
{ MTYPE_ISIS_DYNHN, "ISIS dyn hostname" },
{ MTYPE_ISIS_SPFTREE, "ISIS SPFtree" },
{ MTYPE_ISIS_VERTEX, "ISIS vertex" },
{ MTYPE_ISIS_ROUTE_INFO, "ISIS route info" },
{ MTYPE_ISIS_NEXTHOP, "ISIS nexthop" },
{ MTYPE_ISIS_NEXTHOP6, "ISIS nexthop6" },
{ MTYPE_ISIS_DICT, "ISIS dictionary" },
{ MTYPE_ISIS_DICT_NODE, "ISIS dictionary node" },
{ MTYPE_ISIS_MPLS_TE, "ISIS MPLS_TE parameters" },
{ -1, NULL },
};
struct memory_list memory_list_pim[] =
{
{ MTYPE_PIM_CHANNEL_OIL, "PIM SSM (S,G) channel OIL" },
{ MTYPE_PIM_INTERFACE, "PIM interface" },
{ MTYPE_PIM_IGMP_JOIN, "PIM interface IGMP static join" },
{ MTYPE_PIM_IGMP_SOCKET, "PIM interface IGMP socket" },
{ MTYPE_PIM_IGMP_GROUP, "PIM interface IGMP group" },
{ MTYPE_PIM_IGMP_GROUP_SOURCE, "PIM interface IGMP source" },
{ MTYPE_PIM_NEIGHBOR, "PIM interface neighbor" },
{ MTYPE_PIM_IFCHANNEL, "PIM interface (S,G) state" },
{ MTYPE_PIM_UPSTREAM, "PIM upstream (S,G) state" },
{ MTYPE_PIM_SSMPINGD, "PIM sspimgd socket" },
{ MTYPE_PIM_STATIC_ROUTE, "PIM Static Route" },
{ MTYPE_PIM_BR, "PIM Bridge Router info" },
{ -1, NULL },
};
struct memory_list memory_list_vtysh[] =
{
{ MTYPE_VTYSH_CONFIG, "Vtysh configuration", },
{ MTYPE_VTYSH_CONFIG_LINE, "Vtysh configuration line" },
{ -1, NULL },
};
struct mlist mlists[] __attribute__ ((unused)) = {
{ memory_list_lib, "LIB" },
{ memory_list_zebra, "ZEBRA" },
{ memory_list_rip, "RIP" },
{ memory_list_ripng, "RIPNG" },
{ memory_list_ospf, "OSPF" },
{ memory_list_ospf6, "OSPF6" },
{ memory_list_isis, "ISIS" },
{ memory_list_bgp, "BGP" },
{ memory_list_pim, "PIM" },
{ NULL, NULL},
};

View File

@ -33,6 +33,8 @@
#include "prefix.h" #include "prefix.h"
#include "nexthop.h" #include "nexthop.h"
DEFINE_MTYPE_STATIC(LIB, NEXTHOP, "Nexthop")
/* check if nexthops are same, non-recursive */ /* check if nexthops are same, non-recursive */
int int
nexthop_same_no_recurse (struct nexthop *next1, struct nexthop *next2) nexthop_same_no_recurse (struct nexthop *next1, struct nexthop *next2)

View File

@ -39,6 +39,9 @@
#include "command.h" #include "command.h"
#include "vty.h" #include "vty.h"
DEFINE_MTYPE_STATIC(LIB, NS, "Logical-Router")
DEFINE_MTYPE_STATIC(LIB, NS_NAME, "Logical-Router Name")
DEFINE_MTYPE_STATIC(LIB, NS_BITMAP, "Logical-Router bit-map")
#ifndef CLONE_NEWNET #ifndef CLONE_NEWNET
#define CLONE_NEWNET 0x40000000 /* New network namespace (lo, device, names sockets, etc) */ #define CLONE_NEWNET 0x40000000 /* New network namespace (lo, device, names sockets, etc) */

View File

@ -34,6 +34,11 @@
#include "plist_int.h" #include "plist_int.h"
DEFINE_MTYPE_STATIC(LIB, PREFIX_LIST, "Prefix List")
DEFINE_MTYPE_STATIC(LIB, MPREFIX_LIST_STR, "Prefix List Str")
DEFINE_MTYPE_STATIC(LIB, PREFIX_LIST_ENTRY, "Prefix List Entry")
DEFINE_MTYPE_STATIC(LIB, PREFIX_LIST_TRIE, "Prefix List Trie Table")
/* not currently changeable, code assumes bytes further down */ /* not currently changeable, code assumes bytes further down */
#define PLC_BITS 8 #define PLC_BITS 8
#define PLC_LEN (1 << PLC_BITS) #define PLC_LEN (1 << PLC_BITS)
@ -236,7 +241,7 @@ prefix_list_insert (afi_t afi, int orf, const char *name)
/* Allocate new prefix_list and copy given name. */ /* Allocate new prefix_list and copy given name. */
plist = prefix_list_new (); plist = prefix_list_new ();
plist->name = XSTRDUP (MTYPE_PREFIX_LIST_STR, name); plist->name = XSTRDUP (MTYPE_MPREFIX_LIST_STR, name);
plist->master = master; plist->master = master;
plist->trie = XCALLOC (MTYPE_PREFIX_LIST_TRIE, sizeof (struct pltrie_table)); plist->trie = XCALLOC (MTYPE_PREFIX_LIST_TRIE, sizeof (struct pltrie_table));
@ -370,7 +375,7 @@ prefix_list_delete (struct prefix_list *plist)
(*master->delete_hook) (plist); (*master->delete_hook) (plist);
if (plist->name) if (plist->name)
XFREE (MTYPE_PREFIX_LIST_STR, plist->name); XFREE (MTYPE_MPREFIX_LIST_STR, plist->name);
XFREE (MTYPE_PREFIX_LIST_TRIE, plist->trie); XFREE (MTYPE_PREFIX_LIST_TRIE, plist->trie);

View File

@ -23,6 +23,9 @@ Boston, MA 02111-1307, USA. */
#include "memory.h" #include "memory.h"
#include "pqueue.h" #include "pqueue.h"
DEFINE_MTYPE_STATIC(LIB, PQUEUE, "Priority queue")
DEFINE_MTYPE_STATIC(LIB, PQUEUE_DATA, "Priority queue data")
/* priority queue using heap sort */ /* priority queue using heap sort */
/* pqueue->cmp() controls the order of sorting (i.e, ascending or /* pqueue->cmp() controls the order of sorting (i.e, ascending or

View File

@ -28,6 +28,8 @@
#include "memory.h" #include "memory.h"
#include "log.h" #include "log.h"
DEFINE_MTYPE_STATIC(LIB, PREFIX, "Prefix")
/* Maskbit. */ /* Maskbit. */
static const u_char maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0, static const u_char maskbit[] = {0x00, 0x80, 0xc0, 0xe0, 0xf0,
0xf8, 0xfc, 0xfe, 0xff}; 0xf8, 0xfc, 0xfe, 0xff};

View File

@ -27,6 +27,9 @@
#include "memory.h" #include "memory.h"
#ifdef HAVE_CAPABILITIES #ifdef HAVE_CAPABILITIES
DEFINE_MTYPE_STATIC(LIB, PRIVS, "Privilege information")
/* sort out some generic internal types for: /* sort out some generic internal types for:
* *
* privilege values (cap_value_t, priv_t) -> pvalue_t * privilege values (cap_value_t, priv_t) -> pvalue_t

View File

@ -30,6 +30,14 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "log.h" #include "log.h"
#include "hash.h" #include "hash.h"
DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP, "Route map")
DEFINE_MTYPE( LIB, ROUTE_MAP_NAME, "Route map name")
DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_INDEX, "Route map index")
DEFINE_MTYPE( LIB, ROUTE_MAP_RULE, "Route map rule")
DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_RULE_STR, "Route map rule str")
DEFINE_MTYPE( LIB, ROUTE_MAP_COMPILED, "Route map compiled")
DEFINE_MTYPE_STATIC(LIB, ROUTE_MAP_DEP, "Route map dependency")
/* Vector for route match rules. */ /* Vector for route match rules. */
static vector route_match_vec; static vector route_match_vec;

View File

@ -23,6 +23,10 @@
#define _ZEBRA_ROUTEMAP_H #define _ZEBRA_ROUTEMAP_H
#include "prefix.h" #include "prefix.h"
#include "memory.h"
DECLARE_MTYPE(ROUTE_MAP_NAME)
DECLARE_MTYPE(ROUTE_MAP_RULE)
DECLARE_MTYPE(ROUTE_MAP_COMPILED)
/* Route map's type. */ /* Route map's type. */
enum route_map_type enum route_map_type

View File

@ -29,6 +29,8 @@
#include "log.h" #include "log.h"
#include "jhash.h" #include "jhash.h"
DEFINE_MTYPE_STATIC(LIB, SOCKUNION, "Socket union")
#ifndef HAVE_INET_ATON #ifndef HAVE_INET_ATON
int int
inet_aton (const char *cp, struct in_addr *inaddr) inet_aton (const char *cp, struct in_addr *inaddr)

View File

@ -29,6 +29,10 @@
#include "prefix.h" #include "prefix.h"
#include "log.h" #include "log.h"
DEFINE_MTYPE_STATIC(LIB, STREAM, "Stream")
DEFINE_MTYPE_STATIC(LIB, STREAM_DATA, "Stream data")
DEFINE_MTYPE_STATIC(LIB, STREAM_FIFO, "Stream FIFO")
/* Tests whether a position is valid */ /* Tests whether a position is valid */
#define GETP_VALID(S,G) \ #define GETP_VALID(S,G) \
((G) <= (S)->endp) ((G) <= (S)->endp)

View File

@ -27,6 +27,9 @@
#include "memory.h" #include "memory.h"
#include "sockunion.h" #include "sockunion.h"
DEFINE_MTYPE( LIB, ROUTE_TABLE, "Route table")
DEFINE_MTYPE_STATIC(LIB, ROUTE_NODE, "Route node")
static void route_node_delete (struct route_node *); static void route_node_delete (struct route_node *);
static void route_table_free (struct route_table *); static void route_table_free (struct route_table *);

View File

@ -23,6 +23,9 @@
#ifndef _ZEBRA_TABLE_H #ifndef _ZEBRA_TABLE_H
#define _ZEBRA_TABLE_H #define _ZEBRA_TABLE_H
#include "memory.h"
DECLARE_MTYPE(ROUTE_TABLE)
/* /*
* Forward declarations. * Forward declarations.
*/ */

View File

@ -32,6 +32,10 @@
#include "command.h" #include "command.h"
#include "sigevent.h" #include "sigevent.h"
DEFINE_MTYPE_STATIC(LIB, THREAD, "Thread")
DEFINE_MTYPE_STATIC(LIB, THREAD_MASTER, "Thread master")
DEFINE_MTYPE_STATIC(LIB, THREAD_STATS, "Thread stats")
#if defined(__APPLE__) #if defined(__APPLE__)
#include <mach/mach.h> #include <mach/mach.h>
#include <mach/mach_time.h> #include <mach/mach_time.h>
@ -287,13 +291,13 @@ cpu_record_print(struct vty *vty, thread_type filter)
vty_out_cpu_thread_history(vty, &tmp); vty_out_cpu_thread_history(vty, &tmp);
} }
DEFUN(show_thread_cpu, DEFUN (show_thread_cpu,
show_thread_cpu_cmd, show_thread_cpu_cmd,
"show thread cpu [FILTER]", "show thread cpu [FILTER]",
SHOW_STR SHOW_STR
"Thread information\n" "Thread information\n"
"Thread CPU usage\n" "Thread CPU usage\n"
"Display filter (rwtexb)\n") "Display filter (rwtexb)\n")
{ {
int i = 0; int i = 0;
thread_type filter = (thread_type) -1U; thread_type filter = (thread_type) -1U;
@ -369,13 +373,13 @@ cpu_record_clear (thread_type filter)
tmp); tmp);
} }
DEFUN(clear_thread_cpu, DEFUN (clear_thread_cpu,
clear_thread_cpu_cmd, clear_thread_cpu_cmd,
"clear thread cpu [FILTER]", "clear thread cpu [FILTER]",
"Clear stored data\n" "Clear stored data\n"
"Thread information\n" "Thread information\n"
"Thread CPU usage\n" "Thread CPU usage\n"
"Display filter (rwtexb)\n") "Display filter (rwtexb)\n")
{ {
int i = 0; int i = 0;
thread_type filter = (thread_type) -1U; thread_type filter = (thread_type) -1U;

View File

@ -24,6 +24,9 @@
#include "vector.h" #include "vector.h"
#include "memory.h" #include "memory.h"
DEFINE_MTYPE_STATIC(LIB, VECTOR, "Vector")
DEFINE_MTYPE( LIB, VECTOR_INDEX, "Vector index")
/* Initialize vector : allocate memory and return vector. */ /* Initialize vector : allocate memory and return vector. */
vector vector
vector_init (unsigned int size) vector_init (unsigned int size)

View File

@ -23,6 +23,9 @@
#ifndef _ZEBRA_VECTOR_H #ifndef _ZEBRA_VECTOR_H
#define _ZEBRA_VECTOR_H #define _ZEBRA_VECTOR_H
#include "memory.h"
DECLARE_MTYPE(VECTOR_INDEX)
/* struct for vector */ /* struct for vector */
struct _vector struct _vector
{ {

View File

@ -30,6 +30,9 @@
#include "memory.h" #include "memory.h"
#include "command.h" #include "command.h"
DEFINE_MTYPE_STATIC(LIB, VRF, "VRF")
DEFINE_MTYPE_STATIC(LIB, VRF_BITMAP, "VRF bit-map")
/* /*
* Turn on/off debug code * Turn on/off debug code
* for vrf. * for vrf.

View File

@ -40,6 +40,10 @@
#include <arpa/telnet.h> #include <arpa/telnet.h>
#include <termios.h> #include <termios.h>
DEFINE_MTYPE_STATIC(LIB, VTY, "VTY")
DEFINE_MTYPE_STATIC(LIB, VTY_OUT_BUF, "VTY output buffer")
DEFINE_MTYPE_STATIC(LIB, VTY_HIST, "VTY history")
/* Vty events */ /* Vty events */
enum event enum event
{ {

View File

@ -29,6 +29,10 @@
#include "command.h" #include "command.h"
#include "log.h" #include "log.h"
DEFINE_MTYPE(LIB, WORK_QUEUE, "Work queue")
DEFINE_MTYPE_STATIC(LIB, WORK_QUEUE_ITEM, "Work queue item")
DEFINE_MTYPE_STATIC(LIB, WORK_QUEUE_NAME, "Work queue name string")
/* master list of work_queues */ /* master list of work_queues */
static struct list _work_queues; static struct list _work_queues;
/* pointer primarily to avoid an otherwise harmless warning on /* pointer primarily to avoid an otherwise harmless warning on
@ -178,11 +182,11 @@ work_queue_item_requeue (struct work_queue *wq, struct listnode *ln)
LISTNODE_ATTACH (wq->items, ln); /* attach to end of list */ LISTNODE_ATTACH (wq->items, ln); /* attach to end of list */
} }
DEFUN(show_work_queues, DEFUN (show_work_queues,
show_work_queues_cmd, show_work_queues_cmd,
"show work-queues", "show work-queues",
SHOW_STR SHOW_STR
"Work Queue information\n") "Work Queue information\n")
{ {
struct listnode *node; struct listnode *node;
struct work_queue *wq; struct work_queue *wq;

View File

@ -24,6 +24,9 @@
#ifndef _QUAGGA_WORK_QUEUE_H #ifndef _QUAGGA_WORK_QUEUE_H
#define _QUAGGA_WORK_QUEUE_H #define _QUAGGA_WORK_QUEUE_H
#include "memory.h"
DECLARE_MTYPE(WORK_QUEUE)
/* Hold time for the initial schedule of a queue run, in millisec */ /* Hold time for the initial schedule of a queue run, in millisec */
#define WORK_QUEUE_DEFAULT_HOLD 50 #define WORK_QUEUE_DEFAULT_HOLD 50

View File

@ -34,6 +34,8 @@
#include "table.h" #include "table.h"
#include "nexthop.h" #include "nexthop.h"
DEFINE_MTYPE_STATIC(LIB, ZCLIENT, "Zclient")
/* Zebra client events. */ /* Zebra client events. */
enum event {ZCLIENT_SCHEDULE, ZCLIENT_READ, ZCLIENT_CONNECT}; enum event {ZCLIENT_SCHEDULE, ZCLIENT_READ, ZCLIENT_CONNECT};

View File

@ -317,26 +317,6 @@ struct in_pktinfo
}; };
#endif #endif
/*
* OSPF Fragmentation / fragmented writes
*
* ospfd can support writing fragmented packets, for cases where
* kernel will not fragment IP_HDRINCL and/or multicast destined
* packets (ie TTBOMK all kernels, BSD, SunOS, Linux). However,
* SunOS, probably BSD too, clobber the user supplied IP ID and IP
* flags fields, hence user-space fragmentation will not work.
* Only Linux is known to leave IP header unmolested.
* Further, fragmentation really should be done the kernel, which already
* supports it, and which avoids nasty IP ID state problems.
*
* Fragmentation of OSPF packets can be required on networks with router
* with many many interfaces active in one area, or on networks with links
* with low MTUs.
*/
#ifdef GNU_LINUX
#define WANT_OSPF_WRITE_FRAGMENT
#endif
/* /*
* IP_HDRINCL / struct ip byte order * IP_HDRINCL / struct ip byte order
* *
@ -396,57 +376,53 @@ struct in_pktinfo
#define ZEBRA_PORT 2600 #define ZEBRA_PORT 2600
/* Zebra message types. */ /* Zebra message types. */
#define ZEBRA_INTERFACE_ADD 1 typedef enum {
#define ZEBRA_INTERFACE_DELETE 2 ZEBRA_INTERFACE_ADD,
#define ZEBRA_INTERFACE_ADDRESS_ADD 3 ZEBRA_INTERFACE_DELETE,
#define ZEBRA_INTERFACE_ADDRESS_DELETE 4 ZEBRA_INTERFACE_ADDRESS_ADD,
#define ZEBRA_INTERFACE_UP 5 ZEBRA_INTERFACE_ADDRESS_DELETE,
#define ZEBRA_INTERFACE_DOWN 6 ZEBRA_INTERFACE_UP,
#define ZEBRA_IPV4_ROUTE_ADD 7 ZEBRA_INTERFACE_DOWN,
#define ZEBRA_IPV4_ROUTE_DELETE 8 ZEBRA_IPV4_ROUTE_ADD,
#define ZEBRA_IPV6_ROUTE_ADD 9 ZEBRA_IPV4_ROUTE_DELETE,
#define ZEBRA_IPV6_ROUTE_DELETE 10 ZEBRA_IPV6_ROUTE_ADD,
#define ZEBRA_REDISTRIBUTE_ADD 11 ZEBRA_IPV6_ROUTE_DELETE,
#define ZEBRA_REDISTRIBUTE_DELETE 12 ZEBRA_REDISTRIBUTE_ADD,
#define ZEBRA_REDISTRIBUTE_DEFAULT_ADD 13 ZEBRA_REDISTRIBUTE_DELETE,
#define ZEBRA_REDISTRIBUTE_DEFAULT_DELETE 14 ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
#define ZEBRA_IPV4_NEXTHOP_LOOKUP 15 ZEBRA_REDISTRIBUTE_DEFAULT_DELETE,
#define ZEBRA_IPV6_NEXTHOP_LOOKUP 16 ZEBRA_ROUTER_ID_ADD,
#define ZEBRA_IPV4_IMPORT_LOOKUP 17 ZEBRA_ROUTER_ID_DELETE,
#define ZEBRA_IPV6_IMPORT_LOOKUP 18 ZEBRA_ROUTER_ID_UPDATE,
#define ZEBRA_INTERFACE_RENAME 19 ZEBRA_HELLO,
#define ZEBRA_ROUTER_ID_ADD 20 ZEBRA_NEXTHOP_REGISTER,
#define ZEBRA_ROUTER_ID_DELETE 21 ZEBRA_NEXTHOP_UNREGISTER,
#define ZEBRA_ROUTER_ID_UPDATE 22 ZEBRA_NEXTHOP_UPDATE,
#define ZEBRA_HELLO 23 ZEBRA_INTERFACE_NBR_ADDRESS_ADD,
#define ZEBRA_NEXTHOP_REGISTER 24 ZEBRA_INTERFACE_NBR_ADDRESS_DELETE,
#define ZEBRA_NEXTHOP_UNREGISTER 25 ZEBRA_INTERFACE_BFD_DEST_UPDATE,
#define ZEBRA_NEXTHOP_UPDATE 26 ZEBRA_IMPORT_ROUTE_REGISTER,
#define ZEBRA_INTERFACE_NBR_ADDRESS_ADD 27 ZEBRA_IMPORT_ROUTE_UNREGISTER,
#define ZEBRA_INTERFACE_NBR_ADDRESS_DELETE 28 ZEBRA_IMPORT_CHECK_UPDATE,
#define ZEBRA_INTERFACE_BFD_DEST_UPDATE 29 ZEBRA_IPV4_ROUTE_IPV6_NEXTHOP_ADD,
#define ZEBRA_IMPORT_ROUTE_REGISTER 30 ZEBRA_BFD_DEST_REGISTER,
#define ZEBRA_IMPORT_ROUTE_UNREGISTER 31 ZEBRA_BFD_DEST_DEREGISTER,
#define ZEBRA_IMPORT_CHECK_UPDATE 32 ZEBRA_BFD_DEST_UPDATE,
#define ZEBRA_IPV4_ROUTE_IPV6_NEXTHOP_ADD 33 ZEBRA_BFD_DEST_REPLAY,
#define ZEBRA_BFD_DEST_REGISTER 34 ZEBRA_REDISTRIBUTE_IPV4_ADD,
#define ZEBRA_BFD_DEST_DEREGISTER 35 ZEBRA_REDISTRIBUTE_IPV4_DEL,
#define ZEBRA_BFD_DEST_UPDATE 36 ZEBRA_REDISTRIBUTE_IPV6_ADD,
#define ZEBRA_BFD_DEST_REPLAY 37 ZEBRA_REDISTRIBUTE_IPV6_DEL,
#define ZEBRA_REDISTRIBUTE_IPV4_ADD 38 ZEBRA_VRF_UNREGISTER,
#define ZEBRA_REDISTRIBUTE_IPV4_DEL 39 ZEBRA_VRF_ADD,
#define ZEBRA_REDISTRIBUTE_IPV6_ADD 40 ZEBRA_VRF_DELETE,
#define ZEBRA_REDISTRIBUTE_IPV6_DEL 41 ZEBRA_INTERFACE_VRF_UPDATE,
#define ZEBRA_VRF_UNREGISTER 42 ZEBRA_BFD_CLIENT_REGISTER,
#define ZEBRA_VRF_ADD 43 ZEBRA_INTERFACE_ENABLE_RADV,
#define ZEBRA_VRF_DELETE 44 ZEBRA_INTERFACE_DISABLE_RADV,
#define ZEBRA_INTERFACE_VRF_UPDATE 45 ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB,
#define ZEBRA_BFD_CLIENT_REGISTER 46 ZEBRA_INTERFACE_LINK_PARAMS,
#define ZEBRA_INTERFACE_ENABLE_RADV 47 } zebra_message_types_t;
#define ZEBRA_INTERFACE_DISABLE_RADV 48
#define ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB 49
#define ZEBRA_INTERFACE_LINK_PARAMS 50
#define ZEBRA_MESSAGE_MAX 51
/* Marker value used in new Zserv, in the byte location corresponding /* Marker value used in new Zserv, in the byte location corresponding
* the command value in the old zserv header. To allow old and new * the command value in the old zserv header. To allow old and new
@ -542,43 +518,4 @@ typedef u_int16_t zebra_command_t;
/* VRF ID type. */ /* VRF ID type. */
typedef u_int16_t vrf_id_t; typedef u_int16_t vrf_id_t;
/* FIFO -- first in first out structure and macros. */
struct fifo
{
struct fifo *next;
struct fifo *prev;
};
#define FIFO_INIT(F) \
do { \
struct fifo *Xfifo = (struct fifo *)(F); \
Xfifo->next = Xfifo->prev = Xfifo; \
} while (0)
#define FIFO_ADD(F,N) \
do { \
struct fifo *Xfifo = (struct fifo *)(F); \
struct fifo *Xnode = (struct fifo *)(N); \
Xnode->next = Xfifo; \
Xnode->prev = Xfifo->prev; \
Xfifo->prev = Xfifo->prev->next = Xnode; \
} while (0)
#define FIFO_DEL(N) \
do { \
struct fifo *Xnode = (struct fifo *)(N); \
Xnode->prev->next = Xnode->next; \
Xnode->next->prev = Xnode->prev; \
} while (0)
#define FIFO_HEAD(F) \
((((struct fifo *)(F))->next == (struct fifo *)(F)) \
? NULL : (F)->next)
#define FIFO_EMPTY(F) \
(((struct fifo *)(F))->next == (struct fifo *)(F))
#define FIFO_TOP(F) \
(FIFO_EMPTY(F) ? NULL : ((struct fifo *)(F))->next)
#endif /* _ZEBRA_H */ #endif /* _ZEBRA_H */

View File

@ -10,6 +10,7 @@ noinst_LIBRARIES = libospf6.a
sbin_PROGRAMS = ospf6d sbin_PROGRAMS = ospf6d
libospf6_a_SOURCES = \ libospf6_a_SOURCES = \
ospf6_memory.c \
ospf6_network.c ospf6_message.c ospf6_lsa.c ospf6_lsdb.c \ ospf6_network.c ospf6_message.c ospf6_lsa.c ospf6_lsdb.c \
ospf6_top.c ospf6_area.c ospf6_interface.c ospf6_neighbor.c \ ospf6_top.c ospf6_area.c ospf6_interface.c ospf6_neighbor.c \
ospf6_flood.c ospf6_route.c ospf6_intra.c ospf6_zebra.c \ ospf6_flood.c ospf6_route.c ospf6_intra.c ospf6_zebra.c \
@ -17,6 +18,7 @@ libospf6_a_SOURCES = \
ospf6d.c ospf6_bfd.c ospf6d.c ospf6_bfd.c
noinst_HEADERS = \ noinst_HEADERS = \
ospf6_memory.h \
ospf6_network.h ospf6_message.h ospf6_lsa.h ospf6_lsdb.h \ ospf6_network.h ospf6_message.h ospf6_lsa.h ospf6_lsdb.h \
ospf6_top.h ospf6_area.h ospf6_interface.h ospf6_neighbor.h \ ospf6_top.h ospf6_area.h ospf6_interface.h ospf6_neighbor.h \
ospf6_flood.h ospf6_route.h ospf6_intra.h ospf6_zebra.h \ ospf6_flood.h ospf6_route.h ospf6_intra.h ospf6_zebra.h \

View File

@ -45,6 +45,8 @@
#include "ospf6d.h" #include "ospf6d.h"
#include "ospf6_bfd.h" #include "ospf6_bfd.h"
DEFINE_MTYPE_STATIC(OSPF6D, CFG_PLIST_NAME, "configured prefix list names")
unsigned char conf_debug_ospf6_interface = 0; unsigned char conf_debug_ospf6_interface = 0;
const char *ospf6_interface_state_str[] = const char *ospf6_interface_state_str[] =
@ -262,7 +264,7 @@ ospf6_interface_delete (struct ospf6_interface *oi)
/* plist_name */ /* plist_name */
if (oi->plist_name) if (oi->plist_name)
XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name); XFREE (MTYPE_CFG_PLIST_NAME, oi->plist_name);
ospf6_bfd_info_free(&(oi->bfd_info)); ospf6_bfd_info_free(&(oi->bfd_info));
@ -1668,8 +1670,8 @@ DEFUN (ipv6_ospf6_advertise_prefix_list,
assert (oi); assert (oi);
if (oi->plist_name) if (oi->plist_name)
XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name); XFREE (MTYPE_CFG_PLIST_NAME, oi->plist_name);
oi->plist_name = XSTRDUP (MTYPE_PREFIX_LIST_STR, argv[0]); oi->plist_name = XSTRDUP (MTYPE_CFG_PLIST_NAME, argv[0]);
ospf6_interface_connected_route_update (oi->interface); ospf6_interface_connected_route_update (oi->interface);
@ -1710,7 +1712,7 @@ DEFUN (no_ipv6_ospf6_advertise_prefix_list,
if (oi->plist_name) if (oi->plist_name)
{ {
XFREE (MTYPE_PREFIX_LIST_STR, oi->plist_name); XFREE (MTYPE_CFG_PLIST_NAME, oi->plist_name);
oi->plist_name = NULL; oi->plist_name = NULL;
} }

View File

@ -29,6 +29,7 @@
#include "command.h" #include "command.h"
#include "vty.h" #include "vty.h"
#include "memory.h" #include "memory.h"
#include "memory_vty.h"
#include "if.h" #include "if.h"
#include "filter.h" #include "filter.h"
#include "prefix.h" #include "prefix.h"

44
ospf6d/ospf6_memory.c Normal file
View File

@ -0,0 +1,44 @@
/* ospf6d memory type definitions
*
* Copyright (C) 2015 David Lamparter
*
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* Quagga is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Quagga; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "ospf6_memory.h"
DEFINE_MGROUP(OSPF6D, "ospf6d")
DEFINE_MTYPE(OSPF6D, OSPF6_TOP, "OSPF6 top")
DEFINE_MTYPE(OSPF6D, OSPF6_AREA, "OSPF6 area")
DEFINE_MTYPE(OSPF6D, OSPF6_IF, "OSPF6 interface")
DEFINE_MTYPE(OSPF6D, OSPF6_NEIGHBOR, "OSPF6 neighbor")
DEFINE_MTYPE(OSPF6D, OSPF6_ROUTE, "OSPF6 route")
DEFINE_MTYPE(OSPF6D, OSPF6_PREFIX, "OSPF6 prefix")
DEFINE_MTYPE(OSPF6D, OSPF6_MESSAGE, "OSPF6 message")
DEFINE_MTYPE(OSPF6D, OSPF6_LSA, "OSPF6 LSA")
DEFINE_MTYPE(OSPF6D, OSPF6_LSA_SUMMARY, "OSPF6 LSA summary")
DEFINE_MTYPE(OSPF6D, OSPF6_LSDB, "OSPF6 LSA database")
DEFINE_MTYPE(OSPF6D, OSPF6_VERTEX, "OSPF6 vertex")
DEFINE_MTYPE(OSPF6D, OSPF6_SPFTREE, "OSPF6 SPF tree")
DEFINE_MTYPE(OSPF6D, OSPF6_NEXTHOP, "OSPF6 nexthop")
DEFINE_MTYPE(OSPF6D, OSPF6_EXTERNAL_INFO,"OSPF6 ext. info")
DEFINE_MTYPE(OSPF6D, OSPF6_OTHER, "OSPF6 other")

45
ospf6d/ospf6_memory.h Normal file
View File

@ -0,0 +1,45 @@
/* ospf6d memory type declarations
*
* Copyright (C) 2015 David Lamparter
*
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* Quagga is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Quagga; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef _QUAGGA_OSPF6_MEMORY_H
#define _QUAGGA_OSPF6_MEMORY_H
#include "memory.h"
DECLARE_MGROUP(OSPF6D)
DECLARE_MTYPE(OSPF6_TOP)
DECLARE_MTYPE(OSPF6_AREA)
DECLARE_MTYPE(OSPF6_IF)
DECLARE_MTYPE(OSPF6_NEIGHBOR)
DECLARE_MTYPE(OSPF6_ROUTE)
DECLARE_MTYPE(OSPF6_PREFIX)
DECLARE_MTYPE(OSPF6_MESSAGE)
DECLARE_MTYPE(OSPF6_LSA)
DECLARE_MTYPE(OSPF6_LSA_SUMMARY)
DECLARE_MTYPE(OSPF6_LSDB)
DECLARE_MTYPE(OSPF6_VERTEX)
DECLARE_MTYPE(OSPF6_SPFTREE)
DECLARE_MTYPE(OSPF6_NEXTHOP)
DECLARE_MTYPE(OSPF6_EXTERNAL_INFO)
DECLARE_MTYPE(OSPF6_OTHER)
#endif /* _QUAGGA_OSPF6_MEMORY_H */

View File

@ -27,6 +27,8 @@
#include "libospf.h" #include "libospf.h"
#include "thread.h" #include "thread.h"
#include "ospf6_memory.h"
/* global variables */ /* global variables */
extern struct thread_master *master; extern struct thread_master *master;

View File

@ -49,6 +49,8 @@
#include "ospf_apiclient.h" #include "ospf_apiclient.h"
DEFINE_MTYPE_STATIC(OSPFD, OSPF_APICLIENT, "OSPF-API client")
/* Backlog for listen */ /* Backlog for listen */
#define BACKLOG 5 #define BACKLOG 5

View File

@ -23,8 +23,6 @@
#ifndef _OSPF_APICLIENT_H #ifndef _OSPF_APICLIENT_H
#define _OSPF_APICLIENT_H #define _OSPF_APICLIENT_H
#define MTYPE_OSPF_APICLIENT MTYPE_TMP
/* Structure for the OSPF API client */ /* Structure for the OSPF API client */
struct ospf_apiclient struct ospf_apiclient
{ {

View File

@ -17,7 +17,7 @@ libospf_la_SOURCES = \
ospf_spf.c ospf_route.c ospf_ase.c ospf_abr.c ospf_ia.c ospf_flood.c \ ospf_spf.c ospf_route.c ospf_ase.c ospf_abr.c ospf_ia.c ospf_flood.c \
ospf_lsdb.c ospf_asbr.c ospf_routemap.c ospf_snmp.c \ ospf_lsdb.c ospf_asbr.c ospf_routemap.c ospf_snmp.c \
ospf_opaque.c ospf_te.c ospf_ri.c ospf_vty.c ospf_api.c ospf_apiserver.c \ ospf_opaque.c ospf_te.c ospf_ri.c ospf_vty.c ospf_api.c ospf_apiserver.c \
ospf_bfd.c ospf_bfd.c ospf_memory.c
ospfdheaderdir = $(pkgincludedir)/ospfd ospfdheaderdir = $(pkgincludedir)/ospfd
@ -29,7 +29,7 @@ noinst_HEADERS = \
ospf_interface.h ospf_neighbor.h ospf_network.h ospf_packet.h \ ospf_interface.h ospf_neighbor.h ospf_network.h ospf_packet.h \
ospf_zebra.h ospf_spf.h ospf_route.h ospf_ase.h ospf_abr.h ospf_ia.h \ ospf_zebra.h ospf_spf.h ospf_route.h ospf_ase.h ospf_abr.h ospf_ia.h \
ospf_flood.h ospf_snmp.h ospf_te.h ospf_ri.h ospf_vty.h ospf_apiserver.h \ ospf_flood.h ospf_snmp.h ospf_te.h ospf_ri.h ospf_vty.h ospf_apiserver.h \
ospf_bfd.h ospf_bfd.h ospf_memory.h
ospfd_SOURCES = ospf_main.c ospfd_SOURCES = ospf_main.c

View File

@ -36,6 +36,7 @@
#include "stream.h" #include "stream.h"
#include "log.h" #include "log.h"
#include "memory.h" #include "memory.h"
#include "memory_vty.h"
#include "privs.h" #include "privs.h"
#include "sigevent.h" #include "sigevent.h"
#include "zclient.h" #include "zclient.h"

56
ospfd/ospf_memory.c Normal file
View File

@ -0,0 +1,56 @@
/* ospfd memory type definitions
*
* Copyright (C) 2015 David Lamparter
*
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* Quagga is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Quagga; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "ospf_memory.h"
DEFINE_MGROUP(OSPFD, "ospfd")
DEFINE_MTYPE(OSPFD, OSPF_TOP, "OSPF top")
DEFINE_MTYPE(OSPFD, OSPF_AREA, "OSPF area")
DEFINE_MTYPE(OSPFD, OSPF_AREA_RANGE, "OSPF area range")
DEFINE_MTYPE(OSPFD, OSPF_NETWORK, "OSPF network")
DEFINE_MTYPE(OSPFD, OSPF_NEIGHBOR_STATIC, "OSPF static nbr")
DEFINE_MTYPE(OSPFD, OSPF_IF, "OSPF interface")
DEFINE_MTYPE(OSPFD, OSPF_NEIGHBOR, "OSPF neighbor")
DEFINE_MTYPE(OSPFD, OSPF_ROUTE, "OSPF route")
DEFINE_MTYPE(OSPFD, OSPF_TMP, "OSPF tmp mem")
DEFINE_MTYPE(OSPFD, OSPF_LSA, "OSPF LSA")
DEFINE_MTYPE(OSPFD, OSPF_LSA_DATA, "OSPF LSA data")
DEFINE_MTYPE(OSPFD, OSPF_LSDB, "OSPF LSDB")
DEFINE_MTYPE(OSPFD, OSPF_PACKET, "OSPF packet")
DEFINE_MTYPE(OSPFD, OSPF_FIFO, "OSPF FIFO queue")
DEFINE_MTYPE(OSPFD, OSPF_VERTEX, "OSPF vertex")
DEFINE_MTYPE(OSPFD, OSPF_VERTEX_PARENT, "OSPF vertex parent")
DEFINE_MTYPE(OSPFD, OSPF_NEXTHOP, "OSPF nexthop")
DEFINE_MTYPE(OSPFD, OSPF_PATH, "OSPF path")
DEFINE_MTYPE(OSPFD, OSPF_VL_DATA, "OSPF VL data")
DEFINE_MTYPE(OSPFD, OSPF_CRYPT_KEY, "OSPF crypt key")
DEFINE_MTYPE(OSPFD, OSPF_EXTERNAL_INFO, "OSPF ext. info")
DEFINE_MTYPE(OSPFD, OSPF_DISTANCE, "OSPF distance")
DEFINE_MTYPE(OSPFD, OSPF_IF_INFO, "OSPF if info")
DEFINE_MTYPE(OSPFD, OSPF_IF_PARAMS, "OSPF if params")
DEFINE_MTYPE(OSPFD, OSPF_MESSAGE, "OSPF message")
DEFINE_MTYPE(OSPFD, OSPF_MPLS_TE, "OSPF MPLS parameters")
DEFINE_MTYPE(OSPFD, OSPF_PCE_PARAMS, "OSPF PCE parameters")

57
ospfd/ospf_memory.h Normal file
View File

@ -0,0 +1,57 @@
/* ospfd memory type declarations
*
* Copyright (C) 2015 David Lamparter
*
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* Quagga is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Quagga; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef _QUAGGA_OSPF_MEMORY_H
#define _QUAGGA_OSPF_MEMORY_H
#include "memory.h"
DECLARE_MGROUP(OSPFD)
DECLARE_MTYPE(OSPF_TOP)
DECLARE_MTYPE(OSPF_AREA)
DECLARE_MTYPE(OSPF_AREA_RANGE)
DECLARE_MTYPE(OSPF_NETWORK)
DECLARE_MTYPE(OSPF_NEIGHBOR_STATIC)
DECLARE_MTYPE(OSPF_IF)
DECLARE_MTYPE(OSPF_NEIGHBOR)
DECLARE_MTYPE(OSPF_ROUTE)
DECLARE_MTYPE(OSPF_TMP)
DECLARE_MTYPE(OSPF_LSA)
DECLARE_MTYPE(OSPF_LSA_DATA)
DECLARE_MTYPE(OSPF_LSDB)
DECLARE_MTYPE(OSPF_PACKET)
DECLARE_MTYPE(OSPF_FIFO)
DECLARE_MTYPE(OSPF_VERTEX)
DECLARE_MTYPE(OSPF_VERTEX_PARENT)
DECLARE_MTYPE(OSPF_NEXTHOP)
DECLARE_MTYPE(OSPF_PATH)
DECLARE_MTYPE(OSPF_VL_DATA)
DECLARE_MTYPE(OSPF_CRYPT_KEY)
DECLARE_MTYPE(OSPF_EXTERNAL_INFO)
DECLARE_MTYPE(OSPF_DISTANCE)
DECLARE_MTYPE(OSPF_IF_INFO)
DECLARE_MTYPE(OSPF_IF_PARAMS)
DECLARE_MTYPE(OSPF_MESSAGE)
DECLARE_MTYPE(OSPF_MPLS_TE)
DECLARE_MTYPE(OSPF_PCE_PARAMS)
#endif /* _QUAGGA_OSPF_MEMORY_H */

View File

@ -21,11 +21,6 @@
* 02111-1307, USA. * 02111-1307, USA.
*/ */
/***** MTYPE definitions are not reflected to "memory.h" yet. *****/
#define MTYPE_OSPF_OPAQUE_FUNCTAB MTYPE_TMP
#define MTYPE_OPAQUE_INFO_PER_TYPE MTYPE_TMP
#define MTYPE_OPAQUE_INFO_PER_ID MTYPE_TMP
#include <zebra.h> #include <zebra.h>
#include "linklist.h" #include "linklist.h"
@ -57,6 +52,10 @@
#include "ospfd/ospf_ase.h" #include "ospfd/ospf_ase.h"
#include "ospfd/ospf_zebra.h" #include "ospfd/ospf_zebra.h"
DEFINE_MTYPE_STATIC(OSPFD, OSPF_OPAQUE_FUNCTAB, "OSPF opaque function table")
DEFINE_MTYPE_STATIC(OSPFD, OPAQUE_INFO_PER_TYPE, "OSPF opaque per-type info")
DEFINE_MTYPE_STATIC(OSPFD, OPAQUE_INFO_PER_ID, "OSPF opaque per-ID info")
/*------------------------------------------------------------------------* /*------------------------------------------------------------------------*
* Followings are initialize/terminate functions for Opaque-LSAs handling. * Followings are initialize/terminate functions for Opaque-LSAs handling.
*------------------------------------------------------------------------*/ *------------------------------------------------------------------------*/

View File

@ -49,6 +49,26 @@
#include "ospfd/ospf_flood.h" #include "ospfd/ospf_flood.h"
#include "ospfd/ospf_dump.h" #include "ospfd/ospf_dump.h"
/*
* OSPF Fragmentation / fragmented writes
*
* ospfd can support writing fragmented packets, for cases where
* kernel will not fragment IP_HDRINCL and/or multicast destined
* packets (ie TTBOMK all kernels, BSD, SunOS, Linux). However,
* SunOS, probably BSD too, clobber the user supplied IP ID and IP
* flags fields, hence user-space fragmentation will not work.
* Only Linux is known to leave IP header unmolested.
* Further, fragmentation really should be done the kernel, which already
* supports it, and which avoids nasty IP ID state problems.
*
* Fragmentation of OSPF packets can be required on networks with router
* with many many interfaces active in one area, or on networks with links
* with low MTUs.
*/
#ifdef GNU_LINUX
#define WANT_OSPF_WRITE_FRAGMENT
#endif
/* Packet Type String. */ /* Packet Type String. */
const struct message ospf_packet_type_str[] = const struct message ospf_packet_type_str[] =
{ {

View File

@ -713,12 +713,14 @@ update_linkparams(struct mpls_te_link *lp)
/* Get the Interface structure */ /* Get the Interface structure */
if ((ifp = lp->ifp) == NULL) if ((ifp = lp->ifp) == NULL)
{ {
zlog_warn("OSPF MPLS-TE: Abort update TE parameters: no interface associated to Link Parameters"); if (IS_DEBUG_OSPF_TE)
zlog_debug("OSPF MPLS-TE: Abort update TE parameters: no interface associated to Link Parameters");
return; return;
} }
if (!HAS_LINK_PARAMS(ifp)) if (!HAS_LINK_PARAMS(ifp))
{ {
zlog_warn("OSPF MPLS-TE: Abort update TE parameters: no Link Parameters for interface"); if (IS_DEBUG_OSPF_TE)
zlog_debug("OSPF MPLS-TE: Abort update TE parameters: no Link Parameters for interface");
return; return;
} }
@ -1179,7 +1181,7 @@ build_link_tlv (struct stream *s, struct mpls_te_link *lp)
build_link_subtlv (s, &lp->pkt_loss.header); build_link_subtlv (s, &lp->pkt_loss.header);
build_link_subtlv (s, &lp->res_bw.header); build_link_subtlv (s, &lp->res_bw.header);
build_link_subtlv (s, &lp->ava_bw.header); build_link_subtlv (s, &lp->ava_bw.header);
build_link_subtlv (s, &lp->res_bw.header); build_link_subtlv (s, &lp->use_bw.header);
return; return;
} }

View File

@ -29,6 +29,8 @@
#include "filter.h" #include "filter.h"
#include "log.h" #include "log.h"
#include "ospf_memory.h"
#define OSPF_VERSION 2 #define OSPF_VERSION 2
/* VTY port number. */ /* VTY port number. */

View File

@ -46,6 +46,7 @@ sbin_PROGRAMS = pimd
noinst_PROGRAMS = test_igmpv3_join noinst_PROGRAMS = test_igmpv3_join
libpim_a_SOURCES = \ libpim_a_SOURCES = \
pim_memory.c \
pimd.c pim_version.c pim_cmd.c pim_signals.c pim_iface.c \ pimd.c pim_version.c pim_cmd.c pim_signals.c pim_iface.c \
pim_vty.c pim_igmp.c pim_sock.c pim_zebra.c \ pim_vty.c pim_igmp.c pim_sock.c pim_zebra.c \
pim_igmpv3.c pim_str.c pim_mroute.c pim_util.c pim_time.c \ pim_igmpv3.c pim_str.c pim_mroute.c pim_util.c pim_time.c \
@ -56,6 +57,7 @@ libpim_a_SOURCES = \
pim_static.c pim_br.c pim_register.c pim_routemap.c pim_static.c pim_br.c pim_register.c pim_routemap.c
noinst_HEADERS = \ noinst_HEADERS = \
pim_memory.h \
pimd.h pim_version.h pim_cmd.h pim_signals.h pim_iface.h \ pimd.h pim_version.h pim_cmd.h pim_signals.h pim_iface.h \
pim_vty.h pim_igmp.h pim_sock.h pim_zebra.h \ pim_vty.h pim_igmp.h pim_sock.h pim_zebra.h \
pim_igmpv3.h pim_str.h pim_mroute.h pim_util.h pim_time.h \ pim_igmpv3.h pim_str.h pim_mroute.h pim_util.h pim_time.h \

View File

@ -31,6 +31,8 @@
#include <signal.h> #include <signal.h>
#include "memory.h" #include "memory.h"
#include "vrf.h"
#include "memory_vty.h"
#include "filter.h" #include "filter.h"
#include "vty.h" #include "vty.h"
#include "sigevent.h" #include "sigevent.h"

41
pimd/pim_memory.c Normal file
View File

@ -0,0 +1,41 @@
/* pimd memory type definitions
*
* Copyright (C) 2015 David Lamparter
*
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* Quagga is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Quagga; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pim_memory.h"
DEFINE_MGROUP(PIMD, "pimd")
DEFINE_MTYPE(PIMD, PIM_CHANNEL_OIL, "PIM SSM (S,G) channel OIL")
DEFINE_MTYPE(PIMD, PIM_INTERFACE, "PIM interface")
DEFINE_MTYPE(PIMD, PIM_IGMP_JOIN, "PIM interface IGMP static join")
DEFINE_MTYPE(PIMD, PIM_IGMP_SOCKET, "PIM interface IGMP socket")
DEFINE_MTYPE(PIMD, PIM_IGMP_GROUP, "PIM interface IGMP group")
DEFINE_MTYPE(PIMD, PIM_IGMP_GROUP_SOURCE, "PIM interface IGMP source")
DEFINE_MTYPE(PIMD, PIM_NEIGHBOR, "PIM interface neighbor")
DEFINE_MTYPE(PIMD, PIM_IFCHANNEL, "PIM interface (S,G) state")
DEFINE_MTYPE(PIMD, PIM_UPSTREAM, "PIM upstream (S,G) state")
DEFINE_MTYPE(PIMD, PIM_SSMPINGD, "PIM sspimgd socket")
DEFINE_MTYPE(PIMD, PIM_STATIC_ROUTE, "PIM Static Route")
DEFINE_MTYPE(PIMD, PIM_BR, "PIM Bridge Router info")

42
pimd/pim_memory.h Normal file
View File

@ -0,0 +1,42 @@
/* pimd memory type declarations
*
* Copyright (C) 2015 David Lamparter
*
* This file is part of Quagga.
*
* Quagga is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* Quagga is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Quagga; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef _QUAGGA_PIM_MEMORY_H
#define _QUAGGA_PIM_MEMORY_H
#include "memory.h"
DECLARE_MGROUP(PIMD)
DECLARE_MTYPE(PIM_CHANNEL_OIL)
DECLARE_MTYPE(PIM_INTERFACE)
DECLARE_MTYPE(PIM_IGMP_JOIN)
DECLARE_MTYPE(PIM_IGMP_SOCKET)
DECLARE_MTYPE(PIM_IGMP_GROUP)
DECLARE_MTYPE(PIM_IGMP_GROUP_SOURCE)
DECLARE_MTYPE(PIM_NEIGHBOR)
DECLARE_MTYPE(PIM_IFCHANNEL)
DECLARE_MTYPE(PIM_UPSTREAM)
DECLARE_MTYPE(PIM_SSMPINGD)
DECLARE_MTYPE(PIM_STATIC_ROUTE)
DECLARE_MTYPE(PIM_BR)
#endif /* _QUAGGA_PIM_MEMORY_H */

Some files were not shown because too many files have changed in this diff Show More