* Babel
* PBR
* OpenFabric
+* VRRP
* EIGRP (alpha)
* NHRP (alpha)
#include "neighbour.h"
#include "route.h"
#include "xroute.h"
-#include "babel_memory.h"
#include "babel_errors.h"
+DEFINE_MTYPE_STATIC(BABELD, BABEL_IF, "Babel Interface")
+
#define IS_ENABLE(ifp) (babel_enable_if_lookup(ifp->name) >= 0)
static int babel_enable_if_lookup (const char *ifname);
+++ /dev/null
-/* babeld memory type definitions
- *
- * Copyright (C) 2017 Donald Sharp
- *
- * This file is part of FRR
- *
- * FRR 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.
- *
- * FRR 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 FRR; 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 "babel_memory.h"
-
-DEFINE_MGROUP(BABELD, "babeld")
-DEFINE_MTYPE(BABELD, BABEL, "Babel Structure")
-DEFINE_MTYPE(BABELD, BABEL_IF, "Babel Interface")
+++ /dev/null
-/* babel memory type declarations
- *
- * Copyright (C) 2017 Donald Sharp
- *
- * This file is part of FRR.
- *
- * FRR 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.
- *
- * FRR 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 FRR; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _FRR_BABEL_MEMORY_H
-#define _FRR_BABEL_MEMORY_H
-
-#include "memory.h"
-
-DECLARE_MGROUP(BABELD)
-DECLARE_MTYPE(BABEL)
-DECLARE_MTYPE(BABEL_IF)
-
-#endif /* _FRR_BABELD_MEMORY_H */
#include "resend.h"
#include "babel_filter.h"
#include "babel_zebra.h"
-#include "babel_memory.h"
#include "babel_errors.h"
+DEFINE_MGROUP(BABELD, "babeld")
+DEFINE_MTYPE_STATIC(BABELD, BABEL, "Babel Structure")
+
static int babel_init_routing_process(struct thread *thread);
static void babel_get_myid(void);
static void babel_initial_noise(void);
babeld/babel_errors.c \
babeld/babel_filter.c \
babeld/babel_interface.c \
- babeld/babel_memory.c \
babeld/babel_zebra.c \
babeld/babeld.c \
babeld/kernel.c \
babeld/babel_filter.h \
babeld/babel_interface.h \
babeld/babel_main.h \
- babeld/babel_memory.h \
babeld/babel_zebra.h \
babeld/babeld.h \
babeld/kernel.h \
#include "babeld.h"
#include "babel_main.h"
#include "log.h"
+#include "memory.h"
+
+DECLARE_MGROUP(BABELD)
#if defined(i386) || defined(__mc68020__) || defined(__x86_64__)
#define DO_NTOHS(_d, _s) do{ _d = ntohs(*(const unsigned short*)(_s)); }while(0)
#include "bfd.h"
-DEFINE_QOBJ_TYPE(bfd_session);
+DEFINE_MTYPE_STATIC(BFDD, BFDD_CONFIG, "long-lived configuration memory")
+DEFINE_MTYPE_STATIC(BFDD, BFDD_SESSION_OBSERVER, "Session observer")
+DEFINE_MTYPE_STATIC(BFDD, BFDD_VRF, "BFD VRF")
+DEFINE_QOBJ_TYPE(bfd_session)
/*
* Prototypes
} else
bvrf = vrf->info;
log_debug("VRF enable add %s id %u", vrf->name, vrf->vrf_id);
-
- /* create sockets if needed */
- if (!bvrf->bg_shop)
- bvrf->bg_shop = bp_udp_shop(vrf->vrf_id);
- if (!bvrf->bg_mhop)
- bvrf->bg_mhop = bp_udp_mhop(vrf->vrf_id);
- if (!bvrf->bg_shop6)
- bvrf->bg_shop6 = bp_udp6_shop(vrf->vrf_id);
- if (!bvrf->bg_mhop6)
- bvrf->bg_mhop6 = bp_udp6_mhop(vrf->vrf_id);
- if (!bvrf->bg_echo)
- bvrf->bg_echo = bp_echo_socket(vrf->vrf_id);
- if (!bvrf->bg_echov6)
- bvrf->bg_echov6 = bp_echov6_socket(vrf->vrf_id);
-
- /* Add descriptors to the event loop. */
- if (!bvrf->bg_ev[0])
- thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop,
- &bvrf->bg_ev[0]);
- if (!bvrf->bg_ev[1])
- thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop,
- &bvrf->bg_ev[1]);
- if (!bvrf->bg_ev[2])
- thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop6,
- &bvrf->bg_ev[2]);
- if (!bvrf->bg_ev[3])
- thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop6,
- &bvrf->bg_ev[3]);
- if (!bvrf->bg_ev[4])
- thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echo,
- &bvrf->bg_ev[4]);
- if (!bvrf->bg_ev[5])
- thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echov6,
- &bvrf->bg_ev[5]);
-
+ if (vrf->vrf_id == VRF_DEFAULT ||
+ vrf_get_backend() == VRF_BACKEND_NETNS) {
+ if (!bvrf->bg_shop)
+ bvrf->bg_shop = bp_udp_shop(vrf->vrf_id);
+ if (!bvrf->bg_mhop)
+ bvrf->bg_mhop = bp_udp_mhop(vrf->vrf_id);
+ if (!bvrf->bg_shop6)
+ bvrf->bg_shop6 = bp_udp6_shop(vrf->vrf_id);
+ if (!bvrf->bg_mhop6)
+ bvrf->bg_mhop6 = bp_udp6_mhop(vrf->vrf_id);
+ if (!bvrf->bg_echo)
+ bvrf->bg_echo = bp_echo_socket(vrf->vrf_id);
+ if (!bvrf->bg_echov6)
+ bvrf->bg_echov6 = bp_echov6_socket(vrf->vrf_id);
+
+ /* Add descriptors to the event loop. */
+ if (!bvrf->bg_ev[0])
+ thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop,
+ &bvrf->bg_ev[0]);
+ if (!bvrf->bg_ev[1])
+ thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop,
+ &bvrf->bg_ev[1]);
+ if (!bvrf->bg_ev[2])
+ thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_shop6,
+ &bvrf->bg_ev[2]);
+ if (!bvrf->bg_ev[3])
+ thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_mhop6,
+ &bvrf->bg_ev[3]);
+ if (!bvrf->bg_ev[4])
+ thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echo,
+ &bvrf->bg_ev[4]);
+ if (!bvrf->bg_ev[5])
+ thread_add_read(master, bfd_recv_cb, bvrf, bvrf->bg_echov6,
+ &bvrf->bg_ev[5]);
+ }
if (vrf->vrf_id != VRF_DEFAULT) {
bfdd_zclient_register(vrf->vrf_id);
bfdd_sessions_enable_vrf(vrf);
#define BFDD_JSON_CONV_OPTIONS (0)
#endif
-DECLARE_MGROUP(BFDD);
-DECLARE_MTYPE(BFDD_TMP);
-DECLARE_MTYPE(BFDD_CONFIG);
-DECLARE_MTYPE(BFDD_LABEL);
-DECLARE_MTYPE(BFDD_CONTROL);
-DECLARE_MTYPE(BFDD_SESSION_OBSERVER);
-DECLARE_MTYPE(BFDD_NOTIFICATION);
-DECLARE_MTYPE(BFDD_VRF);
+DECLARE_MGROUP(BFDD)
+DECLARE_MTYPE(BFDD_CONTROL)
+DECLARE_MTYPE(BFDD_NOTIFICATION)
struct bfd_timers {
uint32_t desired_min_tx;
uint64_t refcount; /* number of pointers referencing this. */
/* VTY context data. */
- QOBJ_FIELDS;
+ QOBJ_FIELDS
};
-DECLARE_QOBJ_TYPE(bfd_session);
+DECLARE_QOBJ_TYPE(bfd_session)
struct peer_label {
TAILQ_ENTRY(peer_label) pl_entry;
/*
* FRR related code.
*/
-DEFINE_MGROUP(BFDD, "Bidirectional Forwarding Detection Daemon");
-DEFINE_MTYPE(BFDD, BFDD_TMP, "short-lived temporary memory");
-DEFINE_MTYPE(BFDD, BFDD_CONFIG, "long-lived configuration memory");
-DEFINE_MTYPE(BFDD, BFDD_LABEL, "long-lived label memory");
-DEFINE_MTYPE(BFDD, BFDD_CONTROL, "long-lived control socket memory");
-DEFINE_MTYPE(BFDD, BFDD_SESSION_OBSERVER, "Session observer");
-DEFINE_MTYPE(BFDD, BFDD_NOTIFICATION, "short-lived control notification data");
-DEFINE_MTYPE(BFDD, BFDD_VRF, "BFD VRF");
+DEFINE_MGROUP(BFDD, "Bidirectional Forwarding Detection Daemon")
+DEFINE_MTYPE(BFDD, BFDD_CONTROL, "long-lived control socket memory")
+DEFINE_MTYPE(BFDD, BFDD_NOTIFICATION, "short-lived control notification data")
/* Master of threads. */
struct thread_master *master;
#include "bfd.h"
+DEFINE_MTYPE_STATIC(BFDD, BFDD_LABEL, "long-lived label memory")
+
/*
* Definitions
*/
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "bgp_addpath.h"
#include "bgp_route.h"
return 0;
}
+
+/* Perform exact matching. In case of expanded large-community-list, do
+ * same thing as lcommunity_list_match().
+ */
+int lcommunity_list_exact_match(struct lcommunity *lcom,
+ struct community_list *list)
+{
+ struct community_entry *entry;
+
+ for (entry = list->head; entry; entry = entry->next) {
+ if (entry->any)
+ return entry->direct == COMMUNITY_PERMIT ? 1 : 0;
+
+ if (entry->style == LARGE_COMMUNITY_LIST_STANDARD) {
+ if (lcommunity_cmp(lcom, entry->u.com))
+ return entry->direct == COMMUNITY_PERMIT ? 1
+ : 0;
+ } else if (entry->style == LARGE_COMMUNITY_LIST_EXPANDED) {
+ if (lcommunity_regexp_match(lcom, entry->reg))
+ return entry->direct == COMMUNITY_PERMIT ? 1
+ : 0;
+ }
+ }
+ return 0;
+}
+
int ecommunity_list_match(struct ecommunity *ecom, struct community_list *list)
{
struct community_entry *entry;
extern int lcommunity_list_match(struct lcommunity *, struct community_list *);
extern int community_list_exact_match(struct community *,
struct community_list *);
+extern int lcommunity_list_exact_match(struct lcommunity *lcom,
+ struct community_list *list);
extern struct community *community_list_match_delete(struct community *,
struct community_list *);
extern struct lcommunity *
.description = "BGP attempted to create an EVPN ES entry and failed",
.suggestion = "Most likely a bug. If the problem persists, report the problem for troubleshooting"
},
- {
- .code = EC_BGP_MULTI_INSTANCE,
- .title = "BGP config multi-instance issue",
- .description = "BGP configuration attempting multiple instances without enabling the feature",
- .suggestion = "Correct the configuration so that bgp multiple-instance is enabled if desired"
- },
{
.code = EC_BGP_EVPN_AS_MISMATCH,
.title = "BGP AS configuration issue",
EC_BGP_EVPN_ROUTE_INVALID,
EC_BGP_EVPN_ROUTE_CREATE,
EC_BGP_ES_CREATE,
- EC_BGP_MULTI_INSTANCE,
EC_BGP_EVPN_AS_MISMATCH,
EC_BGP_EVPN_INSTANCE_MISMATCH,
EC_BGP_FLOWSPEC_PACKET,
vrf_id == VRF_DEFAULT ? BGP_INSTANCE_TYPE_DEFAULT
: BGP_INSTANCE_TYPE_VRF);
switch (ret) {
- case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
- flog_err(EC_BGP_MULTI_INSTANCE,
- "'bgp multiple-instance' not present\n");
- return -1;
case BGP_ERR_AS_MISMATCH:
flog_err(EC_BGP_EVPN_AS_MISMATCH,
"BGP is already running; AS is %u\n", as);
json_object_int_add(json_prefix_info,
"prefixLen", rm->p.prefixlen);
+
+ if (rd_header)
+ json_nroute = json_object_new_object();
}
for (pi = bgp_node_get_bgp_path_info(rm); pi;
else if (type == RD_TYPE_IP)
decode_rd_ip(pnt + 2, &rd_ip);
if (use_json) {
- json_nroute =
- json_object_new_object();
if (type == RD_TYPE_AS
|| type == RD_TYPE_AS4)
sprintf(rd_str, "%u:%d",
SAFI_EVPN, json_array);
output_count++;
}
+ rd_header = 0;
if (use_json) {
json_object_object_add(json_prefix_info,
"paths", json_array);
#include "bgpd/bgp_memory.h"
#include "bgpd/bgp_route.h"
#include "bgpd/bgp_packet.h"
+#include "bgpd/bgp_rd.h"
#include "bgpd/bgp_debug.h"
#include "bgpd/bgp_evpn_private.h"
}
static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer,
- struct bgp_table *table)
+ struct bgp_table *table,
+ struct ethaddr *macaddr)
{
struct bgp_node *prn, *rn;
struct bgp_path_info *pi;
- uint32_t count = 0;
for (prn = bgp_table_top(table); prn; prn = bgp_route_next(prn)) {
struct bgp_table *sub = prn->info;
continue;
for (rn = bgp_table_top(sub); rn; rn = bgp_route_next(rn)) {
+ bool rn_affected;
+ struct prefix_evpn *pevpn = (struct prefix_evpn *)&rn->p;
struct prefix_rd prd;
uint32_t num_labels = 0;
mpls_label_t *label_pnt = NULL;
struct bgp_route_evpn evpn;
- count++;
+ if (pevpn->family == AF_EVPN &&
+ pevpn->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE &&
+ memcmp(&rn->p.u.prefix_evpn.macip_addr.mac,
+ macaddr, ETH_ALEN) == 0)
+ rn_affected = true;
+ else
+ rn_affected = false;
+
for (pi = rn->info; pi; pi = pi->next) {
if (pi->peer == peer)
break;
if (!pi)
continue;
+ /*
+ * If the mac address is not the same then
+ * we don't care and since we are looking
+ */
+ if ((memcmp(&pi->attr->rmac, macaddr, ETH_ALEN) != 0) &&
+ !rn_affected)
+ continue;
+
if (pi->extra)
num_labels = pi->extra->num_labels;
if (num_labels)
prd.prefixlen = 64;
memcpy(&prd.val, &prn->p.u.val, 8);
+ if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
+ if (bgp_debug_update(peer, &rn->p, NULL, 1)) {
+ char pfx_buf[BGP_PRD_PATH_STRLEN];
+
+ bgp_debug_rdpfxpath2str(
+ AFI_L2VPN, SAFI_EVPN, &prd,
+ &rn->p, label_pnt, num_labels,
+ pi->addpath_rx_id ? 1 : 0,
+ pi->addpath_rx_id, pfx_buf,
+ sizeof(pfx_buf));
+ zlog_debug(
+ "%s skip update of %s marked as removed",
+ peer->host, pfx_buf);
+ }
+ continue;
+ }
+
memcpy(&evpn, &pi->attr->evpn_overlay, sizeof(evpn));
int32_t ret = bgp_update(peer, &rn->p,
pi->addpath_rx_id,
}
}
-static void bgp_mac_rescan_evpn_table(struct bgp *bgp)
+static void bgp_mac_rescan_evpn_table(struct bgp *bgp, struct ethaddr *macaddr)
{
struct listnode *node;
struct peer *peer;
if (bgp_debug_update(peer, NULL, NULL, 1))
zlog_debug("Processing EVPN MAC interface change on peer %s",
peer->host);
- bgp_process_mac_rescan_table(bgp, peer, table);
+ bgp_process_mac_rescan_table(bgp, peer, table, macaddr);
}
}
}
-static void bgp_mac_rescan_all_evpn_tables(void)
+static void bgp_mac_rescan_all_evpn_tables(struct ethaddr *macaddr)
{
struct listnode *node;
struct bgp *bgp;
struct bgp_table *table = bgp->rib[AFI_L2VPN][SAFI_EVPN];
if (table)
- bgp_mac_rescan_evpn_table(bgp);
+ bgp_mac_rescan_evpn_table(bgp, macaddr);
}
}
-static void bgp_mac_remove_ifp_internal(struct bgp_self_mac *bsm, char *ifname)
+static void bgp_mac_remove_ifp_internal(struct bgp_self_mac *bsm, char *ifname,
+ struct ethaddr *macaddr)
{
struct listnode *node = NULL;
char *name;
list_delete(&bsm->ifp_list);
XFREE(MTYPE_BSM, bsm);
- bgp_mac_rescan_all_evpn_tables();
+ bgp_mac_rescan_all_evpn_tables(macaddr);
}
}
listnode_add(bsm->ifp_list, ifname);
if (old_bsm)
- bgp_mac_remove_ifp_internal(old_bsm, ifname);
+ bgp_mac_remove_ifp_internal(old_bsm, ifname,
+ &old_bsm->macaddr);
} else {
/*
* If old mac address is the same as the new,
* then there is nothing to do here
*/
- if (old_bsm == bsm)
+ if (old_bsm == bsm) {
+ XFREE(MTYPE_BSM_STRING, ifname);
return;
+ }
if (old_bsm)
- bgp_mac_remove_ifp_internal(old_bsm, ifp->name);
+ bgp_mac_remove_ifp_internal(old_bsm, ifp->name,
+ &old_bsm->macaddr);
listnode_add(bsm->ifp_list, ifname);
}
- bgp_mac_rescan_all_evpn_tables();
+ bgp_mac_rescan_all_evpn_tables(&bsm->macaddr);
}
void bgp_mac_del_mac_entry(struct interface *ifp)
* Write code to allow old mac address to no-longer
* win if we happen to have received it from a peer.
*/
- bgp_mac_remove_ifp_internal(bsm, ifp->name);
+ bgp_mac_remove_ifp_internal(bsm, ifp->name, &bsm->macaddr);
}
/* This API checks MAC address against any of local
uint16_t holdtime;
uint16_t send_holdtime;
as_t remote_as;
- as_t as4 = 0;
+ as_t as4 = 0, as4_be;
struct in_addr remote_id;
int mp_capability;
uint8_t notify_data_remote_as[2];
* that we do not know which peer is connecting to us now.
*/
as4 = peek_for_as4_capability(peer, optlen);
- memcpy(notify_data_remote_as4, &as4, 4);
}
+ as4_be = htonl(as4);
+ memcpy(notify_data_remote_as4, &as4_be, 4);
+
/* Just in case we have a silly peer who sends AS4 capability set to 0
*/
if (CHECK_FLAG(peer->cap, PEER_CAP_AS4_RCV) && !as4) {
#include <zebra.h>
#include <math.h>
+#include "printfrr.h"
#include "prefix.h"
#include "linklist.h"
#include "memory.h"
DEFUN (ipv6_aggregate_address,
ipv6_aggregate_address_cmd,
- "aggregate-address X:X::X:X/M [summary-only]",
+ "aggregate-address X:X::X:X/M [<as-set [summary-only]|summary-only [as-set]>]",
"Configure BGP aggregate entries\n"
"Aggregate prefix\n"
- "Filter more specific routes from updates\n")
+ "Generate AS set path information\n"
+ "Filter more specific routes from updates\n"
+ "Filter more specific routes from updates\n"
+ "Generate AS set path information\n")
{
int idx = 0;
argv_find(argv, argc, "X:X::X:X/M", &idx);
char *prefix = argv[idx]->arg;
+ int as_set =
+ argv_find(argv, argc, "as-set", &idx) ? AGGREGATE_AS_SET : 0;
+
+ idx = 0;
int sum_only = argv_find(argv, argc, "summary-only", &idx)
? AGGREGATE_SUMMARY_ONLY
: 0;
return bgp_aggregate_set(vty, prefix, AFI_IP6, SAFI_UNICAST, sum_only,
- 0);
+ as_set);
}
DEFUN (no_ipv6_aggregate_address,
no_ipv6_aggregate_address_cmd,
- "no aggregate-address X:X::X:X/M [summary-only]",
+ "no aggregate-address X:X::X:X/M [<as-set [summary-only]|summary-only [as-set]>]",
NO_STR
"Configure BGP aggregate entries\n"
"Aggregate prefix\n"
- "Filter more specific routes from updates\n")
+ "Generate AS set path information\n"
+ "Filter more specific routes from updates\n"
+ "Filter more specific routes from updates\n"
+ "Generate AS set path information\n")
{
int idx = 0;
argv_find(argv, argc, "X:X::X:X/M", &idx);
json_object_object_add(json_net, "appliedStatusSymbols",
json_status);
char buf_cut[BUFSIZ];
- json_object_object_add(
- json_ar,
- inet_ntop(p->family, &p->u.prefix, buf_cut, BUFSIZ),
- json_net);
+
+ prefix2str(p, buf_cut, PREFIX_STRLEN);
+ json_object_object_add(json_ar, buf_cut, json_net);
} else
vty_out(vty, "\n");
}
&& BGP_ATTR_NEXTHOP_AFI_IP6(attr))
|| (BGP_ATTR_NEXTHOP_AFI_IP6(attr))) {
char buf_a[512];
- char buf_b[512];
- char buf_c[BUFSIZ];
if (attr->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL) {
if (json)
buf_a, sizeof(buf_a)));
} else if (attr->mp_nexthop_len
== BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
- if (json) {
- inet_ntop(AF_INET6,
- &attr->mp_nexthop_global,
- buf_a, sizeof(buf_a));
- inet_ntop(AF_INET6,
- &attr->mp_nexthop_local,
- buf_b, sizeof(buf_b));
- sprintf(buf_c, "%s(%s)", buf_a, buf_b);
+ snprintfrr(buf_a, sizeof(buf_a), "%pI6(%pI6)",
+ &attr->mp_nexthop_global,
+ &attr->mp_nexthop_local);
+ if (json)
json_object_string_add(
json_out,
- "mpNexthopGlobalLocal", buf_c);
- } else
- vty_out(vty, "%s(%s)",
- inet_ntop(
- AF_INET6,
- &attr->mp_nexthop_global,
- buf_a, sizeof(buf_a)),
- inet_ntop(
- AF_INET6,
- &attr->mp_nexthop_local,
- buf_b, sizeof(buf_b)));
+ "mpNexthopGlobalLocal", buf_a);
+ else
+ vty_out(vty, "%s", buf_a);
}
}
}
lcom))
continue;
}
+
+ if (type == bgp_show_type_lcommunity_exact) {
+ struct lcommunity *lcom = output_arg;
+
+ if (!pi->attr->lcommunity
+ || !lcommunity_cmp(pi->attr->lcommunity,
+ lcom))
+ continue;
+ }
if (type == bgp_show_type_lcommunity_list) {
struct community_list *list = output_arg;
list))
continue;
}
+ if (type
+ == bgp_show_type_lcommunity_list_exact) {
+ struct community_list *list = output_arg;
+
+ if (!lcommunity_list_exact_match(
+ pi->attr->lcommunity, list))
+ continue;
+ }
if (type == bgp_show_type_lcommunity_all) {
if (!pi->attr->lcommunity)
continue;
}
static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc,
- struct cmd_token **argv, afi_t afi, safi_t safi,
- bool uj)
+ struct cmd_token **argv, bool exact, afi_t afi,
+ safi_t safi, bool uj)
{
struct lcommunity *lcom;
struct buffer *b;
return CMD_WARNING;
}
- return bgp_show(vty, bgp, afi, safi, bgp_show_type_lcommunity, lcom,
- uj);
+ return bgp_show(vty, bgp, afi, safi,
+ (exact ? bgp_show_type_lcommunity_exact
+ : bgp_show_type_lcommunity),
+ lcom, uj);
}
static int bgp_show_lcommunity_list(struct vty *vty, struct bgp *bgp,
- const char *lcom, afi_t afi, safi_t safi,
- bool uj)
+ const char *lcom, bool exact, afi_t afi,
+ safi_t safi, bool uj)
{
struct community_list *list;
return CMD_WARNING;
}
- return bgp_show(vty, bgp, afi, safi, bgp_show_type_lcommunity_list,
+ return bgp_show(vty, bgp, afi, safi,
+ (exact ? bgp_show_type_lcommunity_list_exact
+ : bgp_show_type_lcommunity_list),
list, uj);
}
DEFUN (show_ip_bgp_large_community_list,
show_ip_bgp_large_community_list_cmd,
- "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] large-community-list <(1-500)|WORD> [json]",
+ "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] large-community-list <(1-500)|WORD> [exact-match] [json]",
SHOW_STR
IP_STR
BGP_STR
"Display routes matching the large-community-list\n"
"large-community-list number\n"
"large-community-list name\n"
+ "Exact match of the large-communities\n"
JSON_STR)
{
char *vrf = NULL;
afi_t afi = AFI_IP6;
safi_t safi = SAFI_UNICAST;
int idx = 0;
+ bool exact_match = 0;
if (argv_find(argv, argc, "ip", &idx))
afi = AFI_IP;
}
argv_find(argv, argc, "large-community-list", &idx);
- return bgp_show_lcommunity_list(vty, bgp, argv[idx + 1]->arg, afi, safi,
- uj);
+
+ const char *clist_number_or_name = argv[++idx]->arg;
+
+ if (++idx < argc && strmatch(argv[idx]->text, "exact-match"))
+ exact_match = 1;
+
+ return bgp_show_lcommunity_list(vty, bgp, clist_number_or_name,
+ exact_match, afi, safi, uj);
}
DEFUN (show_ip_bgp_large_community,
show_ip_bgp_large_community_cmd,
- "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] large-community [AA:BB:CC] [json]",
+ "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_WITH_LABEL_CMD_STR"]] large-community [<AA:BB:CC> [exact-match]] [json]",
SHOW_STR
IP_STR
BGP_STR
BGP_SAFI_WITH_LABEL_HELP_STR
"Display routes matching the large-communities\n"
"List of large-community numbers\n"
+ "Exact match of the large-communities\n"
JSON_STR)
{
char *vrf = NULL;
afi_t afi = AFI_IP6;
safi_t safi = SAFI_UNICAST;
int idx = 0;
+ bool exact_match = 0;
if (argv_find(argv, argc, "ip", &idx))
afi = AFI_IP;
return CMD_WARNING;
}
- if (argv_find(argv, argc, "AA:BB:CC", &idx))
- return bgp_show_lcommunity(vty, bgp, argc, argv, afi, safi, uj);
- else
+ if (argv_find(argv, argc, "AA:BB:CC", &idx)) {
+ if (argv_find(argv, argc, "exact-match", &idx))
+ exact_match = 1;
+ return bgp_show_lcommunity(vty, bgp, argc, argv,
+ exact_match, afi, safi, uj);
+ } else
return bgp_show(vty, bgp, afi, safi,
bgp_show_type_lcommunity_all, NULL, uj);
}
bgp_show_type_community_list_exact,
bgp_show_type_lcommunity_all,
bgp_show_type_lcommunity,
+ bgp_show_type_lcommunity_exact,
bgp_show_type_lcommunity_list,
+ bgp_show_type_lcommunity_list_exact,
bgp_show_type_flap_statistics,
bgp_show_type_flap_neighbor,
bgp_show_type_dampend_paths,
if (!list)
return RMAP_NOMATCH;
- if (lcommunity_list_match(path->attr->lcommunity, list))
- return RMAP_MATCH;
+ if (rcom->exact) {
+ if (lcommunity_list_exact_match(
+ path->attr->lcommunity,
+ list))
+ return RMAP_MATCH;
+ } else {
+ if (lcommunity_list_match(
+ path->attr->lcommunity,
+ list))
+ return RMAP_MATCH;
+ }
}
return RMAP_NOMATCH;
}
len = p - arg;
rcom->name = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, len + 1);
memcpy(rcom->name, arg, len);
+ rcom->exact = 1;
} else {
rcom->name = XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
rcom->exact = 0;
DEFUN (match_lcommunity,
match_lcommunity_cmd,
- "match large-community <(1-99)|(100-500)|WORD>",
+ "match large-community <(1-99)|(100-500)|WORD> [exact-match]",
MATCH_STR
"Match BGP large community list\n"
"Large Community-list number (standard)\n"
"Large Community-list number (expanded)\n"
- "Large Community-list name\n")
+ "Large Community-list name\n"
+ "Do exact matching of communities\n")
{
- return bgp_route_match_add(vty, "large-community", argv[2]->arg,
+ int idx_lcomm_list = 2;
+ int ret;
+ char *argstr;
+
+ if (argc == 4) {
+ argstr = XMALLOC(MTYPE_ROUTE_MAP_COMPILED,
+ strlen(argv[idx_lcomm_list]->arg)
+ + strlen("exact-match") + 2);
+
+ sprintf(argstr, "%s exact-match", argv[idx_lcomm_list]->arg);
+ } else
+ argstr = argv[idx_lcomm_list]->arg;
+
+ ret = bgp_route_match_add(vty, "large-community", argstr,
RMAP_EVENT_LLIST_ADDED);
+ if (argstr != argv[idx_lcomm_list]->arg)
+ XFREE(MTYPE_ROUTE_MAP_COMPILED, argstr);
+
+ return ret;
}
DEFUN (no_match_lcommunity,
no_match_lcommunity_cmd,
- "no match large-community [<(1-99)|(100-500)|WORD>]",
+ "no match large-community [<(1-99)|(100-500)|WORD> [exact-match]]",
NO_STR
MATCH_STR
"Match BGP large community list\n"
"Large Community-list number (standard)\n"
"Large Community-list number (expanded)\n"
- "Large Community-list name\n")
+ "Large Community-list name\n"
+ "Do exact matching of communities\n")
{
return bgp_route_match_delete(vty, "large-community", NULL,
RMAP_EVENT_LLIST_DELETED);
bpacket_add_peer(pkt, paf);
bpacket_queue_sanity_check(SUBGRP_PKTQ(subgrp));
+ if (BGP_DEBUG(update_groups, UPDATE_GROUPS))
+ zlog_debug("peer %s added to subgroup s%" PRIu64,
+ paf->peer->host, subgrp->id);
}
/*
paf->subgroup = NULL;
subgrp->peer_count--;
+ if (BGP_DEBUG(update_groups, UPDATE_GROUPS))
+ zlog_debug("peer %s deleted from subgroup s%"
+ PRIu64 "peer cnt %d",
+ paf->peer->host, subgrp->id, subgrp->peer_count);
SUBGRP_INCR_STAT(subgrp, prune_events);
}
*/
if (!combine || !all_pending) {
update_subgroup_split_peer(paf, NULL);
- if (!paf->subgroup)
- return;
+ subgrp = paf->subgroup;
+ assert(subgrp && subgrp->update_group);
if (bgp_debug_update(paf->peer, NULL, subgrp->update_group, 0))
zlog_debug("u%" PRIu64 ":s%" PRIu64
" %s announcing routes",
ret = bgp_get(&bgp, &as, name, inst_type);
switch (ret) {
- case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
- vty_out(vty,
- "Please specify 'bgp multiple-instance' first\n");
- return CMD_WARNING_CONFIG_FAILED;
case BGP_ERR_AS_MISMATCH:
vty_out(vty, "BGP is already running; AS is %u\n", as);
return CMD_WARNING_CONFIG_FAILED;
{
int ret;
struct peer *peer;
- struct route_map *route_map;
+ struct route_map *route_map = NULL;
peer = peer_and_group_lookup_vty(vty, peer_str);
if (!peer)
return CMD_WARNING_CONFIG_FAILED;
if (set) {
- route_map = route_map_lookup_warn_noexist(vty, rmap);
+ if (rmap)
+ route_map = route_map_lookup_warn_noexist(vty, rmap);
ret = peer_default_originate_set(peer, afi, safi,
rmap, route_map);
} else
count * sizeof(struct peer_group)));
/* Other */
- if ((count = mtype_stats_alloc(MTYPE_HASH)))
- vty_out(vty, "%ld hash tables, using %s of memory\n", count,
- mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(struct hash)));
- if ((count = mtype_stats_alloc(MTYPE_HASH_BACKET)))
- vty_out(vty, "%ld hash buckets, using %s of memory\n", count,
- mtype_memstr(memstrbuf, sizeof(memstrbuf),
- count * sizeof(struct hash_bucket)));
if ((count = mtype_stats_alloc(MTYPE_BGP_REGEXP)))
vty_out(vty, "%ld compiled regexes, using %s of memory\n",
count, mtype_memstr(memstrbuf, sizeof(memstrbuf),
if (bgp->inst_type != inst_type)
return BGP_ERR_INSTANCE_MISMATCH;
*bgp_val = bgp;
- return 0;
+ return BGP_SUCCESS;
}
bgp = bgp_create(as, name, inst_type);
bgp_zebra_instance_register(bgp);
}
- return 0;
+ return BGP_SUCCESS;
}
/*
password zebra
!enable password please-set-at-here
!
-!bgp multiple-instance
!
router bgp 7675
! bgp router-id 10.0.0.1
#define BGP_ERR_INVALID_AS -3
#define BGP_ERR_INVALID_BGP -4
#define BGP_ERR_PEER_GROUP_MEMBER -5
-#define BGP_ERR_MULTIPLE_INSTANCE_USED -6
#define BGP_ERR_PEER_GROUP_NO_REMOTE_AS -7
#define BGP_ERR_PEER_GROUP_CANT_CHANGE -8
#define BGP_ERR_PEER_GROUP_MISMATCH -9
#define BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT -10
-#define BGP_ERR_MULTIPLE_INSTANCE_NOT_SET -11
#define BGP_ERR_AS_MISMATCH -12
#define BGP_ERR_PEER_FLAG_CONFLICT -13
#define BGP_ERR_PEER_GROUP_SHUTDOWN -14
{
struct rfapi_ip_addr vn;
struct rfapi_ip_addr un;
- uint32_t lifetime;
+ uint32_t lifetime = 0;
int rc;
rfapi_handle handle;
AC_SUBST([AR_FLAGS])
AC_MSG_CHECKING([whether $RANLIB supports D option])
-if $RANLIB -D conftest.a >/dev/null 2>/dev/null; then
- AC_MSG_RESULT([yes])
- RANLIB="$RANLIB -D"
+if $RANLIB -D conftest.a >conftest.err 2>&1; then
+ if grep -q -- '-D' conftest.err; then
+ AC_MSG_RESULT([no])
+ else
+ AC_MSG_RESULT([yes])
+ RANLIB="$RANLIB -D"
+ fi
else
AC_MSG_RESULT([no])
fi
AC_SUBST([RANLIB])
+test -f conftest.err && rm conftest.err
test -f conftest.a && rm conftest.a
dnl ----------------------
sudo modprobe mpls-router mpls-iptunnel
+
+.. note::
+ Fedora ships with the ``firewalld`` service enabled. You may run into some
+ issues with the iptables rules it installs by default. If you wish to just
+ stop the service and clear `ALL` rules do these commands:
+
+ .. code-block:: console
+
+ sudo systemctl disable firewalld.service
+ sudo systemctl stop firewalld.service
+ sudo iptables -F
+
Install service files
^^^^^^^^^^^^^^^^^^^^^
Definition
----------
+.. c:type:: struct memtype
+
+ This is the (internal) type used for MTYPE definitions. The macros below
+ should be used to create these, but in some cases it is useful to pass a
+ ``struct memtype *`` pointer to some helper function.
+
+ The ``MTYPE_name`` created by the macros is declared as an array, i.e.
+ a function taking a ``struct memtype *`` argument can be called with an
+ ``MTYPE_name`` argument (as opposed to ``&MTYPE_name``.)
+
.. c:macro:: DECLARE_MGROUP(name)
This macro forward-declares a memory group and should be placed in a
neighbor 10.0.0.6 remote-as 70
...
-In the past this feature done differently and the following commands were
-required to enable the functionality. They are now deprecated.
-
-.. deprecated:: 5.0
- This command is deprecated and may be safely removed from the config.
-
-.. index:: bgp multiple-instance
-.. clicmd:: bgp multiple-instance
-
- Enable BGP multiple instance feature. Because this is now the default
- configuration this command will not be displayed in the running
- configuration.
-
-.. deprecated:: 5.0
- This command is deprecated and may be safely removed from the config.
-
-.. index:: no bgp multiple-instance
-.. clicmd:: no bgp multiple-instance
-
- In previous versions of FRR, this command disabled the BGP multiple instance
- feature. This functionality is automatically turned on when BGP multiple
- instances or views exist so this command no longer does anything.
-
.. seealso:: :ref:`bgp-vrf-route-leaking`
.. seealso:: :ref:`zebra-vrf`
Route Aggregation
-----------------
+.. _bgp-route-aggregation-ipv4:
+
+Route Aggregation-IPv4 Address Family
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
.. index:: aggregate-address A.B.C.D/M
.. clicmd:: aggregate-address A.B.C.D/M
.. index:: no aggregate-address A.B.C.D/M
.. clicmd:: no aggregate-address A.B.C.D/M
+
+ This command removes an aggregate address.
+
+
+ This configuration example setup the aggregate-address under
+ ipv4 address-family.
+
+ .. code-block:: frr
+
+ router bgp 1
+ address-family ipv4 unicast
+ aggregate-address 10.0.0.0/8
+ aggregate-address 20.0.0.0/8 as-set
+ aggregate-address 40.0.0.0/8 summary-only
+ exit-address-family
+
+
+.. _bgp-route-aggregation-ipv6:
+
+Route Aggregation-IPv6 Address Family
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. index:: aggregate-address X:X::X:X/M
+.. clicmd:: aggregate-address X:X::X:X/M
+
+ This command specifies an aggregate address.
+
+.. index:: aggregate-address X:X::X:X/M as-set
+.. clicmd:: aggregate-address X:X::X:X/M as-set
+
+ This command specifies an aggregate address. Resulting routes include
+ AS set.
+
+.. index:: aggregate-address X:X::X:X/M summary-only
+.. clicmd:: aggregate-address X:X::X:X/M summary-only
+
+ This command specifies an aggregate address. Aggregated routes will
+ not be announce.
+
+.. index:: no aggregate-address X:X::X:X/M
+.. clicmd:: no aggregate-address X:X::X:X/M
+
+ This command removes an aggregate address.
+
+
+ This configuration example setup the aggregate-address under
+ ipv4 address-family.
+
+ .. code-block:: frr
+
+ router bgp 1
+ address-family ipv6 unicast
+ aggregate-address 10::0/64
+ aggregate-address 20::0/64 as-set
+ aggregate-address 40::0/64 summary-only
+ exit-address-family
.. _bgp-redistribute-to-bgp:
Large Communities in Route Map
""""""""""""""""""""""""""""""
-.. index:: match large-community LINE
-.. clicmd:: match large-community LINE
+.. index:: match large-community LINE [exact-match]
+.. clicmd:: match large-community LINE [exact-match]
Where `line` can be a simple string to match, or a regular expression. It
is very important to note that this match occurs on the entire
large-community string as a whole, where each large-community is ordered
- from lowest to highest.
+ from lowest to highest. When `exact-match` keyword is specified, match
+ happen only when BGP updates have completely same large communities value
+ specified in the large community list.
.. index:: set large-community LARGE-COMMUNITY
.. clicmd:: set large-community LARGE-COMMUNITY
match the specified community list. When `exact-match` is specified, it
displays only routes that have an exact match.
+.. _bgp-display-routes-by-lcommunity:
+
+Displaying Routes by Large Community Attribute
+----------------------------------------------
+
+The following commands allow displaying routes based on their
+large community attribute.
+
+.. index:: show [ip] bgp <ipv4|ipv6> large-community
+.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community
+
+.. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY
+.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY
+
+.. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY exact-match
+.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY exact-match
+
+.. index:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY json
+.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community LARGE-COMMUNITY json
+
+ These commands display BGP routes which have the large community attribute.
+ attribute. When ``LARGE-COMMUNITY`` is specified, BGP routes that match that
+ large community are displayed. When `exact-match` is specified, it display
+ only routes that have an exact match. When `json` is specified, it display
+ routes in json format.
+
+.. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD
+.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD
+
+.. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD exact-match
+.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD exact-match
+
+.. index:: show [ip] bgp <ipv4|ipv6> large-community-list WORD json
+.. clicmd:: show [ip] bgp <ipv4|ipv6> large-community-list WORD json
+
+ These commands display BGP routes for the address family specified that
+ match the specified large community list. When `exact-match` is specified,
+ it displays only routes that have an exact match. When `json` is specified,
+ it display routes in json format.
+
.. _bgp-display-routes-by-as-path:
+
Displaying Routes by AS Path
----------------------------
.. code-block:: frr
- bgp multiple-instance
!
router bgp 1 view 1
neighbor 10.0.0.1 remote-as 2
Clear counter of ip prefix-list
-------------------------------
-.. index:: clear ip prefix-list
-.. clicmd:: clear ip prefix-list
+.. index:: clear ip prefix-list [NAME [A.B.C.D/M]]
+.. clicmd:: clear ip prefix-list [NAME [A.B.C.D/M]]
Clears the counters of all IP prefix lists. Clear IP Prefix List can be used
- with a specified name and prefix.
-
-.. index:: clear ip prefix-list NAME
-.. clicmd:: clear ip prefix-list NAME
-
-.. index:: clear ip prefix-list NAME A.B.C.D/M
-.. clicmd:: clear ip prefix-list NAME A.B.C.D/M
+ with a specified NAME or NAME and prefix.
hostname RS
password ix
!
- bgp multiple-instance
- !
router bgp 65000 view RS
no bgp default ipv4-unicast
neighbor 2001:0DB8::A remote-as 65001
eigprd 2613/tcp # EIGRPd vty
bfdd 2617/tcp # bfdd vty
fabricd 2618/tcp # fabricd vty
+ vrrpd 2619/tcp # vrrpd vty
If you use a FreeBSD newer than 2.2.8, the above entries are already added to
You may need to make changes to the config files in |INSTALL_PREFIX_ETC|.
-systemd
+Systemd
-------
Although not installed when installing from source, FRR provides a service file
for use with ``systemd``. It is located in :file:`tools/frr.service` in the Git
After issuing a ``systemctl daemon-reload``, you should be able to start the
FRR service via ``systemctl start frr``. If this fails, or no daemons are
started. check the ``journalctl`` logs for an indication of what went wrong.
+
+Operations
+----------
+
+This section covers a few common operational tasks and how to perform them.
+
+Restarting
+^^^^^^^^^^
+
+Restarting kills all running FRR daemons and starts them again. Any unsaved
+configuration will be lost.
+
+.. code-block:: console
+
+ service frr restart
+
+.. note::
+
+ Alternatively, you can invoke the init script directly::
+
+ /etc/init.d/frr restart
+
+ Or, if using systemd::
+
+ systemctl restart frr
+
+Reloading
+^^^^^^^^^
+
+Reloading applies the differential between on-disk configuration and the
+current effective configuration of running FRR processes. This includes
+starting daemons that were previously stopped and any changes made to
+individual or unified daemon configuration files.
+
+.. code-block:: console
+
+ service frr reload
+
+.. note::
+
+ Alternatively, you can invoke the init script directly::
+
+ /etc/init.d/frr reload
+
+ Or, if using systemd::
+
+ systemctl reload frr
+
+Starting a new daemon
+^^^^^^^^^^^^^^^^^^^^^
+
+Suppose *bgpd* and *zebra* are running, and you wish to start *pimd*. In
+``/etc/frr/daemons`` make the following change:
+
+.. code-block:: diff
+
+ - pimd=no
+ + pimd=yes
+
+Then perform a reload.
+
+Currently there is no way to stop or restart an individual daemon. This is
+because FRR's monitoring program cannot currently distinguish between a crashed
+/ killed daemon versus one that has been intentionally stopped or restarted.
+The closest that can be achieved is to remove all configuration for the daemon,
+and set its line in ``/etc/frr/daemons`` to ``=no``. Once this is done, the
+daemon will be stopped the next time FRR is restarted.
announced via BGP, but they are made available for local RFP lookup in response
to queries from NVEs.
-A non-main/default BGP instance is configured using the `bgp multiple-instance`
-and `router bgp AS view NAME` commands as described elsewhere in this document.
+A non-main/default BGP instance is configured using the
+`router bgp AS view NAME` command as described elsewhere in this document.
In order for a route in the unicast BGP RIB to be made available to a querying
NVE, there must already be, available to that NVE, an (interior) VNC route
RUN echo deb https://deb.frrouting.org/frr $(lsb_release -s -c) frr-stable | tee -a /etc/apt/sources.list.d/frr.list
RUN apt-get update
RUN apt-get install -y frr frr-pythontools
-ADD daemons /etc/frr/daemons
ADD docker-start /usr/sbin/docker-start
ENTRYPOINT ["/usr/sbin/docker-start"]
-# Debian9 Docker
-This is a binary docker container build of debian9.
+# Debian 10 Docker
+
+This is a binary docker container build of Debian 10 (buster) with FRR.
# Build
+
```
-docker build --rm -t frr:6.0.2 .
+docker build -t frr-debian:latest .
```
# Running
+
```
-docker run -itd --privileged --name frr frr:latest
+docker run -itd --privileged --name frr frr-debian:latest
```
vtysh
+++ /dev/null
-# This file tells the frr package which daemons to start.
-#
-# Sample configurations for these daemons can be found in
-# /usr/share/doc/frr/examples/.
-#
-# ATTENTION:
-#
-# When activation a daemon at the first time, a config file, even if it is
-# empty, has to be present *and* be owned by the user and group "frr", else
-# the daemon will not be started by /etc/init.d/frr. The permissions should
-# be u=rw,g=r,o=.
-# When using "vtysh" such a config file is also needed. It should be owned by
-# group "frrvty" and set to ug=rw,o= though. Check /etc/pam.d/frr, too.
-#
-# The watchfrr and zebra daemons are always started.
-#
-bgpd=yes
-ospfd=no
-ospf6d=no
-ripd=no
-ripngd=no
-isisd=no
-pimd=no
-ldpd=no
-nhrpd=no
-eigrpd=no
-babeld=no
-sharpd=no
-pbrd=no
-bfdd=no
-fabricd=no
-
-#
-# If this option is set the /etc/init.d/frr script automatically loads
-# the config via "vtysh -b" when the servers are started.
-# Check /etc/pam.d/frr if you intend to use "vtysh"!
-#
-vtysh_enable=yes
-zebra_options=" -A 127.0.0.1 -s 90000000"
-bgpd_options=" -A 127.0.0.1"
-ospfd_options=" -A 127.0.0.1"
-ospf6d_options=" -A ::1"
-ripd_options=" -A 127.0.0.1"
-ripngd_options=" -A ::1"
-isisd_options=" -A 127.0.0.1"
-pimd_options=" -A 127.0.0.1"
-ldpd_options=" -A 127.0.0.1"
-nhrpd_options=" -A 127.0.0.1"
-eigrpd_options=" -A 127.0.0.1"
-babeld_options=" -A 127.0.0.1"
-sharpd_options=" -A 127.0.0.1"
-pbrd_options=" -A 127.0.0.1"
-staticd_options="-A 127.0.0.1"
-bfdd_options=" -A 127.0.0.1"
-fabricd_options="-A 127.0.0.1"
-
-# The list of daemons to watch is automatically generated by the init script.
-watchfrr_options="-r '/usr/lib/frr/watchfrr.sh restart %s' -s '/usr/lib/frr/watchfrr.sh start %s' -k '/usr/lib/frr/watchfrr.sh stop %s'"
-
-# for debugging purposes, you can specify a "wrap" command to start instead
-# of starting the daemon directly, e.g. to use valgrind on ospfd:
-# ospfd_wrap="/usr/bin/valgrind"
-# or you can use "all_wrap" for all daemons, e.g. to use perf record:
-# all_wrap="/usr/bin/perf record --call-graph -"
-# the normal daemon command is added to this at the end.
.nodes = {
{
.xpath = "/frr-isisd:isis/instance",
- .cbs.create = isis_instance_create,
- .cbs.destroy = isis_instance_destroy,
- .cbs.cli_show = cli_show_router_isis,
+ .cbs = {
+ .cli_show = cli_show_router_isis,
+ .create = isis_instance_create,
+ .destroy = isis_instance_destroy,
+ },
.priority = NB_DFLT_PRIORITY - 1,
},
{
.xpath = "/frr-isisd:isis/instance/is-type",
- .cbs.modify = isis_instance_is_type_modify,
- .cbs.cli_show = cli_show_isis_is_type,
+ .cbs = {
+ .cli_show = cli_show_isis_is_type,
+ .modify = isis_instance_is_type_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/area-address",
- .cbs.create = isis_instance_area_address_create,
- .cbs.destroy = isis_instance_area_address_destroy,
- .cbs.cli_show = cli_show_isis_area_address,
+ .cbs = {
+ .cli_show = cli_show_isis_area_address,
+ .create = isis_instance_area_address_create,
+ .destroy = isis_instance_area_address_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/dynamic-hostname",
- .cbs.modify = isis_instance_dynamic_hostname_modify,
- .cbs.cli_show = cli_show_isis_dynamic_hostname,
+ .cbs = {
+ .cli_show = cli_show_isis_dynamic_hostname,
+ .modify = isis_instance_dynamic_hostname_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/attached",
- .cbs.modify = isis_instance_attached_modify,
- .cbs.cli_show = cli_show_isis_attached,
+ .cbs = {
+ .cli_show = cli_show_isis_attached,
+ .modify = isis_instance_attached_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/overload",
- .cbs.modify = isis_instance_overload_modify,
- .cbs.cli_show = cli_show_isis_overload,
+ .cbs = {
+ .cli_show = cli_show_isis_overload,
+ .modify = isis_instance_overload_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/metric-style",
- .cbs.modify = isis_instance_metric_style_modify,
- .cbs.cli_show = cli_show_isis_metric_style,
+ .cbs = {
+ .cli_show = cli_show_isis_metric_style,
+ .modify = isis_instance_metric_style_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/purge-originator",
- .cbs.modify = isis_instance_purge_originator_modify,
- .cbs.cli_show = cli_show_isis_purge_origin,
+ .cbs = {
+ .cli_show = cli_show_isis_purge_origin,
+ .modify = isis_instance_purge_originator_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/lsp/mtu",
- .cbs.modify = isis_instance_lsp_mtu_modify,
- .cbs.cli_show = cli_show_isis_lsp_mtu,
+ .cbs = {
+ .cli_show = cli_show_isis_lsp_mtu,
+ .modify = isis_instance_lsp_mtu_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/lsp/refresh-interval",
- .cbs.cli_show = cli_show_isis_lsp_ref_interval,
+ .cbs = {
+ .cli_show = cli_show_isis_lsp_ref_interval,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/lsp/refresh-interval/level-1",
- .cbs.modify = isis_instance_lsp_refresh_interval_level_1_modify,
+ .cbs = {
+ .modify = isis_instance_lsp_refresh_interval_level_1_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/lsp/refresh-interval/level-2",
- .cbs.modify = isis_instance_lsp_refresh_interval_level_2_modify,
+ .cbs = {
+ .modify = isis_instance_lsp_refresh_interval_level_2_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/lsp/maximum-lifetime",
- .cbs.cli_show = cli_show_isis_lsp_max_lifetime,
+ .cbs = {
+ .cli_show = cli_show_isis_lsp_max_lifetime,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/lsp/maximum-lifetime/level-1",
- .cbs.modify = isis_instance_lsp_maximum_lifetime_level_1_modify,
+ .cbs = {
+ .modify = isis_instance_lsp_maximum_lifetime_level_1_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/lsp/maximum-lifetime/level-2",
- .cbs.modify = isis_instance_lsp_maximum_lifetime_level_2_modify,
+ .cbs = {
+ .modify = isis_instance_lsp_maximum_lifetime_level_2_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/lsp/generation-interval",
- .cbs.cli_show = cli_show_isis_lsp_gen_interval,
+ .cbs = {
+ .cli_show = cli_show_isis_lsp_gen_interval,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/lsp/generation-interval/level-1",
- .cbs.modify = isis_instance_lsp_generation_interval_level_1_modify,
+ .cbs = {
+ .modify = isis_instance_lsp_generation_interval_level_1_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/lsp/generation-interval/level-2",
- .cbs.modify = isis_instance_lsp_generation_interval_level_2_modify,
+ .cbs = {
+ .modify = isis_instance_lsp_generation_interval_level_2_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/spf/ietf-backoff-delay",
- .cbs.create = isis_instance_spf_ietf_backoff_delay_create,
- .cbs.destroy = isis_instance_spf_ietf_backoff_delay_destroy,
- .cbs.apply_finish = ietf_backoff_delay_apply_finish,
- .cbs.cli_show = cli_show_isis_spf_ietf_backoff,
+ .cbs = {
+ .apply_finish = ietf_backoff_delay_apply_finish,
+ .cli_show = cli_show_isis_spf_ietf_backoff,
+ .create = isis_instance_spf_ietf_backoff_delay_create,
+ .destroy = isis_instance_spf_ietf_backoff_delay_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/spf/ietf-backoff-delay/init-delay",
- .cbs.modify = isis_instance_spf_ietf_backoff_delay_init_delay_modify,
+ .cbs = {
+ .modify = isis_instance_spf_ietf_backoff_delay_init_delay_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/spf/ietf-backoff-delay/short-delay",
- .cbs.modify = isis_instance_spf_ietf_backoff_delay_short_delay_modify,
+ .cbs = {
+ .modify = isis_instance_spf_ietf_backoff_delay_short_delay_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/spf/ietf-backoff-delay/long-delay",
- .cbs.modify = isis_instance_spf_ietf_backoff_delay_long_delay_modify,
+ .cbs = {
+ .modify = isis_instance_spf_ietf_backoff_delay_long_delay_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/spf/ietf-backoff-delay/hold-down",
- .cbs.modify = isis_instance_spf_ietf_backoff_delay_hold_down_modify,
+ .cbs = {
+ .modify = isis_instance_spf_ietf_backoff_delay_hold_down_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/spf/ietf-backoff-delay/time-to-learn",
- .cbs.modify = isis_instance_spf_ietf_backoff_delay_time_to_learn_modify,
+ .cbs = {
+ .modify = isis_instance_spf_ietf_backoff_delay_time_to_learn_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/spf/minimum-interval",
- .cbs.cli_show = cli_show_isis_spf_min_interval,
+ .cbs = {
+ .cli_show = cli_show_isis_spf_min_interval,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/spf/minimum-interval/level-1",
- .cbs.modify = isis_instance_spf_minimum_interval_level_1_modify,
+ .cbs = {
+ .modify = isis_instance_spf_minimum_interval_level_1_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/spf/minimum-interval/level-2",
- .cbs.modify = isis_instance_spf_minimum_interval_level_2_modify,
+ .cbs = {
+ .modify = isis_instance_spf_minimum_interval_level_2_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/area-password",
- .cbs.create = isis_instance_area_password_create,
- .cbs.destroy = isis_instance_area_password_destroy,
- .cbs.apply_finish = area_password_apply_finish,
- .cbs.cli_show = cli_show_isis_area_pwd,
+ .cbs = {
+ .apply_finish = area_password_apply_finish,
+ .cli_show = cli_show_isis_area_pwd,
+ .create = isis_instance_area_password_create,
+ .destroy = isis_instance_area_password_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/area-password/password",
- .cbs.modify = isis_instance_area_password_password_modify,
+ .cbs = {
+ .modify = isis_instance_area_password_password_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/area-password/password-type",
- .cbs.modify = isis_instance_area_password_password_type_modify,
+ .cbs = {
+ .modify = isis_instance_area_password_password_type_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/area-password/authenticate-snp",
- .cbs.modify = isis_instance_area_password_authenticate_snp_modify,
+ .cbs = {
+ .modify = isis_instance_area_password_authenticate_snp_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/domain-password",
- .cbs.create = isis_instance_domain_password_create,
- .cbs.destroy = isis_instance_domain_password_destroy,
- .cbs.apply_finish = domain_password_apply_finish,
- .cbs.cli_show = cli_show_isis_domain_pwd,
+ .cbs = {
+ .apply_finish = domain_password_apply_finish,
+ .cli_show = cli_show_isis_domain_pwd,
+ .create = isis_instance_domain_password_create,
+ .destroy = isis_instance_domain_password_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/domain-password/password",
- .cbs.modify = isis_instance_domain_password_password_modify,
+ .cbs = {
+ .modify = isis_instance_domain_password_password_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/domain-password/password-type",
- .cbs.modify = isis_instance_domain_password_password_type_modify,
+ .cbs = {
+ .modify = isis_instance_domain_password_password_type_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/domain-password/authenticate-snp",
- .cbs.modify = isis_instance_domain_password_authenticate_snp_modify,
+ .cbs = {
+ .modify = isis_instance_domain_password_authenticate_snp_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/default-information-originate/ipv4",
- .cbs.create = isis_instance_default_information_originate_ipv4_create,
- .cbs.destroy = isis_instance_default_information_originate_ipv4_destroy,
- .cbs.apply_finish = default_info_origin_ipv4_apply_finish,
- .cbs.cli_show = cli_show_isis_def_origin_ipv4,
+ .cbs = {
+ .apply_finish = default_info_origin_ipv4_apply_finish,
+ .cli_show = cli_show_isis_def_origin_ipv4,
+ .create = isis_instance_default_information_originate_ipv4_create,
+ .destroy = isis_instance_default_information_originate_ipv4_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/default-information-originate/ipv4/always",
- .cbs.modify = isis_instance_default_information_originate_ipv4_always_modify,
+ .cbs = {
+ .modify = isis_instance_default_information_originate_ipv4_always_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/default-information-originate/ipv4/route-map",
- .cbs.modify = isis_instance_default_information_originate_ipv4_route_map_modify,
- .cbs.destroy = isis_instance_default_information_originate_ipv4_route_map_destroy,
+ .cbs = {
+ .destroy = isis_instance_default_information_originate_ipv4_route_map_destroy,
+ .modify = isis_instance_default_information_originate_ipv4_route_map_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/default-information-originate/ipv4/metric",
- .cbs.modify = isis_instance_default_information_originate_ipv4_metric_modify,
+ .cbs = {
+ .modify = isis_instance_default_information_originate_ipv4_metric_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/default-information-originate/ipv6",
- .cbs.create = isis_instance_default_information_originate_ipv6_create,
- .cbs.destroy = isis_instance_default_information_originate_ipv6_destroy,
- .cbs.apply_finish = default_info_origin_ipv6_apply_finish,
- .cbs.cli_show = cli_show_isis_def_origin_ipv6,
+ .cbs = {
+ .apply_finish = default_info_origin_ipv6_apply_finish,
+ .cli_show = cli_show_isis_def_origin_ipv6,
+ .create = isis_instance_default_information_originate_ipv6_create,
+ .destroy = isis_instance_default_information_originate_ipv6_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/default-information-originate/ipv6/always",
- .cbs.modify = isis_instance_default_information_originate_ipv6_always_modify,
+ .cbs = {
+ .modify = isis_instance_default_information_originate_ipv6_always_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/default-information-originate/ipv6/route-map",
- .cbs.modify = isis_instance_default_information_originate_ipv6_route_map_modify,
- .cbs.destroy = isis_instance_default_information_originate_ipv6_route_map_destroy,
+ .cbs = {
+ .destroy = isis_instance_default_information_originate_ipv6_route_map_destroy,
+ .modify = isis_instance_default_information_originate_ipv6_route_map_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/default-information-originate/ipv6/metric",
- .cbs.modify = isis_instance_default_information_originate_ipv6_metric_modify,
+ .cbs = {
+ .modify = isis_instance_default_information_originate_ipv6_metric_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/redistribute/ipv4",
- .cbs.create = isis_instance_redistribute_ipv4_create,
- .cbs.destroy = isis_instance_redistribute_ipv4_destroy,
- .cbs.apply_finish = redistribute_ipv4_apply_finish,
- .cbs.cli_show = cli_show_isis_redistribute_ipv4,
+ .cbs = {
+ .apply_finish = redistribute_ipv4_apply_finish,
+ .cli_show = cli_show_isis_redistribute_ipv4,
+ .create = isis_instance_redistribute_ipv4_create,
+ .destroy = isis_instance_redistribute_ipv4_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/redistribute/ipv4/route-map",
- .cbs.modify = isis_instance_redistribute_ipv4_route_map_modify,
- .cbs.destroy = isis_instance_redistribute_ipv4_route_map_destroy,
+ .cbs = {
+ .destroy = isis_instance_redistribute_ipv4_route_map_destroy,
+ .modify = isis_instance_redistribute_ipv4_route_map_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/redistribute/ipv4/metric",
- .cbs.modify = isis_instance_redistribute_ipv4_metric_modify,
+ .cbs = {
+ .modify = isis_instance_redistribute_ipv4_metric_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/redistribute/ipv6",
- .cbs.create = isis_instance_redistribute_ipv6_create,
- .cbs.destroy = isis_instance_redistribute_ipv6_destroy,
- .cbs.apply_finish = redistribute_ipv6_apply_finish,
- .cbs.cli_show = cli_show_isis_redistribute_ipv6,
+ .cbs = {
+ .apply_finish = redistribute_ipv6_apply_finish,
+ .cli_show = cli_show_isis_redistribute_ipv6,
+ .create = isis_instance_redistribute_ipv6_create,
+ .destroy = isis_instance_redistribute_ipv6_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/redistribute/ipv6/route-map",
- .cbs.modify = isis_instance_redistribute_ipv6_route_map_modify,
- .cbs.destroy = isis_instance_redistribute_ipv6_route_map_destroy,
+ .cbs = {
+ .destroy = isis_instance_redistribute_ipv6_route_map_destroy,
+ .modify = isis_instance_redistribute_ipv6_route_map_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/redistribute/ipv6/metric",
- .cbs.modify = isis_instance_redistribute_ipv6_metric_modify,
+ .cbs = {
+ .modify = isis_instance_redistribute_ipv6_metric_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv4-multicast",
- .cbs.create = isis_instance_multi_topology_ipv4_multicast_create,
- .cbs.destroy = isis_instance_multi_topology_ipv4_multicast_destroy,
- .cbs.cli_show = cli_show_isis_mt_ipv4_multicast,
+ .cbs = {
+ .cli_show = cli_show_isis_mt_ipv4_multicast,
+ .create = isis_instance_multi_topology_ipv4_multicast_create,
+ .destroy = isis_instance_multi_topology_ipv4_multicast_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv4-multicast/overload",
- .cbs.modify = isis_instance_multi_topology_ipv4_multicast_overload_modify,
+ .cbs = {
+ .modify = isis_instance_multi_topology_ipv4_multicast_overload_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv4-management",
- .cbs.create = isis_instance_multi_topology_ipv4_management_create,
- .cbs.destroy = isis_instance_multi_topology_ipv4_management_destroy,
- .cbs.cli_show = cli_show_isis_mt_ipv4_mgmt,
+ .cbs = {
+ .cli_show = cli_show_isis_mt_ipv4_mgmt,
+ .create = isis_instance_multi_topology_ipv4_management_create,
+ .destroy = isis_instance_multi_topology_ipv4_management_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv4-management/overload",
- .cbs.modify = isis_instance_multi_topology_ipv4_management_overload_modify,
+ .cbs = {
+ .modify = isis_instance_multi_topology_ipv4_management_overload_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-unicast",
- .cbs.create = isis_instance_multi_topology_ipv6_unicast_create,
- .cbs.destroy = isis_instance_multi_topology_ipv6_unicast_destroy,
- .cbs.cli_show = cli_show_isis_mt_ipv6_unicast,
+ .cbs = {
+ .cli_show = cli_show_isis_mt_ipv6_unicast,
+ .create = isis_instance_multi_topology_ipv6_unicast_create,
+ .destroy = isis_instance_multi_topology_ipv6_unicast_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-unicast/overload",
- .cbs.modify = isis_instance_multi_topology_ipv6_unicast_overload_modify,
+ .cbs = {
+ .modify = isis_instance_multi_topology_ipv6_unicast_overload_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-multicast",
- .cbs.create = isis_instance_multi_topology_ipv6_multicast_create,
- .cbs.destroy = isis_instance_multi_topology_ipv6_multicast_destroy,
- .cbs.cli_show = cli_show_isis_mt_ipv6_multicast,
+ .cbs = {
+ .cli_show = cli_show_isis_mt_ipv6_multicast,
+ .create = isis_instance_multi_topology_ipv6_multicast_create,
+ .destroy = isis_instance_multi_topology_ipv6_multicast_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-multicast/overload",
- .cbs.modify = isis_instance_multi_topology_ipv6_multicast_overload_modify,
+ .cbs = {
+ .modify = isis_instance_multi_topology_ipv6_multicast_overload_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-management",
- .cbs.create = isis_instance_multi_topology_ipv6_management_create,
- .cbs.destroy = isis_instance_multi_topology_ipv6_management_destroy,
- .cbs.cli_show = cli_show_isis_mt_ipv6_mgmt,
+ .cbs = {
+ .cli_show = cli_show_isis_mt_ipv6_mgmt,
+ .create = isis_instance_multi_topology_ipv6_management_create,
+ .destroy = isis_instance_multi_topology_ipv6_management_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-management/overload",
- .cbs.modify = isis_instance_multi_topology_ipv6_management_overload_modify,
+ .cbs = {
+ .modify = isis_instance_multi_topology_ipv6_management_overload_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-dstsrc",
- .cbs.create = isis_instance_multi_topology_ipv6_dstsrc_create,
- .cbs.destroy = isis_instance_multi_topology_ipv6_dstsrc_destroy,
- .cbs.cli_show = cli_show_isis_mt_ipv6_dstsrc,
+ .cbs = {
+ .cli_show = cli_show_isis_mt_ipv6_dstsrc,
+ .create = isis_instance_multi_topology_ipv6_dstsrc_create,
+ .destroy = isis_instance_multi_topology_ipv6_dstsrc_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/multi-topology/ipv6-dstsrc/overload",
- .cbs.modify = isis_instance_multi_topology_ipv6_dstsrc_overload_modify,
+ .cbs = {
+ .modify = isis_instance_multi_topology_ipv6_dstsrc_overload_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/log-adjacency-changes",
- .cbs.modify = isis_instance_log_adjacency_changes_modify,
- .cbs.cli_show = cli_show_isis_log_adjacency,
+ .cbs = {
+ .cli_show = cli_show_isis_log_adjacency,
+ .modify = isis_instance_log_adjacency_changes_modify,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/mpls-te",
- .cbs.create = isis_instance_mpls_te_create,
- .cbs.destroy = isis_instance_mpls_te_destroy,
- .cbs.cli_show = cli_show_isis_mpls_te,
+ .cbs = {
+ .cli_show = cli_show_isis_mpls_te,
+ .create = isis_instance_mpls_te_create,
+ .destroy = isis_instance_mpls_te_destroy,
+ },
},
{
.xpath = "/frr-isisd:isis/instance/mpls-te/router-address",
- .cbs.modify = isis_instance_mpls_te_router_address_modify,
- .cbs.destroy = isis_instance_mpls_te_router_address_destroy,
- .cbs.cli_show = cli_show_isis_mpls_te_router_addr,
+ .cbs = {
+ .cli_show = cli_show_isis_mpls_te_router_addr,
+ .destroy = isis_instance_mpls_te_router_address_destroy,
+ .modify = isis_instance_mpls_te_router_address_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis",
- .cbs.create = lib_interface_isis_create,
- .cbs.destroy = lib_interface_isis_destroy,
+ .cbs = {
+ .create = lib_interface_isis_create,
+ .destroy = lib_interface_isis_destroy,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/area-tag",
- .cbs.modify = lib_interface_isis_area_tag_modify,
+ .cbs = {
+ .modify = lib_interface_isis_area_tag_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/circuit-type",
- .cbs.modify = lib_interface_isis_circuit_type_modify,
- .cbs.cli_show = cli_show_ip_isis_circ_type,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_circ_type,
+ .modify = lib_interface_isis_circuit_type_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/ipv4-routing",
- .cbs.modify = lib_interface_isis_ipv4_routing_modify,
- .cbs.cli_show = cli_show_ip_isis_ipv4,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_ipv4,
+ .modify = lib_interface_isis_ipv4_routing_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/ipv6-routing",
- .cbs.modify = lib_interface_isis_ipv6_routing_modify,
- .cbs.cli_show = cli_show_ip_isis_ipv6,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_ipv6,
+ .modify = lib_interface_isis_ipv6_routing_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/csnp-interval",
- .cbs.cli_show = cli_show_ip_isis_csnp_interval,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_csnp_interval,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-1",
- .cbs.modify = lib_interface_isis_csnp_interval_level_1_modify,
+ .cbs = {
+ .modify = lib_interface_isis_csnp_interval_level_1_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-2",
- .cbs.modify = lib_interface_isis_csnp_interval_level_2_modify,
+ .cbs = {
+ .modify = lib_interface_isis_csnp_interval_level_2_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/psnp-interval",
- .cbs.cli_show = cli_show_ip_isis_psnp_interval,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_psnp_interval,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-1",
- .cbs.modify = lib_interface_isis_psnp_interval_level_1_modify,
+ .cbs = {
+ .modify = lib_interface_isis_psnp_interval_level_1_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/psnp-interval/level-2",
- .cbs.modify = lib_interface_isis_psnp_interval_level_2_modify,
+ .cbs = {
+ .modify = lib_interface_isis_psnp_interval_level_2_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/hello/padding",
- .cbs.modify = lib_interface_isis_hello_padding_modify,
- .cbs.cli_show = cli_show_ip_isis_hello_padding,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_hello_padding,
+ .modify = lib_interface_isis_hello_padding_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/hello/interval",
- .cbs.cli_show = cli_show_ip_isis_hello_interval,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_hello_interval,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-1",
- .cbs.modify = lib_interface_isis_hello_interval_level_1_modify,
+ .cbs = {
+ .modify = lib_interface_isis_hello_interval_level_1_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/hello/interval/level-2",
- .cbs.modify = lib_interface_isis_hello_interval_level_2_modify,
+ .cbs = {
+ .modify = lib_interface_isis_hello_interval_level_2_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/hello/multiplier",
- .cbs.cli_show = cli_show_ip_isis_hello_multi,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_hello_multi,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-1",
- .cbs.modify = lib_interface_isis_hello_multiplier_level_1_modify,
+ .cbs = {
+ .modify = lib_interface_isis_hello_multiplier_level_1_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/hello/multiplier/level-2",
- .cbs.modify = lib_interface_isis_hello_multiplier_level_2_modify,
+ .cbs = {
+ .modify = lib_interface_isis_hello_multiplier_level_2_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/metric",
- .cbs.cli_show = cli_show_ip_isis_metric,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_metric,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/metric/level-1",
- .cbs.modify = lib_interface_isis_metric_level_1_modify,
+ .cbs = {
+ .modify = lib_interface_isis_metric_level_1_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/metric/level-2",
- .cbs.modify = lib_interface_isis_metric_level_2_modify,
+ .cbs = {
+ .modify = lib_interface_isis_metric_level_2_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/priority",
- .cbs.cli_show = cli_show_ip_isis_priority,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_priority,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/priority/level-1",
- .cbs.modify = lib_interface_isis_priority_level_1_modify,
+ .cbs = {
+ .modify = lib_interface_isis_priority_level_1_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/priority/level-2",
- .cbs.modify = lib_interface_isis_priority_level_2_modify,
+ .cbs = {
+ .modify = lib_interface_isis_priority_level_2_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/network-type",
- .cbs.modify = lib_interface_isis_network_type_modify,
- .cbs.cli_show = cli_show_ip_isis_network_type,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_network_type,
+ .modify = lib_interface_isis_network_type_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/passive",
- .cbs.modify = lib_interface_isis_passive_modify,
- .cbs.cli_show = cli_show_ip_isis_passive,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_passive,
+ .modify = lib_interface_isis_passive_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/password",
- .cbs.create = lib_interface_isis_password_create,
- .cbs.destroy = lib_interface_isis_password_destroy,
- .cbs.cli_show = cli_show_ip_isis_password,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_password,
+ .create = lib_interface_isis_password_create,
+ .destroy = lib_interface_isis_password_destroy,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/password/password",
- .cbs.modify = lib_interface_isis_password_password_modify,
+ .cbs = {
+ .modify = lib_interface_isis_password_password_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/password/password-type",
- .cbs.modify = lib_interface_isis_password_password_type_modify,
+ .cbs = {
+ .modify = lib_interface_isis_password_password_type_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/disable-three-way-handshake",
- .cbs.modify = lib_interface_isis_disable_three_way_handshake_modify,
- .cbs.cli_show = cli_show_ip_isis_threeway_shake,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_threeway_shake,
+ .modify = lib_interface_isis_disable_three_way_handshake_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-unicast",
- .cbs.modify = lib_interface_isis_multi_topology_ipv4_unicast_modify,
- .cbs.cli_show = cli_show_ip_isis_mt_ipv4_unicast,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_mt_ipv4_unicast,
+ .modify = lib_interface_isis_multi_topology_ipv4_unicast_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-multicast",
- .cbs.modify = lib_interface_isis_multi_topology_ipv4_multicast_modify,
- .cbs.cli_show = cli_show_ip_isis_mt_ipv4_multicast,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_mt_ipv4_multicast,
+ .modify = lib_interface_isis_multi_topology_ipv4_multicast_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv4-management",
- .cbs.modify = lib_interface_isis_multi_topology_ipv4_management_modify,
- .cbs.cli_show = cli_show_ip_isis_mt_ipv4_mgmt,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_mt_ipv4_mgmt,
+ .modify = lib_interface_isis_multi_topology_ipv4_management_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-unicast",
- .cbs.modify = lib_interface_isis_multi_topology_ipv6_unicast_modify,
- .cbs.cli_show = cli_show_ip_isis_mt_ipv6_unicast,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_mt_ipv6_unicast,
+ .modify = lib_interface_isis_multi_topology_ipv6_unicast_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-multicast",
- .cbs.modify = lib_interface_isis_multi_topology_ipv6_multicast_modify,
- .cbs.cli_show = cli_show_ip_isis_mt_ipv6_multicast,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_mt_ipv6_multicast,
+ .modify = lib_interface_isis_multi_topology_ipv6_multicast_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-management",
- .cbs.modify = lib_interface_isis_multi_topology_ipv6_management_modify,
- .cbs.cli_show = cli_show_ip_isis_mt_ipv6_mgmt,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_mt_ipv6_mgmt,
+ .modify = lib_interface_isis_multi_topology_ipv6_management_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/multi-topology/ipv6-dstsrc",
- .cbs.modify = lib_interface_isis_multi_topology_ipv6_dstsrc_modify,
- .cbs.cli_show = cli_show_ip_isis_mt_ipv6_dstsrc,
+ .cbs = {
+ .cli_show = cli_show_ip_isis_mt_ipv6_dstsrc,
+ .modify = lib_interface_isis_multi_topology_ipv6_dstsrc_modify,
+ },
},
{
.xpath = NULL,
len -= msg_size;
}
free(buf);
+ buf = NULL;
if (len != 0) {
session_shutdown(nbr, S_BAD_PDU_LEN, 0, 0);
return (0);
}
}
+ /* shouldn't happen, session_get_pdu should be > 0 if buf was
+ * allocated - but let's get rid of the SA warning.
+ */
+ free(buf);
return (0);
}
#include "lib_errors.h"
#include "northbound_cli.h"
-DEFINE_MTYPE(LIB, HOST, "Host config")
+DEFINE_MTYPE_STATIC(LIB, HOST, "Host config")
DEFINE_MTYPE(LIB, COMPLETION, "Completion item")
#define item(x) \
"vrf debug", // VRF_DEBUG_NODE,
"northbound debug", // NORTHBOUND_DEBUG_NODE,
"vnc debug", // DEBUG_VNC_NODE,
+ "route-map debug", /* RMAP_DEBUG_NODE */
"aaa", // AAA_NODE,
"keychain", // KEYCHAIN_NODE,
"keychain key", // KEYCHAIN_KEY_NODE,
extern "C" {
#endif
-DECLARE_MTYPE(HOST)
DECLARE_MTYPE(COMPLETION)
/*
VRF_DEBUG_NODE, /* Vrf Debug node. */
NORTHBOUND_DEBUG_NODE, /* Northbound Debug node. */
DEBUG_VNC_NODE, /* Debug VNC node. */
+ RMAP_DEBUG_NODE, /* Route-map debug node */
AAA_NODE, /* AAA node. */
KEYCHAIN_NODE, /* Key-chain node. */
KEYCHAIN_KEY_NODE, /* Key-chain key node. */
* memory leak or SEGV for things that haven't been well-tested.
*/
+/* This file is "exempt" from having
+#include "config.h"
+ * as the first include statement because Python.h also does environment
+ * setup & these trample over each other.
+ */
+
#include <Python.h>
#include "structmember.h"
#include <string.h>
} while (0)
#endif
+#pragma GCC diagnostic ignored "-Wstrict-aliasing"
PyMODINIT_FUNC command_py_init(void)
{
PyObject *pymod;
#include "memory.h"
#include "linklist.h"
-DEFINE_MTYPE(LIB, FRR_PTHREAD, "FRR POSIX Thread");
-DEFINE_MTYPE(LIB, PTHREAD_PRIM, "POSIX synchronization primitives");
+DEFINE_MTYPE_STATIC(LIB, FRR_PTHREAD, "FRR POSIX Thread")
+DEFINE_MTYPE_STATIC(LIB, PTHREAD_PRIM, "POSIX sync primitives")
/* default frr_pthread start/stop routine prototypes */
static void *fpt_run(void *arg);
extern "C" {
#endif
-DECLARE_MTYPE(FRR_PTHREAD);
-DECLARE_MTYPE(PTHREAD_PRIM);
-
#define OS_THREAD_NAMELEN 16
struct frr_pthread;
* with FRR; see the file COPYING. If not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <stdio.h>
#include <zebra.h>
#include "command.h"
#include "libfrr.h"
-DEFINE_MTYPE(LIB, HASH, "Hash")
-DEFINE_MTYPE(LIB, HASH_BACKET, "Hash Bucket")
+DEFINE_MTYPE_STATIC(LIB, HASH, "Hash")
+DEFINE_MTYPE_STATIC(LIB, HASH_BACKET, "Hash Bucket")
DEFINE_MTYPE_STATIC(LIB, HASH_INDEX, "Hash Index")
static pthread_mutex_t _hashes_mtx = PTHREAD_MUTEX_INITIALIZER;
extern "C" {
#endif
-DECLARE_MTYPE(HASH)
-DECLARE_MTYPE(HASH_BACKET)
-
/* Default hash table size. */
#define HASH_INITIAL_SIZE 256
/* Expansion threshold */
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "id_alloc.h"
#include "log.h"
#include "lib/if_clippy.c"
#endif
-DEFINE_MTYPE(LIB, IF, "Interface")
+DEFINE_MTYPE_STATIC(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")
.nodes = {
{
.xpath = "/frr-interface:lib/interface",
- .cbs.create = lib_interface_create,
- .cbs.destroy = lib_interface_destroy,
- .cbs.cli_show = cli_show_interface,
+ .cbs = {
+ .create = lib_interface_create,
+ .destroy = lib_interface_destroy,
+ .cli_show = cli_show_interface,
+ },
},
{
.xpath = "/frr-interface:lib/interface/description",
- .cbs.modify = lib_interface_description_modify,
- .cbs.destroy = lib_interface_description_destroy,
- .cbs.cli_show = cli_show_interface_desc,
+ .cbs = {
+ .modify = lib_interface_description_modify,
+ .destroy = lib_interface_description_destroy,
+ .cli_show = cli_show_interface_desc,
+ },
},
{
.xpath = NULL,
extern "C" {
#endif
-DECLARE_MTYPE(IF)
DECLARE_MTYPE(CONNECTED_LABEL)
/* Interface link-layer type, if known. Derived from:
}
+/* the array is a trick to make the "MTYPE_FOO" name work as a pointer without
+ * putting a & in front of it, so we can do "XMALLOC(MTYPE_FOO, ...)" instead
+ * of "XMALLOC(&MTYPE_FOO, ...)".
+ */
#define DECLARE_MTYPE(name) \
extern struct memtype _mt_##name; \
- static struct memtype *const MTYPE_##name = &_mt_##name;
+ extern struct memtype MTYPE_##name[1]; \
+ /* end */
#define DEFINE_MTYPE_ATTR(group, mname, attr, desc) \
attr struct memtype _mt_##mname \
if (_mt_##mname.next) \
_mt_##mname.next->ref = _mt_##mname.ref; \
*_mt_##mname.ref = _mt_##mname.next; \
- }
-
-#define DEFINE_MTYPE(group, name, desc) DEFINE_MTYPE_ATTR(group, name, , desc)
+ } \
+ /* end */
+
+/* can't quite get gcc to emit the alias correctly, so asm-alias it is :/ */
+#define DEFINE_MTYPE(group, name, desc) \
+ DEFINE_MTYPE_ATTR(group, name, , desc) \
+ __asm__(".equiv MTYPE_" #name ", _mt_" #name "\n\t" \
+ ".global MTYPE_" #name "\n"); \
+ /* end */
+/* and this one's borked on clang, it drops static on aliases :/, so... asm */
#define DEFINE_MTYPE_STATIC(group, name, desc) \
DEFINE_MTYPE_ATTR(group, name, static, desc) \
- static struct memtype *const MTYPE_##name = &_mt_##name;
+ extern struct memtype MTYPE_##name[1]; \
+ __asm__(".equiv MTYPE_" #name ", _mt_" #name "\n"); \
+ /* end */
DECLARE_MGROUP(LIB)
DECLARE_MTYPE(TMP)
const char *frr_inet_ntop(int af, const void * restrict src,
char * restrict dst, socklen_t size)
- __attribute__((flatten)) DSO_SELF OPTIMIZE;
+ __attribute__((flatten)) OPTIMIZE;
const char *frr_inet_ntop(int af, const void * restrict src,
char * restrict dst, socklen_t size)
* as frr_inet_ntop (to avoid confusion while debugging)
*/
const char *inet_ntop(int af, const void *src, char *dst, socklen_t size)
- __attribute__((alias ("frr_inet_ntop"))) DSO_SELF;
+ __attribute__((alias ("frr_inet_ntop")));
#endif
if (pbest == NULL)
return PREFIX_DENY;
+ pbest->hitcnt++;
return pbest->type;
}
const char *arg,
route_map_event_t type);
- /* match ip next hop type */
+ /* match ip next-hop type */
int (*match_ip_next_hop_type)(struct vty *vty,
struct route_map_index *index,
const char *command,
const char *arg,
route_map_event_t type);
- /* no match ip next hop type */
+ /* no match ip next-hop type */
int (*no_match_ip_next_hop_type)(struct vty *vty,
struct route_map_index *index,
const char *command,
const char *arg,
route_map_event_t type);
- /* no match ipv6next-hop type */
+ /* no match ipv6 next-hop type */
int (*no_match_ipv6_next_hop_type)(struct vty *vty,
struct route_map_index *index,
const char *command, const char *arg,
rmap_match_set_hook.no_match_ip_next_hop_prefix_list = func;
}
-/* match ip next hop type */
+/* match ip next-hop type */
void route_map_match_ip_next_hop_type_hook(int (*func)(
struct vty *vty, struct route_map_index *index, const char *command,
const char *arg, route_map_event_t type))
rmap_match_set_hook.match_ip_next_hop_type = func;
}
-/* no match ip next hop type */
+/* no match ip next-hop type */
void route_map_no_match_ip_next_hop_type_hook(int (*func)(
struct vty *vty, struct route_map_index *index, const char *command,
const char *arg, route_map_event_t type))
static void route_map_clear_all_references(char *rmap_name);
static void route_map_rule_delete(struct route_map_rule_list *,
struct route_map_rule *);
-static int rmap_debug = 0;
+static bool rmap_debug;
static void route_map_index_delete(struct route_map_index *, int);
(*route_map_master.add_hook)(name);
route_map_notify_dependencies(name, RMAP_EVENT_CALL_ADDED);
}
+
+ if (rmap_debug)
+ zlog_debug("Add route-map %s", name);
return map;
}
while ((index = map->head) != NULL)
route_map_index_delete(index, 0);
+ if (rmap_debug)
+ zlog_debug("Deleting route-map %s", map->name);
+
list = &route_map_master;
QOBJ_UNREG(map);
return "";
}
+static const char *route_map_result_str(route_map_result_t res)
+{
+ switch (res) {
+ case RMAP_MATCH:
+ return "match";
+ case RMAP_DENYMATCH:
+ return "deny";
+ case RMAP_NOMATCH:
+ return "no match";
+ case RMAP_ERROR:
+ return "error";
+ case RMAP_OKAY:
+ return "okay";
+ }
+
+ return "invalid";
+}
+
static int route_map_empty(struct route_map *map)
{
if (map->head == NULL && map->tail == NULL)
QOBJ_UNREG(index);
+ if (rmap_debug)
+ zlog_debug("Deleting route-map %s sequence %d",
+ index->map->name, index->pref);
+
/* Free route match. */
while ((rule = index->match_list.head) != NULL)
route_map_rule_delete(&index->match_list, rule);
(*route_map_master.event_hook)(map->name);
route_map_notify_dependencies(map->name, RMAP_EVENT_CALL_ADDED);
}
+
+ if (rmap_debug)
+ zlog_debug("Route-map %s add sequence %d, type: %s",
+ map->name, pref, route_map_type_str(type));
+
return index;
}
int ret = 0;
struct route_map_index *index;
struct route_map_rule *set;
+ char buf[PREFIX_STRLEN];
if (recursion > RMAP_RECURSION_LIMIT) {
flog_warn(
return RMAP_DENYMATCH;
}
- if (map == NULL)
- return RMAP_DENYMATCH;
+ if (map == NULL) {
+ ret = RMAP_DENYMATCH;
+ goto route_map_apply_end;
+ }
map->applied++;
for (index = map->head; index; index = index->next) {
ret = route_map_apply_match(&index->match_list, prefix, type,
object);
+ if (rmap_debug) {
+ zlog_debug("Route-map: %s, sequence: %d, prefix: %s, result: %s",
+ map->name, index->pref,
+ prefix2str(prefix, buf, sizeof(buf)),
+ route_map_result_str(ret));
+ }
+
/* Now we apply the matrix from above */
if (ret == RMAP_NOMATCH)
/* 'cont' from matrix - continue to next route-map
/* If nextrm returned 'deny', finish. */
if (ret == RMAP_DENYMATCH)
- return ret;
+ goto route_map_apply_end;
}
switch (index->exitpolicy) {
case RMAP_EXIT:
- return ret;
+ goto route_map_apply_end;
case RMAP_NEXT:
continue;
case RMAP_GOTO: {
}
if (next == NULL) {
/* No clauses match! */
- return ret;
+ goto route_map_apply_end;
}
}
}
} else if (index->type == RMAP_DENY)
/* 'deny' */
{
- return RMAP_DENYMATCH;
+ ret = RMAP_DENYMATCH;
+ goto route_map_apply_end;
}
}
}
/* Finally route-map does not match at all. */
- return RMAP_DENYMATCH;
+ ret = RMAP_DENYMATCH;
+
+route_map_apply_end:
+ if (rmap_debug) {
+ zlog_debug("Route-map: %s, prefix: %s, result: %s",
+ (map ? map->name : "null"),
+ prefix2str(prefix, buf, sizeof(buf)),
+ route_map_result_str(ret));
+ }
+
+ return (ret);
}
void route_map_add_hook(void (*func)(const char *))
case RMAP_EVENT_CALL_ADDED:
case RMAP_EVENT_FILTER_ADDED:
if (rmap_debug)
- zlog_debug("%s: Adding dependency for %s in %s",
- __FUNCTION__, dep_name, rmap_name);
+ zlog_debug("Adding dependency for filter %s in route-map %s",
+ dep_name, rmap_name);
dep = (struct route_map_dep *)hash_get(
dephash, dname, route_map_dep_hash_alloc);
if (!dep) {
case RMAP_EVENT_CALL_DELETED:
case RMAP_EVENT_FILTER_DELETED:
if (rmap_debug)
- zlog_debug("%s: Deleting dependency for %s in %s",
- __FUNCTION__, dep_name, rmap_name);
+ zlog_debug("Deleting dependency for filter %s in route-map %s",
+ dep_name, rmap_name);
dep = (struct route_map_dep *)hash_get(dephash, dname, NULL);
if (!dep) {
goto out;
rmap_name = dep_data->rname;
if (rmap_debug)
- zlog_debug("%s: Notifying %s of dependency",
- __FUNCTION__, rmap_name);
+ zlog_debug("Notifying %s of dependency", rmap_name);
if (route_map_master.event_hook)
(*route_map_master.event_hook)(rmap_name);
}
if (!dep->this_hash)
dep->this_hash = upd8_hash;
+ if (rmap_debug)
+ zlog_debug("Filter %s updated", dep->dep_name);
hash_iterate(dep->dep_rmap_hash, route_map_process_dependency,
(void *)event);
}
DEFUN(match_ipv6_next_hop_type, match_ipv6_next_hop_type_cmd,
"match ipv6 next-hop type <blackhole>",
MATCH_STR IPV6_STR
- "Match address of route\n"
+ "Match next-hop address of route\n"
"Match entries by type\n"
"Blackhole\n")
{
return CMD_SUCCESS;
}
+DEFUN (debug_rmap,
+ debug_rmap_cmd,
+ "debug route-map",
+ DEBUG_STR
+ "Debug option set for route-maps\n")
+{
+ rmap_debug = true;
+ return CMD_SUCCESS;
+}
+
+DEFUN (no_debug_rmap,
+ no_debug_rmap_cmd,
+ "no debug route-map",
+ NO_STR
+ DEBUG_STR
+ "Debug option set for route-maps\n")
+{
+ rmap_debug = false;
+ return CMD_SUCCESS;
+}
+
+/* Debug node. */
+static struct cmd_node rmap_debug_node = {RMAP_DEBUG_NODE, "", 1};
+
/* Configuration write function. */
static int route_map_config_write(struct vty *vty)
{
return write;
}
+static int rmap_config_write_debug(struct vty *vty)
+{
+ int write = 0;
+
+ if (rmap_debug) {
+ vty_out(vty, "debug route-map\n");
+ write++;
+ }
+
+ return write;
+}
+
/* Route map node structure. */
static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# ", 1};
cmd_variable_handler_register(rmap_var_handlers);
+ rmap_debug = false;
+
/* Install route map top node. */
install_node(&rmap_node, route_map_config_write);
+ install_node(&rmap_debug_node, rmap_config_write_debug);
+
/* Install route map commands. */
install_default(RMAP_NODE);
install_element(CONFIG_NODE, &route_map_cmd);
install_element(CONFIG_NODE, &no_route_map_cmd);
install_element(CONFIG_NODE, &no_route_map_all_cmd);
+ install_element(CONFIG_NODE, &debug_rmap_cmd);
+ install_element(CONFIG_NODE, &no_debug_rmap_cmd);
+
/* Install the on-match stuff */
install_element(RMAP_NODE, &route_map_cmd);
install_element(RMAP_NODE, &rmap_onmatch_next_cmd);
install_element(ENABLE_NODE, &rmap_show_name_cmd);
install_element(ENABLE_NODE, &rmap_show_unused_cmd);
+ install_element(ENABLE_NODE, &debug_rmap_cmd);
+ install_element(ENABLE_NODE, &no_debug_rmap_cmd);
+
install_element(RMAP_NODE, &match_interface_cmd);
install_element(RMAP_NODE, &no_match_interface_cmd);
#include "memory.h"
#include "sockunion.h"
-DEFINE_MTYPE(LIB, ROUTE_TABLE, "Route table")
+DEFINE_MTYPE_STATIC(LIB, ROUTE_TABLE, "Route table")
DEFINE_MTYPE(LIB, ROUTE_NODE, "Route node")
static void route_table_free(struct route_table *);
extern "C" {
#endif
-DECLARE_MTYPE(ROUTE_TABLE)
DECLARE_MTYPE(ROUTE_NODE)
/*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "typerb.h"
#define RB_BLACK 0
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdlib.h>
#include <string.h>
#include <libyang/user_types.h>
-DEFINE_MTYPE(LIB, YANG_MODULE, "YANG module")
-DEFINE_MTYPE(LIB, YANG_DATA, "YANG data structure")
+DEFINE_MTYPE_STATIC(LIB, YANG_MODULE, "YANG module")
+DEFINE_MTYPE_STATIC(LIB, YANG_DATA, "YANG data structure")
/* libyang container. */
struct ly_ctx *ly_native_ctx;
extern "C" {
#endif
-DECLARE_MTYPE(YANG_MODULE)
-DECLARE_MTYPE(YANG_DATA)
-
/* Maximum XPath length. */
#define XPATH_MAXLEN 256
route_match_ip_next_hop_prefix_list_compile,
route_match_ip_next_hop_prefix_list_free};
+/* `match ip next-hop type <blackhole>' */
+
+static route_map_result_t
+route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
+{
+ struct external_info *ei = object;
+
+ if (type == RMAP_OSPF && prefix->family == AF_INET) {
+ ei = (struct external_info *)object;
+ if (!ei)
+ return RMAP_DENYMATCH;
+
+ if (ei->nexthop.s_addr == INADDR_ANY && !ei->ifindex)
+ return RMAP_MATCH;
+ }
+ return RMAP_NOMATCH;
+}
+
+static void *route_match_ip_next_hop_type_compile(const char *arg)
+{
+ return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
+}
+
+static void route_match_ip_next_hop_type_free(void *rule)
+{
+ XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
+}
+
+static struct route_map_rule_cmd route_match_ip_next_hop_type_cmd = {
+ "ip next-hop type", route_match_ip_next_hop_type,
+ route_match_ip_next_hop_type_compile,
+ route_match_ip_next_hop_type_free};
+
/* `match ip address IP_ACCESS_LIST' */
/* Match function should return 1 if match is success else return
zero. */
route_map_match_ip_next_hop_prefix_list_hook(generic_match_add);
route_map_no_match_ip_next_hop_prefix_list_hook(generic_match_delete);
+ route_map_match_ip_next_hop_type_hook(generic_match_add);
+ route_map_no_match_ip_next_hop_type_hook(generic_match_delete);
+
route_map_match_tag_hook(generic_match_add);
route_map_no_match_tag_hook(generic_match_delete);
route_map_install_match(&route_match_ip_next_hop_prefix_list_cmd);
route_map_install_match(&route_match_ip_address_cmd);
route_map_install_match(&route_match_ip_address_prefix_list_cmd);
+ route_map_install_match(&route_match_ip_next_hop_type_cmd);
route_map_install_match(&route_match_interface_cmd);
route_map_install_match(&route_match_tag_cmd);
"Invalid LSA link type %d", type);
continue;
}
+
+ /* step (d) below */
+ distance = v->distance + ntohs(l->m[0].metric);
} else {
/* In case of V is Network-LSA. */
r = (struct in_addr *)p;
zlog_debug("found Router LSA %s",
inet_ntoa(w_lsa->data->id));
}
+
+ /* step (d) below */
+ distance = v->distance;
}
/* (b cont.) If the LSA does not exist, or its LS age is equal
vertex V and the advertised cost of the link between vertices
V and W. If D is: */
- /* calculate link cost D. */
- if (v->lsa->type == OSPF_ROUTER_LSA)
- distance = v->distance + ntohs(l->m[0].metric);
- else /* v is not a Router-LSA */
- distance = v->distance;
+ /* calculate link cost D -- moved above */
/* Is there already vertex W in candidate list? */
if (w_lsa->stat == LSA_SPF_NOT_EXPLORED) {
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "if.h"
#include "pimd.h"
#include "pim_iface.h"
ch = THREAD_ARG(t);
+ if (PIM_DEBUG_TRACE)
+ zlog_debug("%s: ifchannel %s expiry timer", __PRETTY_FUNCTION__,
+ ch->sg_str);
+
ifjoin_to_noinfo(ch, true);
/* ch may have been deleted */
static void source_channel_oil_detach(struct igmp_source *source)
{
if (source->source_channel_oil) {
- pim_channel_oil_del(source->source_channel_oil);
+ pim_channel_oil_del(source->source_channel_oil,
+ __PRETTY_FUNCTION__);
source->source_channel_oil = NULL;
}
}
* and causing us to consider them.
*/
c_oil = pim_channel_oil_add(pim_ifp->pim, &sg,
- pim_ifp->mroute_vif_index);
+ pim_ifp->mroute_vif_index,
+ __PRETTY_FUNCTION__);
pim_mroute_add(c_oil, __PRETTY_FUNCTION__);
return 0;
if (!up->channel_oil)
up->channel_oil = pim_channel_oil_add(
pim_ifp->pim, &sg,
- pim_ifp->mroute_vif_index);
+ pim_ifp->mroute_vif_index,
+ __PRETTY_FUNCTION__);
pim_upstream_inherited_olist(pim_ifp->pim, up);
if (!up->channel_oil->installed)
pim_mroute_add(up->channel_oil,
}
pim_ifp = ifp->info;
- oil = pim_channel_oil_add(pim_ifp->pim, &sg, pim_ifp->mroute_vif_index);
+ oil = pim_channel_oil_add(pim_ifp->pim, &sg, pim_ifp->mroute_vif_index,
+ __PRETTY_FUNCTION__);
if (!oil->installed)
pim_mroute_add(oil, __PRETTY_FUNCTION__);
if (pim_if_connected_to_source(ifp, sg.src)) {
struct in_addr addr;
} __attribute__((packed));
+/*
+ * Encoded Group format. RFC 4601 Sec 4.9.1
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Addr Family | Encoding Type |B| Reserved |Z| Mask Len |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Group multicast Address
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...
+ */
struct pim_encoded_group_ipv4 {
- uint8_t ne;
uint8_t family;
+ uint8_t ne;
uint8_t bidir : 1; /* Bidir bit */
uint8_t reserved : 6; /* Reserved */
uint8_t sz : 1; /* scope zone bit */
struct in_addr addr;
} __attribute__((packed));
+
+/*
+ * Encoded Source format. RFC 4601 Sec 4.9.1
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Addr Family | Encoding Type | Rsrvd |S|W|R| Mask Len |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Source Address
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...
+ */
struct pim_encoded_source_ipv4 {
- uint8_t ne;
uint8_t family;
+ uint8_t ne;
uint8_t bits;
uint8_t mask;
struct in_addr addr;
char *pim_channel_oil_dump(struct channel_oil *c_oil, char *buf, size_t size)
{
char *out;
+ struct interface *ifp;
struct prefix_sg sg;
int i;
sg.src = c_oil->oil.mfcc_origin;
sg.grp = c_oil->oil.mfcc_mcastgrp;
- snprintf(buf, size, "%s IIF: %d, OIFS: ", pim_str_sg_dump(&sg),
- c_oil->oil.mfcc_parent);
+ ifp = pim_if_find_by_vif_index(c_oil->pim, c_oil->oil.mfcc_parent);
+ snprintf(buf, size, "%s IIF: %s, OIFS: ", pim_str_sg_dump(&sg),
+ ifp ? ifp->name : "(?)");
out = buf + strlen(buf);
for (i = 0; i < MAXVIFS; i++) {
if (c_oil->oil.mfcc_ttls[i] != 0) {
- snprintf(out, buf + size - out, "%d ", i);
+ ifp = pim_if_find_by_vif_index(c_oil->pim, i);
+ snprintf(out, buf + size - out, "%s ",
+ ifp ? ifp->name : "(?)");
out += strlen(out);
}
}
struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
struct prefix_sg *sg,
- int input_vif_index)
+ int input_vif_index, const char *name)
{
struct channel_oil *c_oil;
struct interface *ifp;
if (c_oil) {
if (c_oil->oil.mfcc_parent != input_vif_index) {
c_oil->oil_inherited_rescan = 1;
- if (PIM_DEBUG_MROUTE)
+ if (PIM_DEBUG_MROUTE_DETAIL)
zlog_debug(
- "%s: Existing channel oil %s points to %d, modifying to point at %d",
- __PRETTY_FUNCTION__,
- pim_str_sg_dump(sg),
+ "%s: Existing channel oil %pSG4 points to %d, modifying to point at %d",
+ __PRETTY_FUNCTION__, sg,
c_oil->oil.mfcc_parent,
input_vif_index);
}
c_oil->oil.mfcc_parent = input_vif_index;
++c_oil->oil_ref_count;
- c_oil->up = pim_upstream_find(
- pim, sg); // channel might be present prior to upstream
+ /* channel might be present prior to upstream */
+ c_oil->up = pim_upstream_find(pim, sg);
+
+ if (PIM_DEBUG_MROUTE)
+ zlog_debug(
+ "%s(%s): Existing oil for %pSG4 Ref Count: %d (Post Increment)",
+ __PRETTY_FUNCTION__, name, sg,
+ c_oil->oil_ref_count);
return c_oil;
}
if (!ifp) {
/* warning only */
zlog_warn(
- "%s: (S,G)=%s could not find input interface for input_vif_index=%d",
- __PRETTY_FUNCTION__, pim_str_sg_dump(sg),
- input_vif_index);
+ "%s:%s (S,G)=%pSG4 could not find input interface for input_vif_index=%d",
+ __PRETTY_FUNCTION__, name, sg, input_vif_index);
}
}
listnode_add_sort(pim->channel_oil_list, c_oil);
+ if (PIM_DEBUG_MROUTE)
+ zlog_debug(
+ "%s(%s): New oil for %pSG4 vif_index: %d Ref Count: 1 (Post Increment)",
+ __PRETTY_FUNCTION__, name, sg, input_vif_index);
return c_oil;
}
-void pim_channel_oil_del(struct channel_oil *c_oil)
+void pim_channel_oil_del(struct channel_oil *c_oil, const char *name)
{
+ if (PIM_DEBUG_MROUTE) {
+ struct prefix_sg sg = {.src = c_oil->oil.mfcc_mcastgrp,
+ .grp = c_oil->oil.mfcc_origin};
+
+ zlog_debug(
+ "%s(%s): Del oil for %pSG4, Ref Count: %d (Predecrement)",
+ __PRETTY_FUNCTION__, name, &sg, c_oil->oil_ref_count);
+ }
--c_oil->oil_ref_count;
if (c_oil->oil_ref_count < 1) {
IGMP must be protected against adding looped MFC entries created
by both source and receiver attached to the same interface. See
TODO T22.
+ We shall allow igmp to create upstream when it is DR for the intf.
+ Assume RP reachable via non DR.
*/
- if (channel_oil->up &&
- PIM_UPSTREAM_FLAG_TEST_ALLOW_IIF_IN_OIL(
- channel_oil->up->flags)) {
+ if ((channel_oil->up &&
+ PIM_UPSTREAM_FLAG_TEST_ALLOW_IIF_IN_OIL(channel_oil->up->flags)) ||
+ ((proto_mask == PIM_OIF_FLAG_PROTO_IGMP) && PIM_I_am_DR(pim_ifp))) {
allow_iif_in_oil = true;
}
struct prefix_sg *sg);
struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
struct prefix_sg *sg,
- int input_vif_index);
-void pim_channel_oil_del(struct channel_oil *c_oil);
+ int input_vif_index, const char *name);
+void pim_channel_oil_del(struct channel_oil *c_oil, const char *name);
int pim_channel_add_oif(struct channel_oil *c_oil, struct interface *oif,
uint32_t proto_mask);
but upstream would not keep reference of it
*/
up->channel_oil->up = NULL;
- pim_channel_oil_del(up->channel_oil);
+ pim_channel_oil_del(up->channel_oil, __PRETTY_FUNCTION__);
up->channel_oil = NULL;
}
}
pim_upstream_fill_static_iif(up, incoming);
pim_ifp = up->rpf.source_nexthop.interface->info;
assert(pim_ifp);
- up->channel_oil = pim_channel_oil_add(pim,
- &up->sg, pim_ifp->mroute_vif_index);
+ up->channel_oil = pim_channel_oil_add(pim, &up->sg,
+ pim_ifp->mroute_vif_index,
+ __PRETTY_FUNCTION__);
} else if (up->upstream_addr.s_addr == INADDR_ANY) {
/* Create a dummmy channel oil with incoming ineterface MAXVIFS,
* since RP is not configured
*/
- up->channel_oil = pim_channel_oil_add(pim, &up->sg, MAXVIFS);
+ up->channel_oil = pim_channel_oil_add(pim, &up->sg, MAXVIFS,
+ __PRETTY_FUNCTION__);
} else {
rpf_result = pim_rpf_update(pim, up, NULL);
* MAXVIFS, since RP is not reachable
*/
up->channel_oil = pim_channel_oil_add(
- pim, &up->sg, MAXVIFS);
+ pim, &up->sg, MAXVIFS, __PRETTY_FUNCTION__);
}
if (up->rpf.source_nexthop.interface) {
pim_ifp = up->rpf.source_nexthop.interface->info;
if (pim_ifp)
- up->channel_oil = pim_channel_oil_add(pim,
- &up->sg, pim_ifp->mroute_vif_index);
+ up->channel_oil = pim_channel_oil_add(
+ pim, &up->sg, pim_ifp->mroute_vif_index,
+ __PRETTY_FUNCTION__);
}
}
__PRETTY_FUNCTION__, up->sg_str);
}
if (pim_ifp && !up->channel_oil)
- up->channel_oil = pim_channel_oil_add(
- pim, &up->sg, pim_ifp->mroute_vif_index);
+ up->channel_oil = pim_channel_oil_add(pim, &up->sg,
+ pim_ifp->mroute_vif_index,
+ __PRETTY_FUNCTION__);
FOR_ALL_INTERFACES (pim->vrf, ifp) {
if (!ifp->info)
vty_out(vty, "debug igmp trace\n");
++writes;
}
- if (PIM_DEBUG_IGMP_TRACE_DETAIL) {
- vty_out(vty, "debug igmp trace detail\n");
- ++writes;
- }
if (PIM_DEBUG_MROUTE) {
vty_out(vty, "debug mroute\n");
if (!pim_rp_set_upstream_addr(pim, &vif_source,
source->source_addr, sg.grp)) {
/*Create a dummy channel oil */
- source->source_channel_oil =
- pim_channel_oil_add(pim, &sg, MAXVIFS);
+ source->source_channel_oil = pim_channel_oil_add(
+ pim, &sg, MAXVIFS, __PRETTY_FUNCTION__);
if (!source->source_channel_oil) {
if (PIM_DEBUG_IGMP_TRACE) {
source_str);
}
source->source_channel_oil =
- pim_channel_oil_add(pim, &sg, MAXVIFS);
+ pim_channel_oil_add(
+ pim, &sg, MAXVIFS,
+ __PRETTY_FUNCTION__);
}
else {
* Protect IGMP against adding looped MFC
* entries created by both source and receiver
* attached to the same interface. See TODO
- * T22.
+ * T22. Block only when the intf is non DR
+ * DR must create upstream.
*/
- if (input_iface_vif_index ==
- pim_oif->mroute_vif_index) {
+ if ((input_iface_vif_index ==
+ pim_oif->mroute_vif_index) &&
+ !(PIM_I_am_DR(pim_oif))) {
/* ignore request for looped MFC entry
*/
if (PIM_DEBUG_IGMP_TRACE) {
}
source->source_channel_oil =
- pim_channel_oil_add(pim, &sg,
- input_iface_vif_index);
+ pim_channel_oil_add(
+ pim, &sg, input_iface_vif_index,
+ __PRETTY_FUNCTION__);
if (!source->source_channel_oil) {
if (PIM_DEBUG_IGMP_TRACE) {
zlog_debug(
__FILE__, __PRETTY_FUNCTION__,
source_str);
}
- up->channel_oil = pim_channel_oil_add(pim, &up->sg,
- MAXVIFS);
+ up->channel_oil = pim_channel_oil_add(
+ pim, &up->sg, MAXVIFS, __PRETTY_FUNCTION__);
}
else {
- up->channel_oil = pim_channel_oil_add(pim, &up->sg,
- input_iface_vif_index);
+ up->channel_oil = pim_channel_oil_add(
+ pim, &up->sg, input_iface_vif_index,
+ __PRETTY_FUNCTION__);
if (!up->channel_oil) {
if (PIM_DEBUG_PIM_TRACE)
zlog_debug(
input_iface_vif_index, up->sg_str);
}
- up->channel_oil = pim_channel_oil_add(pim, &up->sg,
- input_iface_vif_index);
+ up->channel_oil =
+ pim_channel_oil_add(pim, &up->sg, input_iface_vif_index,
+ __PRETTY_FUNCTION__);
if (!up->channel_oil) {
if (PIM_DEBUG_PIM_TRACE)
zlog_debug(
#include "ripd/rip_debug.h"
#include "ripd/rip_interface.h"
+DEFINE_MTYPE_STATIC(RIPD, RIP_INTERFACE, "RIP interface")
+DEFINE_MTYPE(RIPD, RIP_INTERFACE_STRING, "RIP Interface String")
DEFINE_HOOK(rip_ifaddr_add, (struct connected * ifc), (ifc))
DEFINE_HOOK(rip_ifaddr_del, (struct connected * ifc), (ifc))
#ifndef _QUAGGA_RIP_INTERFACE_H
#define _QUAGGA_RIP_INTERFACE_H
+#include "memory.h"
#include "zclient.h"
+DECLARE_MTYPE(RIP_INTERFACE_STRING)
+
extern int rip_interface_down(int, struct zclient *, zebra_size_t, vrf_id_t);
extern int rip_interface_up(int, struct zclient *, zebra_size_t, vrf_id_t);
extern int rip_interface_add(int, struct zclient *, zebra_size_t, vrf_id_t);
+++ /dev/null
-/* ripd 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 this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "rip_memory.h"
-
-DEFINE_MGROUP(RIPD, "ripd")
-DEFINE_MTYPE(RIPD, RIP, "RIP structure")
-DEFINE_MTYPE(RIPD, RIP_VRF_NAME, "RIP VRF name")
-DEFINE_MTYPE(RIPD, RIP_INFO, "RIP route info")
-DEFINE_MTYPE(RIPD, RIP_INTERFACE, "RIP interface")
-DEFINE_MTYPE(RIPD, RIP_INTERFACE_STRING, "RIP Interface String")
-DEFINE_MTYPE(RIPD, RIP_PEER, "RIP peer")
-DEFINE_MTYPE(RIPD, RIP_OFFSET_LIST, "RIP offset list")
-DEFINE_MTYPE(RIPD, RIP_DISTANCE, "RIP distance")
+++ /dev/null
-/* ripd 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 this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef _QUAGGA_RIP_MEMORY_H
-#define _QUAGGA_RIP_MEMORY_H
-
-#include "memory.h"
-
-DECLARE_MGROUP(RIPD)
-DECLARE_MTYPE(RIP)
-DECLARE_MTYPE(RIP_VRF_NAME)
-DECLARE_MTYPE(RIP_INFO)
-DECLARE_MTYPE(RIP_INTERFACE)
-DECLARE_MTYPE(RIP_INTERFACE_STRING)
-DECLARE_MTYPE(RIP_PEER)
-DECLARE_MTYPE(RIP_OFFSET_LIST)
-DECLARE_MTYPE(RIP_DISTANCE)
-
-#endif /* _QUAGGA_RIP_MEMORY_H */
#include "ripd/ripd.h"
#include "ripd/rip_debug.h"
#include "ripd/rip_cli.h"
+#include "ripd/rip_interface.h"
/*
* XPath: /frr-ripd:ripd/instance
static const void *ripd_instance_get_next(const void *parent_list_entry,
const void *list_entry)
{
- const struct rip *rip = list_entry;
+ struct rip *rip = (struct rip *)list_entry;
if (list_entry == NULL)
rip = RB_MIN(rip_instance_head, &rip_instances);
else
- rip = RB_NEXT(rip_instance_head, (struct rip *)rip);
+ rip = RB_NEXT(rip_instance_head, rip);
return rip;
}
.nodes = {
{
.xpath = "/frr-ripd:ripd/instance",
- .cbs.create = ripd_instance_create,
- .cbs.destroy = ripd_instance_destroy,
- .cbs.get_next = ripd_instance_get_next,
- .cbs.get_keys = ripd_instance_get_keys,
- .cbs.lookup_entry = ripd_instance_lookup_entry,
- .cbs.cli_show = cli_show_router_rip,
+ .cbs = {
+ .cli_show = cli_show_router_rip,
+ .create = ripd_instance_create,
+ .destroy = ripd_instance_destroy,
+ .get_keys = ripd_instance_get_keys,
+ .get_next = ripd_instance_get_next,
+ .lookup_entry = ripd_instance_lookup_entry,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/allow-ecmp",
- .cbs.modify = ripd_instance_allow_ecmp_modify,
- .cbs.cli_show = cli_show_rip_allow_ecmp,
+ .cbs = {
+ .cli_show = cli_show_rip_allow_ecmp,
+ .modify = ripd_instance_allow_ecmp_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/default-information-originate",
- .cbs.modify = ripd_instance_default_information_originate_modify,
- .cbs.cli_show = cli_show_rip_default_information_originate,
+ .cbs = {
+ .cli_show = cli_show_rip_default_information_originate,
+ .modify = ripd_instance_default_information_originate_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/default-metric",
- .cbs.modify = ripd_instance_default_metric_modify,
- .cbs.cli_show = cli_show_rip_default_metric,
+ .cbs = {
+ .cli_show = cli_show_rip_default_metric,
+ .modify = ripd_instance_default_metric_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/distance/default",
- .cbs.modify = ripd_instance_distance_default_modify,
- .cbs.cli_show = cli_show_rip_distance,
+ .cbs = {
+ .cli_show = cli_show_rip_distance,
+ .modify = ripd_instance_distance_default_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/distance/source",
- .cbs.create = ripd_instance_distance_source_create,
- .cbs.destroy = ripd_instance_distance_source_destroy,
- .cbs.cli_show = cli_show_rip_distance_source,
+ .cbs = {
+ .cli_show = cli_show_rip_distance_source,
+ .create = ripd_instance_distance_source_create,
+ .destroy = ripd_instance_distance_source_destroy,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/distance/source/distance",
- .cbs.modify = ripd_instance_distance_source_distance_modify,
+ .cbs = {
+ .modify = ripd_instance_distance_source_distance_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/distance/source/access-list",
- .cbs.modify = ripd_instance_distance_source_access_list_modify,
- .cbs.destroy = ripd_instance_distance_source_access_list_destroy,
+ .cbs = {
+ .destroy = ripd_instance_distance_source_access_list_destroy,
+ .modify = ripd_instance_distance_source_access_list_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/explicit-neighbor",
- .cbs.create = ripd_instance_explicit_neighbor_create,
- .cbs.destroy = ripd_instance_explicit_neighbor_destroy,
- .cbs.cli_show = cli_show_rip_neighbor,
+ .cbs = {
+ .cli_show = cli_show_rip_neighbor,
+ .create = ripd_instance_explicit_neighbor_create,
+ .destroy = ripd_instance_explicit_neighbor_destroy,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/network",
- .cbs.create = ripd_instance_network_create,
- .cbs.destroy = ripd_instance_network_destroy,
- .cbs.cli_show = cli_show_rip_network_prefix,
+ .cbs = {
+ .cli_show = cli_show_rip_network_prefix,
+ .create = ripd_instance_network_create,
+ .destroy = ripd_instance_network_destroy,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/interface",
- .cbs.create = ripd_instance_interface_create,
- .cbs.destroy = ripd_instance_interface_destroy,
- .cbs.cli_show = cli_show_rip_network_interface,
+ .cbs = {
+ .cli_show = cli_show_rip_network_interface,
+ .create = ripd_instance_interface_create,
+ .destroy = ripd_instance_interface_destroy,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/offset-list",
- .cbs.create = ripd_instance_offset_list_create,
- .cbs.destroy = ripd_instance_offset_list_destroy,
- .cbs.cli_show = cli_show_rip_offset_list,
+ .cbs = {
+ .cli_show = cli_show_rip_offset_list,
+ .create = ripd_instance_offset_list_create,
+ .destroy = ripd_instance_offset_list_destroy,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/offset-list/access-list",
- .cbs.modify = ripd_instance_offset_list_access_list_modify,
+ .cbs = {
+ .modify = ripd_instance_offset_list_access_list_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/offset-list/metric",
- .cbs.modify = ripd_instance_offset_list_metric_modify,
+ .cbs = {
+ .modify = ripd_instance_offset_list_metric_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/passive-default",
- .cbs.modify = ripd_instance_passive_default_modify,
- .cbs.cli_show = cli_show_rip_passive_default,
+ .cbs = {
+ .cli_show = cli_show_rip_passive_default,
+ .modify = ripd_instance_passive_default_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/passive-interface",
- .cbs.create = ripd_instance_passive_interface_create,
- .cbs.destroy = ripd_instance_passive_interface_destroy,
- .cbs.cli_show = cli_show_rip_passive_interface,
+ .cbs = {
+ .cli_show = cli_show_rip_passive_interface,
+ .create = ripd_instance_passive_interface_create,
+ .destroy = ripd_instance_passive_interface_destroy,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/non-passive-interface",
- .cbs.create = ripd_instance_non_passive_interface_create,
- .cbs.destroy = ripd_instance_non_passive_interface_destroy,
- .cbs.cli_show = cli_show_rip_non_passive_interface,
+ .cbs = {
+ .cli_show = cli_show_rip_non_passive_interface,
+ .create = ripd_instance_non_passive_interface_create,
+ .destroy = ripd_instance_non_passive_interface_destroy,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/redistribute",
- .cbs.create = ripd_instance_redistribute_create,
- .cbs.destroy = ripd_instance_redistribute_destroy,
- .cbs.apply_finish = ripd_instance_redistribute_apply_finish,
- .cbs.cli_show = cli_show_rip_redistribute,
+ .cbs = {
+ .apply_finish = ripd_instance_redistribute_apply_finish,
+ .cli_show = cli_show_rip_redistribute,
+ .create = ripd_instance_redistribute_create,
+ .destroy = ripd_instance_redistribute_destroy,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/redistribute/route-map",
- .cbs.modify = ripd_instance_redistribute_route_map_modify,
- .cbs.destroy = ripd_instance_redistribute_route_map_destroy,
+ .cbs = {
+ .destroy = ripd_instance_redistribute_route_map_destroy,
+ .modify = ripd_instance_redistribute_route_map_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/redistribute/metric",
- .cbs.modify = ripd_instance_redistribute_metric_modify,
- .cbs.destroy = ripd_instance_redistribute_metric_destroy,
+ .cbs = {
+ .destroy = ripd_instance_redistribute_metric_destroy,
+ .modify = ripd_instance_redistribute_metric_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/static-route",
- .cbs.create = ripd_instance_static_route_create,
- .cbs.destroy = ripd_instance_static_route_destroy,
- .cbs.cli_show = cli_show_rip_route,
+ .cbs = {
+ .cli_show = cli_show_rip_route,
+ .create = ripd_instance_static_route_create,
+ .destroy = ripd_instance_static_route_destroy,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/timers",
- .cbs.apply_finish = ripd_instance_timers_apply_finish,
- .cbs.cli_show = cli_show_rip_timers,
+ .cbs = {
+ .apply_finish = ripd_instance_timers_apply_finish,
+ .cli_show = cli_show_rip_timers,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/timers/flush-interval",
- .cbs.modify = ripd_instance_timers_flush_interval_modify,
+ .cbs = {
+ .modify = ripd_instance_timers_flush_interval_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/timers/holddown-interval",
- .cbs.modify = ripd_instance_timers_holddown_interval_modify,
+ .cbs = {
+ .modify = ripd_instance_timers_holddown_interval_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/timers/update-interval",
- .cbs.modify = ripd_instance_timers_update_interval_modify,
+ .cbs = {
+ .modify = ripd_instance_timers_update_interval_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/version",
- .cbs.cli_show = cli_show_rip_version,
+ .cbs = {
+ .cli_show = cli_show_rip_version,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/version/receive",
- .cbs.modify = ripd_instance_version_receive_modify,
+ .cbs = {
+ .modify = ripd_instance_version_receive_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/version/send",
- .cbs.modify = ripd_instance_version_send_modify,
+ .cbs = {
+ .modify = ripd_instance_version_send_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-ripd:rip/split-horizon",
- .cbs.modify = lib_interface_rip_split_horizon_modify,
- .cbs.cli_show = cli_show_ip_rip_split_horizon,
+ .cbs = {
+ .cli_show = cli_show_ip_rip_split_horizon,
+ .modify = lib_interface_rip_split_horizon_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-ripd:rip/v2-broadcast",
- .cbs.modify = lib_interface_rip_v2_broadcast_modify,
- .cbs.cli_show = cli_show_ip_rip_v2_broadcast,
+ .cbs = {
+ .cli_show = cli_show_ip_rip_v2_broadcast,
+ .modify = lib_interface_rip_v2_broadcast_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-ripd:rip/version-receive",
- .cbs.modify = lib_interface_rip_version_receive_modify,
- .cbs.cli_show = cli_show_ip_rip_receive_version,
+ .cbs = {
+ .cli_show = cli_show_ip_rip_receive_version,
+ .modify = lib_interface_rip_version_receive_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-ripd:rip/version-send",
- .cbs.modify = lib_interface_rip_version_send_modify,
- .cbs.cli_show = cli_show_ip_rip_send_version,
+ .cbs = {
+ .cli_show = cli_show_ip_rip_send_version,
+ .modify = lib_interface_rip_version_send_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-ripd:rip/authentication-scheme",
- .cbs.cli_show = cli_show_ip_rip_authentication_scheme,
+ .cbs = {
+ .cli_show = cli_show_ip_rip_authentication_scheme,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-ripd:rip/authentication-scheme/mode",
- .cbs.modify = lib_interface_rip_authentication_scheme_mode_modify,
+ .cbs = {
+ .modify = lib_interface_rip_authentication_scheme_mode_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-ripd:rip/authentication-scheme/md5-auth-length",
- .cbs.modify = lib_interface_rip_authentication_scheme_md5_auth_length_modify,
- .cbs.destroy = lib_interface_rip_authentication_scheme_md5_auth_length_destroy,
+ .cbs = {
+ .destroy = lib_interface_rip_authentication_scheme_md5_auth_length_destroy,
+ .modify = lib_interface_rip_authentication_scheme_md5_auth_length_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-ripd:rip/authentication-password",
- .cbs.modify = lib_interface_rip_authentication_password_modify,
- .cbs.destroy = lib_interface_rip_authentication_password_destroy,
- .cbs.cli_show = cli_show_ip_rip_authentication_string,
+ .cbs = {
+ .cli_show = cli_show_ip_rip_authentication_string,
+ .destroy = lib_interface_rip_authentication_password_destroy,
+ .modify = lib_interface_rip_authentication_password_modify,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-ripd:rip/authentication-key-chain",
- .cbs.modify = lib_interface_rip_authentication_key_chain_modify,
- .cbs.destroy = lib_interface_rip_authentication_key_chain_destroy,
- .cbs.cli_show = cli_show_ip_rip_authentication_key_chain,
+ .cbs = {
+ .cli_show = cli_show_ip_rip_authentication_key_chain,
+ .destroy = lib_interface_rip_authentication_key_chain_destroy,
+ .modify = lib_interface_rip_authentication_key_chain_modify,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/state/neighbors/neighbor",
- .cbs.get_next = ripd_instance_state_neighbors_neighbor_get_next,
- .cbs.get_keys = ripd_instance_state_neighbors_neighbor_get_keys,
- .cbs.lookup_entry = ripd_instance_state_neighbors_neighbor_lookup_entry,
+ .cbs = {
+ .get_keys = ripd_instance_state_neighbors_neighbor_get_keys,
+ .get_next = ripd_instance_state_neighbors_neighbor_get_next,
+ .lookup_entry = ripd_instance_state_neighbors_neighbor_lookup_entry,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/state/neighbors/neighbor/address",
- .cbs.get_elem = ripd_instance_state_neighbors_neighbor_address_get_elem,
+ .cbs = {
+ .get_elem = ripd_instance_state_neighbors_neighbor_address_get_elem,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/state/neighbors/neighbor/last-update",
- .cbs.get_elem = ripd_instance_state_neighbors_neighbor_last_update_get_elem,
+ .cbs = {
+ .get_elem = ripd_instance_state_neighbors_neighbor_last_update_get_elem,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/state/neighbors/neighbor/bad-packets-rcvd",
- .cbs.get_elem = ripd_instance_state_neighbors_neighbor_bad_packets_rcvd_get_elem,
+ .cbs = {
+ .get_elem = ripd_instance_state_neighbors_neighbor_bad_packets_rcvd_get_elem,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/state/neighbors/neighbor/bad-routes-rcvd",
- .cbs.get_elem = ripd_instance_state_neighbors_neighbor_bad_routes_rcvd_get_elem,
+ .cbs = {
+ .get_elem = ripd_instance_state_neighbors_neighbor_bad_routes_rcvd_get_elem,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route",
- .cbs.get_next = ripd_instance_state_routes_route_get_next,
- .cbs.get_keys = ripd_instance_state_routes_route_get_keys,
- .cbs.lookup_entry = ripd_instance_state_routes_route_lookup_entry,
+ .cbs = {
+ .get_keys = ripd_instance_state_routes_route_get_keys,
+ .get_next = ripd_instance_state_routes_route_get_next,
+ .lookup_entry = ripd_instance_state_routes_route_lookup_entry,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/prefix",
- .cbs.get_elem = ripd_instance_state_routes_route_prefix_get_elem,
+ .cbs = {
+ .get_elem = ripd_instance_state_routes_route_prefix_get_elem,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/next-hop",
- .cbs.get_elem = ripd_instance_state_routes_route_next_hop_get_elem,
+ .cbs = {
+ .get_elem = ripd_instance_state_routes_route_next_hop_get_elem,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/interface",
- .cbs.get_elem = ripd_instance_state_routes_route_interface_get_elem,
+ .cbs = {
+ .get_elem = ripd_instance_state_routes_route_interface_get_elem,
+ },
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/metric",
- .cbs.get_elem = ripd_instance_state_routes_route_metric_get_elem,
+ .cbs = {
+ .get_elem = ripd_instance_state_routes_route_metric_get_elem,
+ },
},
{
.xpath = "/frr-ripd:clear-rip-route",
- .cbs.rpc = clear_rip_route_rpc,
+ .cbs = {
+ .rpc = clear_rip_route_rpc,
+ },
},
{
.xpath = NULL,
#include "ripd/ripd.h"
+DEFINE_MTYPE_STATIC(RIPD, RIP_OFFSET_LIST, "RIP offset list")
+
#define OFFSET_LIST_IN_NAME(O) ((O)->direct[RIP_OFFSET_LIST_IN].alist_name)
#define OFFSET_LIST_IN_METRIC(O) ((O)->direct[RIP_OFFSET_LIST_IN].metric)
#include "ripd/ripd.h"
+DEFINE_MTYPE_STATIC(RIPD, RIP_PEER, "RIP peer")
+
static struct rip_peer *rip_peer_new(void)
{
return XCALLOC(MTYPE_RIP_PEER, sizeof(struct rip_peer));
route_match_ip_next_hop_prefix_list_compile,
route_match_ip_next_hop_prefix_list_free};
+/* `match ip next-hop type <blackhole>' */
+
+static route_map_result_t
+route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
+{
+ struct rip_info *rinfo;
+
+ if (type == RMAP_RIP && prefix->family == AF_INET) {
+ rinfo = (struct rip_info *)object;
+ if (!rinfo)
+ return RMAP_DENYMATCH;
+
+ if (rinfo->nh.type == NEXTHOP_TYPE_BLACKHOLE)
+ return RMAP_MATCH;
+ }
+ return RMAP_NOMATCH;
+}
+
+static void *route_match_ip_next_hop_type_compile(const char *arg)
+{
+ return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
+}
+
+static void route_match_ip_next_hop_type_free(void *rule)
+{
+ XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
+}
+
+static struct route_map_rule_cmd route_match_ip_next_hop_type_cmd = {
+ "ip next-hop type", route_match_ip_next_hop_type,
+ route_match_ip_next_hop_type_compile,
+ route_match_ip_next_hop_type_free};
+
/* `match ip address IP_ACCESS_LIST' */
/* Match function should return 1 if match is success else return
route_map_match_ip_next_hop_prefix_list_hook(generic_match_add);
route_map_no_match_ip_next_hop_prefix_list_hook(generic_match_delete);
+ route_map_match_ip_next_hop_type_hook(generic_match_add);
+ route_map_no_match_ip_next_hop_type_hook(generic_match_delete);
+
route_map_match_metric_hook(generic_match_add);
route_map_no_match_metric_hook(generic_match_delete);
route_map_install_match(&route_match_interface_cmd);
route_map_install_match(&route_match_ip_next_hop_cmd);
route_map_install_match(&route_match_ip_next_hop_prefix_list_cmd);
+ route_map_install_match(&route_match_ip_next_hop_type_cmd);
route_map_install_match(&route_match_ip_address_cmd);
route_map_install_match(&route_match_ip_address_prefix_list_cmd);
route_map_install_match(&route_match_tag_cmd);
/* UDP receive buffer size */
#define RIP_UDP_RCV_BUF 41600
+DEFINE_MGROUP(RIPD, "ripd")
+DEFINE_MTYPE_STATIC(RIPD, RIP, "RIP structure")
+DEFINE_MTYPE_STATIC(RIPD, RIP_VRF_NAME, "RIP VRF name")
+DEFINE_MTYPE_STATIC(RIPD, RIP_INFO, "RIP route info")
+DEFINE_MTYPE_STATIC(RIPD, RIP_DISTANCE, "RIP distance")
+
/* Prototypes. */
static void rip_output_process(struct connected *, struct sockaddr_in *, int,
uint8_t);
#include "hook.h"
#include "nexthop.h"
#include "distribute.h"
-#include "rip_memory.h"
+#include "memory.h"
/* RIP version number. */
#define RIPv1 1
#define RIP_INSTANCE "/frr-ripd:ripd/instance"
#define RIP_IFACE "/frr-interface:lib/interface/frr-ripd:rip"
+DECLARE_MGROUP(RIPD)
+
/* RIP structure. */
struct rip {
RB_ENTRY(rip) entry;
ripd/rip_debug.c \
ripd/rip_errors.c \
ripd/rip_interface.c \
- ripd/rip_memory.c \
ripd/rip_offset.c \
ripd/rip_northbound.c \
ripd/rip_peer.c \
ripd/rip_debug.h \
ripd/rip_errors.h \
ripd/rip_interface.h \
- ripd/rip_memory.h \
ripd/ripd.h \
# end
#define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP
#endif
+DEFINE_MTYPE_STATIC(RIPNGD, RIPNG_IF, "ripng interface")
+
/* Static utility function. */
static void ripng_enable_apply(struct interface *);
static void ripng_passive_interface_apply(struct interface *);
{
struct ripng_interface *ri;
- ri = XCALLOC(MTYPE_IF, sizeof(struct ripng_interface));
+ ri = XCALLOC(MTYPE_RIPNG_IF, sizeof(struct ripng_interface));
/* Set default split-horizon behavior. If the interface is Frame
Relay or SMDS is enabled, the default value for split-horizon is
/* Called when interface structure deleted. */
static int ripng_if_delete_hook(struct interface *ifp)
{
- XFREE(MTYPE_IF, ifp->info);
+ XFREE(MTYPE_RIPNG_IF, ifp->info);
ifp->info = NULL;
return 0;
}
+++ /dev/null
-/* ripngd 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 this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "ripng_memory.h"
-
-DEFINE_MGROUP(RIPNGD, "ripngd")
-DEFINE_MTYPE(RIPNGD, RIPNG, "RIPng structure")
-DEFINE_MTYPE(RIPNGD, RIPNG_VRF_NAME, "RIPng VRF name")
-DEFINE_MTYPE(RIPNGD, RIPNG_ROUTE, "RIPng route info")
-DEFINE_MTYPE(RIPNGD, RIPNG_AGGREGATE, "RIPng aggregate")
-DEFINE_MTYPE(RIPNGD, RIPNG_PEER, "RIPng peer")
-DEFINE_MTYPE(RIPNGD, RIPNG_OFFSET_LIST, "RIPng offset lst")
-DEFINE_MTYPE(RIPNGD, RIPNG_RTE_DATA, "RIPng rte data")
+++ /dev/null
-/* ripngd 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 this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef _QUAGGA_RIPNG_MEMORY_H
-#define _QUAGGA_RIPNG_MEMORY_H
-
-#include "memory.h"
-
-DECLARE_MGROUP(RIPNGD)
-DECLARE_MTYPE(RIPNG)
-DECLARE_MTYPE(RIPNG_VRF_NAME)
-DECLARE_MTYPE(RIPNG_ROUTE)
-DECLARE_MTYPE(RIPNG_AGGREGATE)
-DECLARE_MTYPE(RIPNG_PEER)
-DECLARE_MTYPE(RIPNG_OFFSET_LIST)
-DECLARE_MTYPE(RIPNG_RTE_DATA)
-
-#endif /* _QUAGGA_RIPNG_MEMORY_H */
#include "ripngd/ripng_debug.h"
#include "ripngd/ripng_nexthop.h"
+DEFINE_MTYPE_STATIC(RIPNGD, RIPNG_RTE_DATA, "RIPng rte data")
+
#define DEBUG 1
#define min(a, b) ((a) < (b) ? (a) : (b))
static const void *ripngd_instance_get_next(const void *parent_list_entry,
const void *list_entry)
{
- const struct ripng *ripng = list_entry;
+ struct ripng *ripng = (struct ripng *)list_entry;
if (list_entry == NULL)
ripng = RB_MIN(ripng_instance_head, &ripng_instances);
else
- ripng = RB_NEXT(ripng_instance_head, (struct ripng *)ripng);
+ ripng = RB_NEXT(ripng_instance_head, ripng);
return ripng;
}
.nodes = {
{
.xpath = "/frr-ripngd:ripngd/instance",
- .cbs.create = ripngd_instance_create,
- .cbs.destroy = ripngd_instance_destroy,
- .cbs.get_next = ripngd_instance_get_next,
- .cbs.get_keys = ripngd_instance_get_keys,
- .cbs.lookup_entry = ripngd_instance_lookup_entry,
- .cbs.cli_show = cli_show_router_ripng,
+ .cbs = {
+ .cli_show = cli_show_router_ripng,
+ .create = ripngd_instance_create,
+ .destroy = ripngd_instance_destroy,
+ .get_keys = ripngd_instance_get_keys,
+ .get_next = ripngd_instance_get_next,
+ .lookup_entry = ripngd_instance_lookup_entry,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/allow-ecmp",
- .cbs.modify = ripngd_instance_allow_ecmp_modify,
- .cbs.cli_show = cli_show_ripng_allow_ecmp,
+ .cbs = {
+ .cli_show = cli_show_ripng_allow_ecmp,
+ .modify = ripngd_instance_allow_ecmp_modify,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/default-information-originate",
- .cbs.modify = ripngd_instance_default_information_originate_modify,
- .cbs.cli_show = cli_show_ripng_default_information_originate,
+ .cbs = {
+ .cli_show = cli_show_ripng_default_information_originate,
+ .modify = ripngd_instance_default_information_originate_modify,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/default-metric",
- .cbs.modify = ripngd_instance_default_metric_modify,
- .cbs.cli_show = cli_show_ripng_default_metric,
+ .cbs = {
+ .cli_show = cli_show_ripng_default_metric,
+ .modify = ripngd_instance_default_metric_modify,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/network",
- .cbs.create = ripngd_instance_network_create,
- .cbs.destroy = ripngd_instance_network_destroy,
- .cbs.cli_show = cli_show_ripng_network_prefix,
+ .cbs = {
+ .cli_show = cli_show_ripng_network_prefix,
+ .create = ripngd_instance_network_create,
+ .destroy = ripngd_instance_network_destroy,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/interface",
- .cbs.create = ripngd_instance_interface_create,
- .cbs.destroy = ripngd_instance_interface_destroy,
- .cbs.cli_show = cli_show_ripng_network_interface,
+ .cbs = {
+ .cli_show = cli_show_ripng_network_interface,
+ .create = ripngd_instance_interface_create,
+ .destroy = ripngd_instance_interface_destroy,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/offset-list",
- .cbs.create = ripngd_instance_offset_list_create,
- .cbs.destroy = ripngd_instance_offset_list_destroy,
- .cbs.cli_show = cli_show_ripng_offset_list,
+ .cbs = {
+ .cli_show = cli_show_ripng_offset_list,
+ .create = ripngd_instance_offset_list_create,
+ .destroy = ripngd_instance_offset_list_destroy,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/offset-list/access-list",
- .cbs.modify = ripngd_instance_offset_list_access_list_modify,
+ .cbs = {
+ .modify = ripngd_instance_offset_list_access_list_modify,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/offset-list/metric",
- .cbs.modify = ripngd_instance_offset_list_metric_modify,
+ .cbs = {
+ .modify = ripngd_instance_offset_list_metric_modify,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/passive-interface",
- .cbs.create = ripngd_instance_passive_interface_create,
- .cbs.destroy = ripngd_instance_passive_interface_destroy,
- .cbs.cli_show = cli_show_ripng_passive_interface,
+ .cbs = {
+ .cli_show = cli_show_ripng_passive_interface,
+ .create = ripngd_instance_passive_interface_create,
+ .destroy = ripngd_instance_passive_interface_destroy,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/redistribute",
- .cbs.create = ripngd_instance_redistribute_create,
- .cbs.destroy = ripngd_instance_redistribute_destroy,
- .cbs.apply_finish = ripngd_instance_redistribute_apply_finish,
- .cbs.cli_show = cli_show_ripng_redistribute,
+ .cbs = {
+ .apply_finish = ripngd_instance_redistribute_apply_finish,
+ .cli_show = cli_show_ripng_redistribute,
+ .create = ripngd_instance_redistribute_create,
+ .destroy = ripngd_instance_redistribute_destroy,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/redistribute/route-map",
- .cbs.modify = ripngd_instance_redistribute_route_map_modify,
- .cbs.destroy = ripngd_instance_redistribute_route_map_destroy,
+ .cbs = {
+ .destroy = ripngd_instance_redistribute_route_map_destroy,
+ .modify = ripngd_instance_redistribute_route_map_modify,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/redistribute/metric",
- .cbs.modify = ripngd_instance_redistribute_metric_modify,
- .cbs.destroy = ripngd_instance_redistribute_metric_destroy,
+ .cbs = {
+ .destroy = ripngd_instance_redistribute_metric_destroy,
+ .modify = ripngd_instance_redistribute_metric_modify,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/static-route",
- .cbs.create = ripngd_instance_static_route_create,
- .cbs.destroy = ripngd_instance_static_route_destroy,
- .cbs.cli_show = cli_show_ripng_route,
+ .cbs = {
+ .cli_show = cli_show_ripng_route,
+ .create = ripngd_instance_static_route_create,
+ .destroy = ripngd_instance_static_route_destroy,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/aggregate-address",
- .cbs.create = ripngd_instance_aggregate_address_create,
- .cbs.destroy = ripngd_instance_aggregate_address_destroy,
- .cbs.cli_show = cli_show_ripng_aggregate_address,
+ .cbs = {
+ .cli_show = cli_show_ripng_aggregate_address,
+ .create = ripngd_instance_aggregate_address_create,
+ .destroy = ripngd_instance_aggregate_address_destroy,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/timers",
- .cbs.apply_finish = ripngd_instance_timers_apply_finish,
- .cbs.cli_show = cli_show_ripng_timers,
+ .cbs = {
+ .apply_finish = ripngd_instance_timers_apply_finish,
+ .cli_show = cli_show_ripng_timers,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/timers/flush-interval",
- .cbs.modify = ripngd_instance_timers_flush_interval_modify,
+ .cbs = {
+ .modify = ripngd_instance_timers_flush_interval_modify,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/timers/holddown-interval",
- .cbs.modify = ripngd_instance_timers_holddown_interval_modify,
+ .cbs = {
+ .modify = ripngd_instance_timers_holddown_interval_modify,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/timers/update-interval",
- .cbs.modify = ripngd_instance_timers_update_interval_modify,
+ .cbs = {
+ .modify = ripngd_instance_timers_update_interval_modify,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/state/neighbors/neighbor",
- .cbs.get_next = ripngd_instance_state_neighbors_neighbor_get_next,
- .cbs.get_keys = ripngd_instance_state_neighbors_neighbor_get_keys,
- .cbs.lookup_entry = ripngd_instance_state_neighbors_neighbor_lookup_entry,
+ .cbs = {
+ .get_keys = ripngd_instance_state_neighbors_neighbor_get_keys,
+ .get_next = ripngd_instance_state_neighbors_neighbor_get_next,
+ .lookup_entry = ripngd_instance_state_neighbors_neighbor_lookup_entry,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/state/neighbors/neighbor/address",
- .cbs.get_elem = ripngd_instance_state_neighbors_neighbor_address_get_elem,
+ .cbs = {
+ .get_elem = ripngd_instance_state_neighbors_neighbor_address_get_elem,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/state/neighbors/neighbor/last-update",
- .cbs.get_elem = ripngd_instance_state_neighbors_neighbor_last_update_get_elem,
+ .cbs = {
+ .get_elem = ripngd_instance_state_neighbors_neighbor_last_update_get_elem,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/state/neighbors/neighbor/bad-packets-rcvd",
- .cbs.get_elem = ripngd_instance_state_neighbors_neighbor_bad_packets_rcvd_get_elem,
+ .cbs = {
+ .get_elem = ripngd_instance_state_neighbors_neighbor_bad_packets_rcvd_get_elem,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/state/neighbors/neighbor/bad-routes-rcvd",
- .cbs.get_elem = ripngd_instance_state_neighbors_neighbor_bad_routes_rcvd_get_elem,
+ .cbs = {
+ .get_elem = ripngd_instance_state_neighbors_neighbor_bad_routes_rcvd_get_elem,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/state/routes/route",
- .cbs.get_next = ripngd_instance_state_routes_route_get_next,
- .cbs.get_keys = ripngd_instance_state_routes_route_get_keys,
- .cbs.lookup_entry = ripngd_instance_state_routes_route_lookup_entry,
+ .cbs = {
+ .get_keys = ripngd_instance_state_routes_route_get_keys,
+ .get_next = ripngd_instance_state_routes_route_get_next,
+ .lookup_entry = ripngd_instance_state_routes_route_lookup_entry,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/state/routes/route/prefix",
- .cbs.get_elem = ripngd_instance_state_routes_route_prefix_get_elem,
+ .cbs = {
+ .get_elem = ripngd_instance_state_routes_route_prefix_get_elem,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/state/routes/route/next-hop",
- .cbs.get_elem = ripngd_instance_state_routes_route_next_hop_get_elem,
+ .cbs = {
+ .get_elem = ripngd_instance_state_routes_route_next_hop_get_elem,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/state/routes/route/interface",
- .cbs.get_elem = ripngd_instance_state_routes_route_interface_get_elem,
+ .cbs = {
+ .get_elem = ripngd_instance_state_routes_route_interface_get_elem,
+ },
},
{
.xpath = "/frr-ripngd:ripngd/instance/state/routes/route/metric",
- .cbs.get_elem = ripngd_instance_state_routes_route_metric_get_elem,
+ .cbs = {
+ .get_elem = ripngd_instance_state_routes_route_metric_get_elem,
+ },
},
{
.xpath = "/frr-ripngd:clear-ripng-route",
- .cbs.rpc = clear_ripng_route_rpc,
+ .cbs = {
+ .rpc = clear_ripng_route_rpc,
+ },
},
{
.xpath = "/frr-interface:lib/interface/frr-ripngd:ripng/split-horizon",
- .cbs.modify = lib_interface_ripng_split_horizon_modify,
- .cbs.cli_show = cli_show_ipv6_ripng_split_horizon,
+ .cbs = {
+ .cli_show = cli_show_ipv6_ripng_split_horizon,
+ .modify = lib_interface_ripng_split_horizon_modify,
+ },
},
{
.xpath = NULL,
#include "ripngd/ripngd.h"
+DEFINE_MTYPE_STATIC(RIPNGD, RIPNG_OFFSET_LIST, "RIPng offset lst")
+
#define OFFSET_LIST_IN_NAME(O) ((O)->direct[RIPNG_OFFSET_LIST_IN].alist_name)
#define OFFSET_LIST_IN_METRIC(O) ((O)->direct[RIPNG_OFFSET_LIST_IN].metric)
#include "ripngd/ripngd.h"
#include "ripngd/ripng_nexthop.h"
+DEFINE_MTYPE_STATIC(RIPNGD, RIPNG_PEER, "RIPng peer")
+
static struct ripng_peer *ripng_peer_new(void)
{
return XCALLOC(MTYPE_RIPNG_PEER, sizeof(struct ripng_peer));
#include "ripngd/ripngd.h"
#include "ripngd/ripng_route.h"
+DEFINE_MTYPE_STATIC(RIPNGD, RIPNG_AGGREGATE, "RIPng aggregate")
+
static struct ripng_aggregate *ripng_aggregate_new(void)
{
struct ripng_aggregate *new;
#include "ripngd/ripng_debug.h"
#include "ripngd/ripng_nexthop.h"
+DEFINE_MGROUP(RIPNGD, "ripngd")
+DEFINE_MTYPE_STATIC(RIPNGD, RIPNG, "RIPng structure")
+DEFINE_MTYPE_STATIC(RIPNGD, RIPNG_VRF_NAME, "RIPng VRF name")
+DEFINE_MTYPE_STATIC(RIPNGD, RIPNG_ROUTE, "RIPng route info")
+
enum { ripng_all_route,
ripng_changed_route,
};
#include <vty.h>
#include <distribute.h>
#include <vector.h>
-
-#include "ripng_memory.h"
+#include <memory.h>
/* RIPng version and port number. */
#define RIPNG_V1 1
#define RIPNG_INSTANCE "/frr-ripngd:ripngd/instance"
#define RIPNG_IFACE "/frr-interface:lib/interface/frr-ripngd:ripng"
+DECLARE_MGROUP(RIPNGD)
+
/* RIPng structure. */
struct ripng {
RB_ENTRY(ripng) entry;
ripngd/ripng_cli.c \
ripngd/ripng_debug.c \
ripngd/ripng_interface.c \
- ripngd/ripng_memory.c \
ripngd/ripng_nexthop.c \
ripngd/ripng_offset.c \
ripngd/ripng_northbound.c \
noinst_HEADERS += \
ripngd/ripng_cli.h \
ripngd/ripng_debug.h \
- ripngd/ripng_memory.h \
ripngd/ripng_nexthop.h \
ripngd/ripng_route.h \
ripngd/ripngd.h \
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "id_alloc.h"
#include <inttypes.h>
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
krel = platform.release()
tgen = get_topogen()
logger.info('pre router-start hook, kernel=' + krel)
- if topotest.version_cmp(krel, '4.15') == 0:
+
+ if topotest.version_cmp(krel, '4.15') >= 0 and \
+ topotest.version_cmp(krel, '4.18') <= 0:
l3mdev_accept = 1
else:
l3mdev_accept = 0
ip address 172.16.1.254/24
no link-detect
!
- bgp multiple-instance
- !
router bgp 100 view 1
bgp router-id 172.30.1.1
network 172.20.0.0/28 route-map local1
!debug bgp filters
!debug bgp zebra
!
-bgp multiple-instance
-!
router bgp 100 view 1
bgp router-id 172.30.1.1
network 172.20.0.0/28 route-map local1
vrrpd/vrrp.c \
vrrpd/vrrp_arp.c \
vrrpd/vrrp_debug.c \
- vrrpd/vrrp_memory.c \
vrrpd/vrrp_ndisc.c \
vrrpd/vrrp_packet.c \
vrrpd/vrrp_vty.c \
vrrpd/vrrp.h \
vrrpd/vrrp_arp.h \
vrrpd/vrrp_debug.h \
- vrrpd/vrrp_memory.h \
vrrpd/vrrp_ndisc.h \
vrrpd/vrrp_packet.h \
vrrpd/vrrp_vty.h \
#include "vrrp.h"
#include "vrrp_arp.h"
#include "vrrp_debug.h"
-#include "vrrp_memory.h"
#include "vrrp_ndisc.h"
#include "vrrp_packet.h"
#include "vrrp_zebra.h"
#define VRRP_LOGPFX "[CORE] "
+DEFINE_MTYPE_STATIC(VRRPD, VRRP_IP, "VRRP IP address")
+DEFINE_MTYPE_STATIC(VRRPD, VRRP_RTR, "VRRP Router")
+
/* statics */
struct hash *vrrp_vrouters_hash;
bool vrrp_autoconfig_is_on;
ssize_t sent = sendto(r->sock_tx, pkt, (size_t)pktsz, 0, &dest.sa,
sockunion_sizeof(&dest));
- XFREE(MTYPE_VRRP_PKT, pkt);
+ vrrp_pkt_free(pkt);
if (sent < 0) {
zlog_warn(VRRP_LOGPFX VRRP_LOGPFX_VRID VRRP_LOGPFX_FAM
#include <zebra.h>
#include <netinet/ip.h>
+#include "lib/memory.h"
#include "lib/hash.h"
#include "lib/hook.h"
#include "lib/if.h"
/* User compatibility constant */
#define CS2MS 10
+DECLARE_MGROUP(VRRPD)
+
/* Configured defaults */
struct vrrp_defaults {
uint8_t priority;
#include "vrrp_vty.h"
#include "vrrp_zebra.h"
+DEFINE_MGROUP(VRRPD, "vrrpd")
+
char backup_config_file[256];
zebra_capabilities_t _caps_p[] = {
+++ /dev/null
-/*
- * VRRP memory types.
- * Copyright (C) 2018-2019 Cumulus Networks, Inc.
- * Quentin Young
- *
- * This program 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 of the License, or (at your option)
- * any later version.
- *
- * This program 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 this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <zebra.h>
-
-#include "lib/memory.h"
-
-#include "vrrp_memory.h"
-
-DEFINE_MGROUP(VRRPD, "vrrpd");
-DEFINE_MTYPE(VRRPD, VRRP_IP, "VRRP IP address");
-DEFINE_MTYPE(VRRPD, VRRP_PKT, "VRRP packet");
-DEFINE_MTYPE(VRRPD, VRRP_RTR, "VRRP Router");
+++ /dev/null
-/*
- * VRRP memory types.
- * Copyright (C) 2018-2019 Cumulus Networks, Inc.
- * Quentin Young
- *
- * This program 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 of the License, or (at your option)
- * any later version.
- *
- * This program 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 this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef __VRRP_MEMORY_H__
-#define __VRRP_MEMORY_H__
-
-#include <zebra.h>
-
-#include "lib/memory.h"
-
-DECLARE_MGROUP(VRRPD);
-DECLARE_MTYPE(VRRP_IP);
-DECLARE_MTYPE(VRRP_PKT);
-DECLARE_MTYPE(VRRP_RTR);
-
-#endif /* __VRRP_MEMORY_H__ */
#include "vrrp.h"
#include "vrrp_debug.h"
-#include "vrrp_memory.h"
#include "vrrp_packet.h"
+DEFINE_MTYPE_STATIC(VRRPD, VRRP_PKT, "VRRP packet")
+
/* clang-format off */
const char *vrrp_packet_names[16] = {
[0] = "Unknown",
return pktsize;
}
+void vrrp_pkt_free(struct vrrp_pkt *pkt)
+{
+ XFREE(MTYPE_VRRP_PKT, pkt);
+}
+
size_t vrrp_pkt_adver_dump(char *buf, size_t buflen, struct vrrp_pkt *pkt)
{
if (buflen < 1)
uint16_t max_adver_int, uint8_t numip,
struct ipaddr **ips);
+/* free memory allocated by vrrp_pkt_adver_build's pkt arg */
+void vrrp_pkt_free(struct vrrp_pkt *pkt);
+
/*
* Dumps a VRRP ADVERTISEMENT packet to a string.
*
#include "vrrp.h"
#include "vrrp_debug.h"
-#include "vrrp_memory.h"
#include "vrrp_vty.h"
#ifndef VTYSH_EXTRACT_PL
#include "vrrpd/vrrp_vty_clippy.c"
strlen("debug northbound"))
== 0)
config = config_get(NORTHBOUND_DEBUG_NODE, line);
+ else if (strncmp(line, "debug route-map",
+ strlen("debug route-map"))
+ == 0)
+ config = config_get(RMAP_DEBUG_NODE, line);
else if (strncmp(line, "debug", strlen("debug")) == 0)
config = config_get(DEBUG_NODE, line);
else if (strncmp(line, "password", strlen("password")) == 0
|| (I) == ACCESS_IPV6_NODE || (I) == ACCESS_MAC_NODE \
|| (I) == PREFIX_IPV6_NODE || (I) == FORWARDING_NODE \
|| (I) == DEBUG_NODE || (I) == AAA_NODE || (I) == VRF_DEBUG_NODE \
- || (I) == NORTHBOUND_DEBUG_NODE || (I) == MPLS_NODE)
+ || (I) == NORTHBOUND_DEBUG_NODE || (I) == RMAP_DEBUG_NODE \
+ || (I) == MPLS_NODE)
/* Display configuration to file pointer. */
void vtysh_config_dump(void)
{RTNL_FAMILY_IP6MR, "ipv6MR"},
{0}};
-static const struct message rttype_str[] = {{RTN_UNICAST, "unicast"},
+static const struct message rttype_str[] = {{RTN_UNSPEC, "none"},
+ {RTN_UNICAST, "unicast"},
+ {RTN_LOCAL, "local"},
+ {RTN_BROADCAST, "broadcast"},
+ {RTN_ANYCAST, "anycast"},
{RTN_MULTICAST, "multicast"},
+ {RTN_BLACKHOLE, "blackhole"},
+ {RTN_UNREACHABLE, "unreachable"},
+ {RTN_PROHIBIT, "prohibited"},
+ {RTN_THROW, "throw"},
+ {RTN_NAT, "nat"},
+ {RTN_XRESOLVE, "resolver"},
{0}};
extern struct thread_master *master;
bh_type = BLACKHOLE_ADMINPROHIB;
break;
default:
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ zlog_debug("Route rtm_type: %s(%d) intentionally ignoring",
+ nl_rttype_to_str(rtm->rtm_type),
+ rtm->rtm_type);
return 0;
}
}
/* if kernel marks our rfc5549 neighbor entry invalid, re-install it */
- if (h->nlmsg_type == RTM_NEWNEIGH && !(ndm->ndm_state & NUD_VALID))
- netlink_handle_5549(ndm, zif, ifp, &ip);
+ if (h->nlmsg_type == RTM_NEWNEIGH && !(ndm->ndm_state & NUD_VALID)) {
+ if (!(ndm->ndm_state & NUD_FAILED))
+ netlink_handle_5549(ndm, zif, ifp, &ip);
+ else
+ zlog_info("Neighbor Entry for %s has entered a failed state, not reinstalling",
+ ifp->name);
+ }
/* The neighbor is present on an SVI. From this, we locate the
* underlying
#if defined(HAVE_RTADV)
+DEFINE_MTYPE_STATIC(ZEBRA, RTADV_PREFIX, "Router Advertisement Prefix")
+
#ifdef OPEN_BSD
#include <netinet/icmp6.h>
#endif
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "lib/libfrr.h"
#include "lib/debug.h"
#include "lib/frratomic.h"
#include "zebra/debug.h"
/* Memory type for context blocks */
-DEFINE_MTYPE(ZEBRA, DP_CTX, "Zebra DPlane Ctx")
-DEFINE_MTYPE(ZEBRA, DP_PROV, "Zebra DPlane Provider")
+DEFINE_MTYPE_STATIC(ZEBRA, DP_CTX, "Zebra DPlane Ctx")
+DEFINE_MTYPE_STATIC(ZEBRA, DP_PROV, "Zebra DPlane Provider")
#ifndef AOK
# define AOK 0
#include "zebra_memory.h"
DEFINE_MGROUP(ZEBRA, "zebra")
-DEFINE_MTYPE(ZEBRA, RTADV_PREFIX, "Router Advertisement Prefix")
-DEFINE_MTYPE(ZEBRA, ZEBRA_VRF, "ZEBRA VRF")
DEFINE_MTYPE(ZEBRA, RE, "Route Entry")
-DEFINE_MTYPE(ZEBRA, RIB_QUEUE, "RIB process work queue")
-DEFINE_MTYPE(ZEBRA, STATIC_ROUTE, "Static route")
DEFINE_MTYPE(ZEBRA, RIB_DEST, "RIB destination")
-DEFINE_MTYPE(ZEBRA, RIB_TABLE_INFO, "RIB table info")
-DEFINE_MTYPE(ZEBRA, RNH, "Nexthop tracking object")
#endif
DECLARE_MGROUP(ZEBRA)
-DECLARE_MTYPE(RTADV_PREFIX)
DECLARE_MTYPE(ZEBRA_NS)
-DECLARE_MTYPE(ZEBRA_VRF)
DECLARE_MTYPE(RE)
-DECLARE_MTYPE(RIB_QUEUE)
-DECLARE_MTYPE(STATIC_ROUTE)
DECLARE_MTYPE(RIB_DEST)
-DECLARE_MTYPE(RIB_TABLE_INFO)
-DECLARE_MTYPE(RNH)
-DECLARE_MTYPE(DP_CTX)
-DECLARE_MTYPE(DP_PROV)
#ifdef __cplusplus
}
if (IS_ZEBRA_DEBUG_NHT_DETAILED) {
char buf[PREFIX_STRLEN];
- zlog_debug("%s: %s Being examined for Nexthop Tracking",
+ zlog_debug("%s: %s Being examined for Nexthop Tracking Count: %zd",
__PRETTY_FUNCTION__,
- srcdest_rnode2str(rn, buf, sizeof(buf)));
+ srcdest_rnode2str(rn, buf, sizeof(buf)),
+ dest ? rnh_list_count(&dest->nht) : 0);
}
if (!dest) {
rn = rn->parent;
* nht resolution and as such we need to call the
* nexthop tracking evaluation code
*/
- frr_each (rnh_list, &dest->nht, rnh) {
+ frr_each_safe(rnh_list, &dest->nht, rnh) {
struct zebra_vrf *zvrf =
zebra_vrf_lookup_by_id(rnh->vrf_id);
struct prefix *p = &rnh->node->p;
char buf1[PREFIX_STRLEN];
char buf2[PREFIX_STRLEN];
- zlog_debug("%u:%s has Nexthop(%s) depending on it, evaluating %u:%u",
+ zlog_debug("%u:%s has Nexthop(%s) Type: %s depending on it, evaluating %u:%u",
zvrf->vrf->vrf_id,
srcdest_rnode2str(rn, buf1,
sizeof(buf1)),
prefix2str(p, buf2, sizeof(buf2)),
+ rnh_type2str(rnh->type),
seq, rnh->seqno);
}
#include "zebra/zebra_memory.h"
#include "zebra/zebra_errors.h"
+DEFINE_MTYPE_STATIC(ZEBRA, RNH, "Nexthop tracking object")
+
static void free_state(vrf_id_t vrf_id, struct route_entry *re,
struct route_node *rn);
static void copy_state(struct rnh *rnh, struct route_entry *re,
if (IS_ZEBRA_DEBUG_NHT) {
prefix2str(p, buf, sizeof(buf));
- zlog_debug("%u: Add RNH %s type %d", vrfid, buf, type);
+ zlog_debug("%u: Add RNH %s type %s", vrfid, buf,
+ rnh_type2str(type));
}
table = get_rnh_table(vrfid, afi, type);
if (!table) {
prefix2str(p, buf, sizeof(buf));
flog_warn(EC_ZEBRA_RNH_NO_TABLE,
- "%u: Add RNH %s type %d - table not found", vrfid,
- buf, type);
+ "%u: Add RNH %s type %s - table not found", vrfid,
+ buf, rnh_type2str(type));
exists = false;
return NULL;
}
if (IS_ZEBRA_DEBUG_NHT) {
char buf[PREFIX2STR_BUFFER];
- zlog_debug("%u: Del RNH %s type %d", rnh->vrf_id,
- rnh_str(rnh, buf, sizeof(buf)), type);
+ zlog_debug("%u: Del RNH %s type %s", rnh->vrf_id,
+ rnh_str(rnh, buf, sizeof(buf)), rnh_type2str(type));
}
zebra_free_rnh(rnh);
{
if (IS_ZEBRA_DEBUG_NHT) {
char buf[PREFIX2STR_BUFFER];
- zlog_debug("%u: Client %s registers for RNH %s type %d", vrf_id,
+ zlog_debug("%u: Client %s registers for RNH %s type %s", vrf_id,
zebra_route_string(client->proto),
- rnh_str(rnh, buf, sizeof(buf)), type);
+ rnh_str(rnh, buf, sizeof(buf)), rnh_type2str(type));
}
if (!listnode_lookup(rnh->client_list, client))
listnode_add(rnh->client_list, client);
{
if (IS_ZEBRA_DEBUG_NHT) {
char buf[PREFIX2STR_BUFFER];
- zlog_debug("Client %s unregisters for RNH %s type %d",
+ zlog_debug("Client %s unregisters for RNH %s type %s",
zebra_route_string(client->proto),
- rnh_str(rnh, buf, sizeof(buf)), type);
+ rnh_str(rnh, buf, sizeof(buf)), rnh_type2str(type));
}
listnode_delete(rnh->client_list, client);
zebra_delete_rnh(rnh, type);
if (IS_ZEBRA_DEBUG_NHT) {
prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
- zlog_debug("%u:%s: Evaluate RNH, type %d %s", zvrf->vrf->vrf_id,
- bufn, type, force ? "(force)" : "");
+ zlog_debug("%u:%s: Evaluate RNH, type %s %s", zvrf->vrf->vrf_id,
+ bufn, rnh_type2str(type), force ? "(force)" : "");
}
rnh = nrn->info;
struct rnh *rnh;
if (IS_ZEBRA_DEBUG_NHT)
- zlog_debug("%u: Client %s RNH cleanup for family %s type %d",
+ zlog_debug("%u: Client %s RNH cleanup for family %s type %s",
vrf_id, zebra_route_string(client->proto),
- afi2str(afi), type);
+ afi2str(afi), rnh_type2str(type));
ntable = get_rnh_table(vrf_id, afi, type);
if (!ntable) {
return 0;
}
+static inline const char *rnh_type2str(rnh_type_t type)
+{
+ switch (type) {
+ case RNH_NEXTHOP_TYPE:
+ return "Nexthop";
+ case RNH_IMPORT_CHECK_TYPE:
+ return "Import";
+ }
+
+ return "ERROR";
+}
+
extern struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid,
rnh_type_t type, bool *exists);
extern struct rnh *zebra_lookup_rnh(struct prefix *p, vrf_id_t vrfid,
route_match_address_prefix_list_compile,
route_match_address_prefix_list_free};
+/* `match ipv6 next-hop type <TYPE>' */
+
+static route_map_result_t
+route_match_ipv6_next_hop_type(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
+{
+ struct nh_rmap_obj *nh_data;
+
+ if (type == RMAP_ZEBRA && prefix->family == AF_INET6) {
+ nh_data = (struct nh_rmap_obj *)object;
+ if (!nh_data)
+ return RMAP_DENYMATCH;
+
+ if (nh_data->nexthop->type == NEXTHOP_TYPE_BLACKHOLE)
+ return RMAP_MATCH;
+ }
+ return RMAP_NOMATCH;
+}
+
+static void *route_match_ipv6_next_hop_type_compile(const char *arg)
+{
+ return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
+}
+
+static void route_match_ipv6_next_hop_type_free(void *rule)
+{
+ XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
+}
+
+struct route_map_rule_cmd route_match_ipv6_next_hop_type_cmd = {
+ "ipv6 next-hop type", route_match_ipv6_next_hop_type,
+ route_match_ipv6_next_hop_type_compile,
+ route_match_ipv6_next_hop_type_free};
+
/* `match ip address prefix-len PREFIXLEN' */
static route_map_result_t
route_match_address_prefix_len_free /* reuse */
};
+/* `match ip next-hop type <blackhole>' */
+
+static route_map_result_t
+route_match_ip_next_hop_type(void *rule, const struct prefix *prefix,
+ route_map_object_t type, void *object)
+{
+ struct nh_rmap_obj *nh_data;
+
+ if (type == RMAP_ZEBRA && prefix->family == AF_INET) {
+ nh_data = (struct nh_rmap_obj *)object;
+ if (!nh_data)
+ return RMAP_DENYMATCH;
+
+ if (nh_data->nexthop->type == NEXTHOP_TYPE_BLACKHOLE)
+ return RMAP_MATCH;
+ }
+ return RMAP_NOMATCH;
+}
+
+static void *route_match_ip_next_hop_type_compile(const char *arg)
+{
+ return XSTRDUP(MTYPE_ROUTE_MAP_COMPILED, arg);
+}
+
+static void route_match_ip_next_hop_type_free(void *rule)
+{
+ XFREE(MTYPE_ROUTE_MAP_COMPILED, rule);
+}
+
+static struct route_map_rule_cmd route_match_ip_next_hop_type_cmd = {
+ "ip next-hop type", route_match_ip_next_hop_type,
+ route_match_ip_next_hop_type_compile,
+ route_match_ip_next_hop_type_free};
+
/* `match source-protocol PROTOCOL' */
static route_map_result_t route_match_source_protocol(void *rule,
route_map_match_ip_next_hop_prefix_list_hook(generic_match_add);
route_map_no_match_ip_next_hop_prefix_list_hook(generic_match_delete);
+ route_map_match_ip_next_hop_type_hook(generic_match_add);
+ route_map_no_match_ip_next_hop_type_hook(generic_match_delete);
+
route_map_match_tag_hook(generic_match_add);
route_map_no_match_tag_hook(generic_match_delete);
route_map_match_ipv6_address_prefix_list_hook(generic_match_add);
route_map_no_match_ipv6_address_prefix_list_hook(generic_match_delete);
+ route_map_match_ipv6_next_hop_type_hook(generic_match_add);
+ route_map_no_match_ipv6_next_hop_type_hook(generic_match_delete);
+
route_map_install_match(&route_match_tag_cmd);
route_map_install_match(&route_match_interface_cmd);
route_map_install_match(&route_match_ip_next_hop_cmd);
route_map_install_match(&route_match_ip_address_prefix_len_cmd);
route_map_install_match(&route_match_ipv6_address_prefix_len_cmd);
route_map_install_match(&route_match_ip_nexthop_prefix_len_cmd);
+ route_map_install_match(&route_match_ip_next_hop_type_cmd);
+ route_map_install_match(&route_match_ipv6_next_hop_type_cmd);
route_map_install_match(&route_match_source_protocol_cmd);
route_map_install_match(&route_match_source_instance_cmd);
#include "zebra_nhg.h"
#include "debug.h"
+DEFINE_MTYPE_STATIC(ZEBRA, RIB_TABLE_INFO, "RIB table info")
+
struct zebra_router zrouter = {
.multipath_num = MULTIPATH_NUM,
.ipv4_multicast_mode = MCAST_NO_CONFIG,
static void zebra_rnhtable_node_cleanup(struct route_table *table,
struct route_node *node);
-DEFINE_MTYPE_STATIC(ZEBRA, OTHER_TABLE, "Other Table");
+DEFINE_MTYPE_STATIC(ZEBRA, ZEBRA_VRF, "ZEBRA VRF")
+DEFINE_MTYPE_STATIC(ZEBRA, OTHER_TABLE, "Other Table")
/* VRF information update. */
static void zebra_vrf_add_update(struct zebra_vrf *zvrf)
vty_out(vty, " %-5u", vid);
else
json_object_int_add(json_mac, "vlan", vid);
- }
+ } else /* No vid? fill out the space */
+ vty_out(vty, " %-5s", "");
+ vty_out(vty, " %u/%u", mac->loc_seq, mac->rem_seq);
if (json_mac_hdr == NULL) {
vty_out(vty, "\n");
} else {
if ((wctx->flags & SHOW_REMOTE_MAC_FROM_VTEP) &&
(wctx->count == 0)) {
vty_out(vty, "\nVNI %u\n\n", wctx->zvni->vni);
- vty_out(vty, "%-17s %-6s %-21s %-5s\n", "MAC",
- "Type", "Intf/Remote VTEP", "VLAN");
+ vty_out(vty, "%-17s %-6s %-21s %-5s %s\n",
+ "MAC", "Type", "Intf/Remote VTEP",
+ "VLAN", "Seq #'s");
}
- vty_out(vty, "%-17s %-6s %-21s\n", buf1, "remote",
- inet_ntoa(mac->fwd_info.r_vtep_ip));
+ vty_out(vty, "%-17s %-6s %-21s %-5s %u/%u\n", buf1,
+ "remote", inet_ntoa(mac->fwd_info.r_vtep_ip),
+ "", mac->loc_seq, mac->rem_seq);
} else {
json_object_string_add(json_mac, "type", "remote");
json_object_string_add(json_mac, "remoteVtep",
if (json == NULL) {
vty_out(vty, "\nVNI %u #MACs (local and remote) %u\n\n",
zvni->vni, num_macs);
- vty_out(vty, "%-17s %-6s %-21s %-5s\n", "MAC", "Type",
- "Intf/Remote VTEP", "VLAN");
+ vty_out(vty, "%-17s %-6s %-21s %-5s %s\n", "MAC",
+ "Type", "Intf/Remote VTEP", "VLAN", "Seq #'s");
} else
json_object_int_add(json_vni, "numMacs", num_macs);
}