]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #4294 from adharkar/frr-master-fpm_rmac
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 22 Jun 2019 17:28:49 +0000 (13:28 -0400)
committerGitHub <noreply@github.com>
Sat, 22 Jun 2019 17:28:49 +0000 (13:28 -0400)
Zebra: EVPN remote RMAC download via FPM channel using netlink msg format

125 files changed:
README.md
babeld/babel_interface.c
babeld/babel_memory.c [deleted file]
babeld/babel_memory.h [deleted file]
babeld/babeld.c
babeld/subdir.am
babeld/util.h
bfdd/bfd.c
bfdd/bfd.h
bfdd/bfdd.c
bfdd/config.c
bgpd/bgp_addpath.c
bgpd/bgp_clist.c
bgpd/bgp_clist.h
bgpd/bgp_errors.c
bgpd/bgp_errors.h
bgpd/bgp_evpn.c
bgpd/bgp_evpn_vty.c
bgpd/bgp_mac.c
bgpd/bgp_packet.c
bgpd/bgp_route.c
bgpd/bgp_route.h
bgpd/bgp_routemap.c
bgpd/bgp_updgrp.c
bgpd/bgp_vty.c
bgpd/bgpd.c
bgpd/bgpd.conf.sample
bgpd/bgpd.h
bgpd/rfapi/rfapi.c
configure.ac
doc/developer/building-frr-for-fedora.rst
doc/developer/memtypes.rst
doc/user/bgp.rst
doc/user/filter.rst
doc/user/routeserver.rst
doc/user/setup.rst
doc/user/vnc.rst
docker/debian/Dockerfile
docker/debian/README.md
docker/debian/daemons [deleted file]
isisd/isis_northbound.c
ldpd/packet.c
lib/command.c
lib/command.h
lib/command_py.c
lib/frr_pthread.c
lib/frr_pthread.h
lib/frrlua.c
lib/hash.c
lib/hash.h
lib/id_alloc.c
lib/if.c
lib/if.h
lib/memory.h
lib/ntop.c
lib/plist.c
lib/routemap.c
lib/table.c
lib/table.h
lib/typerb.c
lib/typesafe.c
lib/yang.c
lib/yang.h
ospfd/ospf_routemap.c
ospfd/ospf_spf.c
pimd/pim_bsm.c
pimd/pim_ifchannel.c
pimd/pim_igmpv3.c
pimd/pim_mroute.c
pimd/pim_msg.h
pimd/pim_oil.c
pimd/pim_oil.h
pimd/pim_upstream.c
pimd/pim_vty.c
pimd/pim_zebra.c
ripd/rip_interface.c
ripd/rip_interface.h
ripd/rip_memory.c [deleted file]
ripd/rip_memory.h [deleted file]
ripd/rip_northbound.c
ripd/rip_offset.c
ripd/rip_peer.c
ripd/rip_routemap.c
ripd/ripd.c
ripd/ripd.h
ripd/subdir.am
ripngd/ripng_interface.c
ripngd/ripng_memory.c [deleted file]
ripngd/ripng_memory.h [deleted file]
ripngd/ripng_nexthop.c
ripngd/ripng_northbound.c
ripngd/ripng_offset.c
ripngd/ripng_peer.c
ripngd/ripng_route.c
ripngd/ripngd.c
ripngd/ripngd.h
ripngd/subdir.am
tests/lib/test_idalloc.c
tests/lib/test_seqlock.c
tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py
tests/topotests/bgp_multiview_topo1/README.md
tests/topotests/bgp_multiview_topo1/r1/bgpd.conf
vrrpd/subdir.am
vrrpd/vrrp.c
vrrpd/vrrp.h
vrrpd/vrrp_main.c
vrrpd/vrrp_memory.c [deleted file]
vrrpd/vrrp_memory.h [deleted file]
vrrpd/vrrp_packet.c
vrrpd/vrrp_packet.h
vrrpd/vrrp_vty.c
vtysh/vtysh_config.c
zebra/kernel_netlink.c
zebra/rt_netlink.c
zebra/rtadv.c
zebra/zebra_dplane.c
zebra/zebra_memory.c
zebra/zebra_memory.h
zebra/zebra_rib.c
zebra/zebra_rnh.c
zebra/zebra_rnh.h
zebra/zebra_routemap.c
zebra/zebra_router.c
zebra/zebra_vrf.c
zebra/zebra_vxlan.c

index a7725d5e4ed80f1c87f7384a405b40b913f6fd34..e8c775684a5b5e86627fe8a5120a6958bac9a25c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -20,6 +20,7 @@ FRR currently supports the following protocols:
 * Babel
 * PBR
 * OpenFabric
+* VRRP
 * EIGRP (alpha)
 * NHRP (alpha)
 
index b84bc39cd8dfb58b1e6662f3b87440d2492d7bf6..0eeb9b2bbbfaac3d459ed23831a15e16cfd6cea7 100644 (file)
@@ -39,9 +39,10 @@ THE SOFTWARE.
 #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);
diff --git a/babeld/babel_memory.c b/babeld/babel_memory.c
deleted file mode 100644 (file)
index a10b779..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* 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")
diff --git a/babeld/babel_memory.h b/babeld/babel_memory.h
deleted file mode 100644 (file)
index 4283498..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 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 */
index 39451b435a44ec59b7876dafcb2dbdf39cc0ac42..6ad004a4a41a011f738df0b6e70daf2b10999a6d 100644 (file)
@@ -43,9 +43,11 @@ THE SOFTWARE.
 #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);
index 7081c730aa2db7a1613bbd55c6a485d3832d12ec..dd46675f2233134d2849c5d5b7d430e0dc61f468 100644 (file)
@@ -17,7 +17,6 @@ babeld_libbabel_a_SOURCES = \
        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 \
@@ -36,7 +35,6 @@ noinst_HEADERS += \
        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 \
index 7b836c2e4c19d9051e219868bb124623e6848c9d..00a025ff93eb3eef0aa33054926546777f6807a7 100644 (file)
@@ -27,6 +27,9 @@ THE SOFTWARE.
 #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)
index 43544318204f9de701990cf603f247d2a5654b4f..08a70abc1ea29435d94e0b1b4516175382280764 100644 (file)
 
 #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
@@ -1552,41 +1555,41 @@ static int bfd_vrf_enable(struct vrf *vrf)
        } 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);
index 213e905bf0a86ab169f0b6f973d5c6a65bbf4003..ec31c8cbc6e9d9d56eca8735c2b3866bcf9d1c1c 100644 (file)
 #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;
@@ -259,9 +254,9 @@ struct bfd_session {
        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;
index 06e01abcfa31031f4f8162c4d9cb3a2f5ed07778..6c277c98f53a4e69bb174cda2c866b85a141e613 100644 (file)
 /*
  * 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;
index 74e7d63d0c6ee69790f43fb9085083a94e11f231..0c0bac0aaa3150e99522cbf5be19c1ae26bb43d4 100644 (file)
@@ -30,6 +30,8 @@
 
 #include "bfd.h"
 
+DEFINE_MTYPE_STATIC(BFDD, BFDD_LABEL, "long-lived label memory")
+
 /*
  * Definitions
  */
index 63373cb9a73f5d1e5014711a83daaf86254dee3d..0ca4b613eecd2e52749316cb4ccd6b6b793979a7 100644 (file)
  * 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"
 
index b9a5784799c6df89e0ebb8ebda00aeaeb9ae5ed8..ce617fe6b51b82fd5cb8feca246d1e9f361692a3 100644 (file)
@@ -695,6 +695,32 @@ int lcommunity_list_match(struct lcommunity *lcom, struct community_list *list)
        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;
index 75a31611bae86b16dd771fadb1f20933f1301283..87b29ac3bebe92a21a12024c7f9c88e8c7f3ddef 100644 (file)
@@ -165,6 +165,8 @@ extern int ecommunity_list_match(struct ecommunity *, struct community_list *);
 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 *
index 6e181697d64c07bf6da7cee88f00ae1678ef2051..d9aba87e35ceda8d0f37eeb4f5738a6437f8ccc7 100644 (file)
@@ -426,12 +426,6 @@ static struct log_ref ferr_bgp_err[] = {
                .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",
index 39d043ff13c43662dde54ce999132bcc8fa748df..35c5cc3998eabdb30e57fc69ec13f2f568ec4e3a 100644 (file)
@@ -67,7 +67,6 @@ enum bgp_log_refs {
        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,
index c4b2a606c58e96d260766607ef06c982f6c4bf1f..94022ec1bed933540afaaa08f59b17f5405ed080 100644 (file)
@@ -5533,10 +5533,6 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni, vrf_id_t vrf_id, struct ethaddr *rmac,
                              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);
index 67b0079c37bf4a03d6dfcdf3363e0a7c66f0b981..ca6edffab088c6f6956655fdbfc0ba51bc7d9a8d 100644 (file)
@@ -1060,6 +1060,9 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
 
                                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;
@@ -1132,8 +1135,6 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
                                        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",
@@ -1184,6 +1185,7 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
                                                      SAFI_EVPN, json_array);
                                output_count++;
                        }
+                       rd_header = 0;
                        if (use_json) {
                                json_object_object_add(json_prefix_info,
                                        "paths", json_array);
index f19453fecb68db648532a1da44d79f9b19d7a6e0..61c7b4080c8600790769a6283c6d889e817753ae 100644 (file)
@@ -29,6 +29,7 @@
 #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"
 
@@ -133,11 +134,11 @@ static struct bgp_self_mac *bgp_mac_find_interface_name(const char *ifname)
 }
 
 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;
@@ -146,12 +147,21 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer,
                        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;
@@ -160,6 +170,14 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer,
                        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)
@@ -169,6 +187,23 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer,
                        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,
@@ -184,7 +219,7 @@ static void bgp_process_mac_rescan_table(struct bgp *bgp, struct peer *peer,
        }
 }
 
-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;
@@ -214,12 +249,12 @@ static void bgp_mac_rescan_evpn_table(struct bgp *bgp)
                        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;
@@ -228,11 +263,12 @@ static void bgp_mac_rescan_all_evpn_tables(void)
                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;
@@ -252,7 +288,7 @@ static void bgp_mac_remove_ifp_internal(struct bgp_self_mac *bsm, char *ifname)
                list_delete(&bsm->ifp_list);
                XFREE(MTYPE_BSM, bsm);
 
-               bgp_mac_rescan_all_evpn_tables();
+               bgp_mac_rescan_all_evpn_tables(macaddr);
        }
 }
 
@@ -276,22 +312,26 @@ void bgp_mac_add_mac_entry(struct interface *ifp)
 
                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)
@@ -308,7 +348,7 @@ 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
index bb9c3940474f2fb42b91cc467f7591ec510ab29d..5654fe5329854b6a7acffd40cd98564a3dde365d 100644 (file)
@@ -1048,7 +1048,7 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
        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];
@@ -1091,9 +1091,11 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size)
                 * 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) {
index c7188cdc785267e76798c8641907fe280b153489..b90097a4f25cdc2cc84e03e177f8a3f43922b1a4 100644 (file)
@@ -22,6 +22,7 @@
 #include <zebra.h>
 #include <math.h>
 
+#include "printfrr.h"
 #include "prefix.h"
 #include "linklist.h"
 #include "memory.h"
@@ -6531,28 +6532,38 @@ DEFUN (no_aggregate_address_mask,
 
 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);
@@ -7511,10 +7522,9 @@ void route_vty_out_tmp(struct vty *vty, struct prefix *p, struct attr *attr,
                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");
 }
@@ -7577,8 +7587,6 @@ void route_vty_out_tag(struct vty *vty, struct prefix *p,
                               && 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)
@@ -7596,27 +7604,15 @@ void route_vty_out_tag(struct vty *vty, struct prefix *p,
                                                        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);
                        }
                }
        }
@@ -9171,6 +9167,15 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
                                                         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;
 
@@ -9178,6 +9183,14 @@ static int bgp_show_table(struct vty *vty, struct bgp *bgp, safi_t safi,
                                                           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;
@@ -9801,8 +9814,8 @@ static int bgp_show_route(struct vty *vty, struct bgp *bgp, const char *ip_str,
 }
 
 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;
@@ -9833,13 +9846,15 @@ static int bgp_show_lcommunity(struct vty *vty, struct bgp *bgp, int argc,
                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;
 
@@ -9851,13 +9866,15 @@ static int bgp_show_lcommunity_list(struct vty *vty, struct bgp *bgp,
                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
@@ -9867,12 +9884,14 @@ DEFUN (show_ip_bgp_large_community_list,
        "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;
@@ -9896,12 +9915,18 @@ DEFUN (show_ip_bgp_large_community_list,
        }
 
        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
@@ -9910,12 +9935,14 @@ DEFUN (show_ip_bgp_large_community,
        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;
@@ -9938,9 +9965,12 @@ DEFUN (show_ip_bgp_large_community,
                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);
 }
index f7150844509704e199fc85ab273e197997cd2f25..0f2363dc6f49f9959f5372ce45a0952bf4025633 100644 (file)
@@ -45,7 +45,9 @@ enum bgp_show_type {
        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,
index 28a763ed5e51ed17f21f67f68ee61acb827eb44a..a212523b194b552ac29c9e115665605472680d94 100644 (file)
@@ -1173,8 +1173,17 @@ static route_map_result_t route_match_lcommunity(void *rule,
                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;
 }
@@ -1193,6 +1202,7 @@ static void *route_match_lcommunity_compile(const char *arg)
                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;
@@ -3796,26 +3806,45 @@ DEFUN (no_match_community,
 
 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);
index d0be2471af02b841a4ca9b376739732b26697bf9..82df1905ba5c7615f598c6a3b6f54ffb54d2204b 100644 (file)
@@ -885,6 +885,9 @@ static void update_subgroup_add_peer(struct update_subgroup *subgrp,
        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);
 }
 
 /*
@@ -910,6 +913,10 @@ static void update_subgroup_remove_peer_internal(struct update_subgroup *subgrp,
        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);
 }
 
@@ -1826,9 +1833,9 @@ void peer_af_announce_route(struct peer_af *paf, int combine)
         */
        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",
index a18a3bb952e69e96d2e0c059b6887f8984ddf11e..091d8f0317bbdceae91b2ddf1dec2d463f362eb8 100644 (file)
@@ -979,10 +979,6 @@ DEFUN_NOSH (router_bgp,
 
                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;
@@ -4825,14 +4821,15 @@ static int peer_default_originate_set_vty(struct vty *vty, const char *peer_str,
 {
        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
@@ -7726,14 +7723,6 @@ DEFUN (show_bgp_memory,
                                     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),
index af90e9841a2e04f3b00a490fde113e3bfb3bde28..3ca209676f276e170e2513801dd0d45f97ec6e39 100644 (file)
@@ -3183,7 +3183,7 @@ int bgp_get(struct bgp **bgp_val, as_t *as, const char *name,
                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);
@@ -3217,7 +3217,7 @@ int bgp_get(struct bgp **bgp_val, as_t *as, const char *name,
                bgp_zebra_instance_register(bgp);
        }
 
-       return 0;
+       return BGP_SUCCESS;
 }
 
 /*
index cb12a925224270dbfe6cd71437789fe6155832ed..1fb4f1600bd4b9ee0a581d690f94b466be11aa6a 100644 (file)
@@ -8,7 +8,6 @@ hostname bgpd
 password zebra
 !enable password please-set-at-here
 !
-!bgp multiple-instance
 !
 router bgp 7675
 ! bgp router-id 10.0.0.1
index 088c6411b4729a98a8500e09602d9b56c376efe7..4bce73898f4991b384b9e873f36aab12939d92ec 100644 (file)
@@ -1453,12 +1453,10 @@ enum bgp_clear_type {
 #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
index 5525547454857273bac647576236225fa7669e07..e7905e56225530f5fe2fe3df84604524a187a65d 100644 (file)
@@ -2929,7 +2929,7 @@ DEFUN (debug_rfapi_open,
 {
        struct rfapi_ip_addr vn;
        struct rfapi_ip_addr un;
-       uint32_t lifetime;
+       uint32_t lifetime = 0;
        int rc;
        rfapi_handle handle;
 
index 828692c3eb3ba42ef715d4a2021def4b2af822b6..9b57c2ec9b3461ca9ba6511ac9479137f04b6b9d 100755 (executable)
@@ -407,14 +407,19 @@ AC_SUBST([ARFLAGS])
 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 ----------------------
index 0208f1146b401949597747862378d917a4b6eacf..0bfd43e93cbdb8c73cb1a6aab38e813eb8750633 100644 (file)
@@ -98,6 +98,18 @@ And load the kernel modules on the running system:
 
    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
 ^^^^^^^^^^^^^^^^^^^^^
 
index 153131bab927d2144a8a7c5989930f1232cac04e..13f6b43bbfd6510b8a5615186346a46ecf0eaaf7 100644 (file)
@@ -42,6 +42,16 @@ Example:
 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
index 1831363e19d3f87b6a67ab08047aadce1e9ea34a..f2b132807529f980f3fa35099355c144207342a3 100644 (file)
@@ -267,29 +267,6 @@ An example configuration with multiple autonomous systems might look like this:
     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`
 
@@ -688,6 +665,11 @@ Networks
 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
 
@@ -707,6 +689,62 @@ Route Aggregation
 
 .. 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:
 
@@ -1736,13 +1774,15 @@ Two types of large community lists are supported, namely `standard` and
 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
@@ -2235,8 +2275,49 @@ attribute.
    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
 ----------------------------
 
@@ -2302,7 +2383,6 @@ different filter for a peer.
 
 .. code-block:: frr
 
-   bgp multiple-instance
    !
    router bgp 1 view 1
     neighbor 10.0.0.1 remote-as 2
index 9d7361443d2ef23129378f667ab9ee0d376c2bab..8c86d0608753b0450c2d0d7d4f1a0748d3948daa 100644 (file)
@@ -165,14 +165,8 @@ Showing ip prefix-list
 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.
index e677a3030d9004d1351974336d63eb785ccc2d4c..474a68db251e8e8d9d37938d2dde560e29210463 100644 (file)
@@ -369,8 +369,6 @@ the policies for client RA):
    hostname RS
    password ix
    !
-   bgp multiple-instance
-   !
    router bgp 65000 view RS
      no bgp default ipv4-unicast
      neighbor 2001:0DB8::A  remote-as 65001
index 2cdd3a7c7fd36a86d94006bc70e57d75d7205339..6d61a970d205b3598a31dc766c936170f0fe66fb 100644 (file)
@@ -134,6 +134,7 @@ add the following entries to :file:`/etc/services`.
    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
@@ -142,7 +143,7 @@ number when starting the daemon, these entries may not be needed.
 
 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
@@ -153,3 +154,70 @@ location. A good place is usually ``/etc/systemd/system/``.
 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.
index d0934fe6face99b55f6db3f48c1aa46eb5f55444..cb9c74ceea00374ada7a0cd8a5d0cde6edbc8edd 100644 (file)
@@ -468,8 +468,8 @@ redistributed to VNC as bgp-direct-to-nve-groups routes. These routes are NOT
 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
index fde29d4911dc9601ab3a5b28d67044ff502abbd1..6ffdd0ccb3ff0cb70d8342413d68d6781bc1a20b 100644 (file)
@@ -9,6 +9,5 @@ RUN curl -s https://deb.frrouting.org/frr/keys.asc | apt-key add -
 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"]
index b10d696a78a105b0dbd0384e636b3cc87df5f757..3c1209bc97caa85a4e4244c6ab5e5726b50cfe28 100644 (file)
@@ -1,14 +1,17 @@
-# 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
diff --git a/docker/debian/daemons b/docker/debian/daemons
deleted file mode 100644 (file)
index ed4d98e..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-# 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.
index d5cdec154b4d3c5817a8fc776016ea881f378abb..ffc6ee0464b69f27b27746d80ac870c9bb83d2af 100644 (file)
@@ -2741,478 +2741,680 @@ const struct frr_yang_module_info frr_isisd_info = {
        .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,
index 8ca90841de82e57ce7ead41e2c6dc747016853ad..dfab30eeb338acd84c5325cac5e42ac40fb48f56 100644 (file)
@@ -618,12 +618,17 @@ session_read(struct thread *thread)
                        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);
 }
 
index 0e16f30a8a29f6ddfc27f287203aba3d98c84ce5..f257c7d0f9565b11193381b5f4137c86eaeb5ce8 100644 (file)
@@ -48,7 +48,7 @@
 #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)                                                                \
@@ -84,6 +84,7 @@ const char *node_names[] = {
        "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,
index d6c41e08244cf372a5606f0b68833179e24c4182..fd8b56d62e9e8a8911ac5d752853b23fbc730779 100644 (file)
@@ -34,7 +34,6 @@
 extern "C" {
 #endif
 
-DECLARE_MTYPE(HOST)
 DECLARE_MTYPE(COMPLETION)
 
 /*
@@ -94,6 +93,7 @@ enum node_type {
        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. */
index 58b7982665571a927b3cb0951ed622b2573f95a9..4ec116df330f38043c427a7d4ca2383780536a59 100644 (file)
  * 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>
@@ -321,6 +327,7 @@ static struct PyModuleDef pymoddef_clippy = {
        } while (0)
 #endif
 
+#pragma GCC diagnostic ignored "-Wstrict-aliasing"
 PyMODINIT_FUNC command_py_init(void)
 {
        PyObject *pymod;
index 2a18e5cfc6ac1c8692a359268efdd8bb39e0087b..e588571c014acbf227148da41fd6cf3636a0e5cd 100644 (file)
@@ -28,8 +28,8 @@
 #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);
index 9bc7b94033b2dd6688d2dcf84cc2bfb227101e2d..3afe7ba966a5d293e0e586c6b5978768e447b948 100644 (file)
@@ -29,9 +29,6 @@
 extern "C" {
 #endif
 
-DECLARE_MTYPE(FRR_PTHREAD);
-DECLARE_MTYPE(PTHREAD_PRIM);
-
 #define OS_THREAD_NAMELEN 16
 
 struct frr_pthread;
index b7d8eea6e8d3c715abd00dd453a3eb484f6a8648..26610556dc1051e653d095f87b3e014e7acc3270 100644 (file)
@@ -20,7 +20,6 @@
  * 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>
 
index fad7de51385d4e6866e893eefb3e76fa3c543983..9d9d39702ec9deacb8d85e45849e9ce60e0ac592 100644 (file)
@@ -29,8 +29,8 @@
 #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;
index c56a98d50c64adc3a6cbaba5a1dede33e423aa04..7b3372d433871e28d62835db10fa9f799d26b8a7 100644 (file)
@@ -28,9 +28,6 @@
 extern "C" {
 #endif
 
-DECLARE_MTYPE(HASH)
-DECLARE_MTYPE(HASH_BACKET)
-
 /* Default hash table size.  */
 #define HASH_INITIAL_SIZE 256
 /* Expansion threshold */
index 222ba651b407ed642274dbbcab1ae4c323c33981..7c7f2c46898602a4b9414aaa8b75bc2228f6d810 100644 (file)
  * 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"
index 3f489e0c3e054875970746de1ddb75d48e563647..f7a167f251b95d2e524933ca708e5041d86dfcc7 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -39,7 +39,7 @@
 #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")
@@ -1422,15 +1422,19 @@ const struct frr_yang_module_info frr_interface_info = {
        .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,
index 2dc1a7b2de237a6e9c4849499aa8b0089ac1fa9e..603c9c3780cfd2beed09e9ec20d18b9cce21a619 100644 (file)
--- a/lib/if.h
+++ b/lib/if.h
@@ -31,7 +31,6 @@
 extern "C" {
 #endif
 
-DECLARE_MTYPE(IF)
 DECLARE_MTYPE(CONNECTED_LABEL)
 
 /* Interface link-layer type, if known. Derived from:
index 0002ea3349ad20e68175f3e3350a0e13dd48609a..14cd76f2f50937dcd8d1e84d080b1dc1946bf974 100644 (file)
@@ -102,9 +102,14 @@ struct memgroup {
        }
 
 
+/* 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                                        \
@@ -130,12 +135,21 @@ struct memgroup {
                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)
index d47a0b697aa699dde6e3e080c6889cc35126a003..066e10e3e485a12dc3e530799a21c5a1308fe703 100644 (file)
@@ -81,7 +81,7 @@ static inline void puthex(uint16_t word, char **posx)
 
 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)
@@ -170,5 +170,5 @@ inet4:
  * 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
index 54ea742c66c8a22522a2a38b1dfccf94e8f0c23c..1ba898249966096ed039d916cc2134b4b180c074 100644 (file)
@@ -750,6 +750,7 @@ enum prefix_list_type prefix_list_apply_which_prefix(
        if (pbest == NULL)
                return PREFIX_DENY;
 
+       pbest->hitcnt++;
        return pbest->type;
 }
 
index 9336154b1af5039b9c495c8e0ffaec78445cc6ac..6e6a1d99e01e814c642a52c4b45e75425322a68f 100644 (file)
@@ -112,14 +112,14 @@ struct route_map_match_set_hooks {
                                                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,
@@ -160,7 +160,7 @@ struct route_map_match_set_hooks {
                                              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,
@@ -303,7 +303,7 @@ void route_map_no_match_ip_next_hop_prefix_list_hook(int (*func)(
        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))
@@ -311,7 +311,7 @@ void route_map_match_ip_next_hop_type_hook(int (*func)(
        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))
@@ -688,7 +688,7 @@ static unsigned int route_map_dep_hash_make_key(const void *p);
 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);
 
@@ -739,6 +739,9 @@ static struct route_map *route_map_add(const char *name)
                (*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;
 }
 
@@ -757,6 +760,9 @@ static void route_map_free_map(struct route_map *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);
@@ -921,6 +927,24 @@ static const char *route_map_type_str(enum route_map_type type)
        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)
@@ -1066,6 +1090,10 @@ static void route_map_index_delete(struct route_map_index *index, int notify)
 
        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);
@@ -1152,6 +1180,11 @@ route_map_index_add(struct route_map *map, enum route_map_type type, int pref)
                (*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;
 }
 
@@ -1612,6 +1645,7 @@ route_map_result_t route_map_apply(struct route_map *map,
        int ret = 0;
        struct route_map_index *index;
        struct route_map_rule *set;
+       char buf[PREFIX_STRLEN];
 
        if (recursion > RMAP_RECURSION_LIMIT) {
                flog_warn(
@@ -1622,8 +1656,10 @@ route_map_result_t route_map_apply(struct route_map *map,
                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) {
@@ -1632,6 +1668,13 @@ route_map_result_t route_map_apply(struct route_map *map,
                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
@@ -1666,12 +1709,12 @@ route_map_result_t route_map_apply(struct route_map *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: {
@@ -1686,19 +1729,30 @@ route_map_result_t route_map_apply(struct route_map *map,
                                        }
                                        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 *))
@@ -1835,8 +1889,8 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
        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) {
@@ -1864,8 +1918,8 @@ static int route_map_dep_update(struct hash *dephash, const char *dep_name,
        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;
@@ -1979,8 +2033,7 @@ static void route_map_process_dependency(struct hash_bucket *bucket, void *data)
        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);
 }
@@ -2027,6 +2080,8 @@ void route_map_notify_dependencies(const char *affected_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);
        }
@@ -2379,7 +2434,7 @@ DEFUN (no_match_ipv6_address_prefix_list,
 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")
 {
@@ -3006,6 +3061,30 @@ DEFUN (no_rmap_description,
        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)
 {
@@ -3051,6 +3130,18 @@ 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};
 
@@ -3164,15 +3255,22 @@ void route_map_init(void)
 
        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);
@@ -3196,6 +3294,9 @@ void route_map_init(void)
        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);
 
index 728615c7760180eb22ae9899f402b4f513f5a534..1a89a95f4f9fb9a8a7d8991ead0ad285b704639c 100644 (file)
@@ -28,7 +28,7 @@
 #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 *);
index eefd992546a5614e2b10e6ac9030d794452e411e..57b65ac4ba90cb3f93d8c596a0e4172cb894cbc3 100644 (file)
@@ -31,7 +31,6 @@
 extern "C" {
 #endif
 
-DECLARE_MTYPE(ROUTE_TABLE)
 DECLARE_MTYPE(ROUTE_NODE)
 
 /*
index d361e7651e607b786efe25d8c1d6445fe9b18f5e..4c48d6434f411cdd8bf19381dadb542f9e2cf0ef 100644 (file)
  * 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
index 47a6d0af487f890f1ff27cdd10b84e2fc5f3604f..f2ca67b7c66b690f5f10c0b66ae0d9cbfa595184 100644 (file)
  * 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>
 
index 2f9a9aa5a3d79f76c7f46a1070044a270aa30429..674f3610d6f004b47c34b738c3885458908f1b7f 100644 (file)
@@ -27,8 +27,8 @@
 
 #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;
index 6f8c84ab64276050933cbff90639e1b3bc98ea06..322c74c76a5fe6458bd7d303cf81479a02736106 100644 (file)
@@ -33,9 +33,6 @@
 extern "C" {
 #endif
 
-DECLARE_MTYPE(YANG_MODULE)
-DECLARE_MTYPE(YANG_DATA)
-
 /* Maximum XPath length. */
 #define XPATH_MAXLEN 256
 
index ab2d5ae5844cec5584445526bfb5a768baeb76f6..bb7e97bf7beba4d50026a673599d8ea84bd79682 100644 (file)
@@ -210,6 +210,40 @@ struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd = {
        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. */
@@ -566,6 +600,9 @@ void ospf_route_map_init(void)
        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);
 
@@ -579,6 +616,7 @@ void ospf_route_map_init(void)
        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);
 
index 296a05bdf141ca5d769c447add2802a34b9e5d71..f5fe51d54704d88f6d0543dd12265fd29c7ebd2f 100644 (file)
@@ -879,6 +879,9 @@ static void ospf_spf_next(struct vertex *v, struct ospf *ospf,
                                          "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;
@@ -892,6 +895,9 @@ static void ospf_spf_next(struct vertex *v, struct ospf *ospf,
                                        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
@@ -929,11 +935,7 @@ static void ospf_spf_next(struct vertex *v, struct ospf *ospf,
                   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) {
index 4ba8d08fe3a3bd4d5800ab878cfcbe6cbdd2fed6..266d3ffcf521824ce13f4721a6fc55af6fdc162f 100644 (file)
  * 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"
index 9b242e9be5fdf572b6097a425879de3ed6acad91..3fb3da8f4450a274ebe9ddcc760e6da5d1238c67 100644 (file)
@@ -613,6 +613,10 @@ static int on_ifjoin_expiry_timer(struct thread *t)
 
        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 */
 
index bc0460fa0397072ae44198afc94dfbf3774b797b..d9b940bba7203a10107c5455bb2f15591bdaa358 100644 (file)
@@ -332,7 +332,8 @@ void igmp_source_free(struct igmp_source *source)
 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;
        }
 }
index ca0582434768dfba7da251fac285be22ba26c896..2bdec12cd1a8f26e84efe823a0ba065e512d2ba7 100644 (file)
@@ -203,7 +203,8 @@ static int pim_mroute_msg_nocache(int fd, struct interface *ifp,
                 * 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;
@@ -523,7 +524,8 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp,
                        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,
@@ -548,7 +550,8 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp,
        }
 
        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)) {
index 5f5030396750cc4cb9b0a6694e4cfd0b965d8d27..b6e2cada1fab1b3336159816f78042aea4d5abef 100644 (file)
@@ -66,9 +66,19 @@ struct pim_encoded_ipv4_unicast {
        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 */
@@ -76,9 +86,20 @@ struct pim_encoded_group_ipv4 {
        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;
index 22045c2d337c99ac27aa2b60fa2a768e43959018..d4fc03e20c4ac5db111454534ee34d0b1b427419 100644 (file)
 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);
                }
        }
@@ -144,7 +148,7 @@ struct channel_oil *pim_find_channel_oil(struct pim_instance *pim,
 
 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;
@@ -153,18 +157,23 @@ struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
        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;
        }
 
@@ -173,9 +182,8 @@ struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
                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);
                }
        }
 
@@ -193,11 +201,23 @@ struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
 
        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) {
@@ -344,10 +364,12 @@ int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif,
          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;
        }
 
index d097da6b3eb761959bf521f000533b288c6eacd8..485299196db48e66a28c75f2c313a03e211c78c0 100644 (file)
@@ -113,8 +113,8 @@ struct channel_oil *pim_find_channel_oil(struct pim_instance *pim,
                                         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);
index 50c68c66bdc2cfdaa85b2727bed30d269e0633a9..2e6c5c7803501e333b7b6ab34bbf63eb8df53733 100644 (file)
@@ -146,7 +146,7 @@ static void upstream_channel_oil_detach(struct pim_upstream *up)
                   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;
        }
 }
@@ -740,13 +740,15 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim,
                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);
@@ -759,14 +761,15 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim,
                         * 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__);
                }
        }
 
@@ -1524,8 +1527,9 @@ int pim_upstream_inherited_olist_decide(struct pim_instance *pim,
                                   __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)
index 468cd56ee55bf315726948b9433ba2b8ca065a99..d1935195df4855a037c5f162f3562aa5f7847247 100644 (file)
@@ -70,10 +70,6 @@ int pim_debug_config_write(struct vty *vty)
                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");
index 25ac307ac43defc1b51e27ba89d169df7da729db..4cebc43a0a0563d7c96de346d5833f640405d348 100644 (file)
@@ -974,8 +974,8 @@ void igmp_source_forward_start(struct pim_instance *pim,
                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) {
@@ -1035,7 +1035,9 @@ void igmp_source_forward_start(struct pim_instance *pim,
                                            source_str);
                                }
                                source->source_channel_oil =
-                                   pim_channel_oil_add(pim, &sg, MAXVIFS);
+                                       pim_channel_oil_add(
+                                               pim, &sg, MAXVIFS,
+                                               __PRETTY_FUNCTION__);
                        }
 
                        else {
@@ -1043,10 +1045,12 @@ void igmp_source_forward_start(struct pim_instance *pim,
                                 * 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) {
@@ -1065,8 +1069,9 @@ void igmp_source_forward_start(struct pim_instance *pim,
                                }
 
                                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(
@@ -1241,13 +1246,14 @@ void pim_forward_start(struct pim_ifchannel *ch)
                                        __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(
@@ -1268,8 +1274,9 @@ void pim_forward_start(struct pim_ifchannel *ch)
                                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(
index 634fee0b3025ad57776ddfdcd230f8af57cbb94d..80561f350ba2abcf901d1873c5447f2477e80387 100644 (file)
@@ -43,6 +43,8 @@
 #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))
 
index 6befda0e28606c883690ee6e880de9fdd3bef9c7..715daf2e503b63a60d5cc46cbfc21381ec4b2351 100644 (file)
 #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);
diff --git a/ripd/rip_memory.c b/ripd/rip_memory.c
deleted file mode 100644 (file)
index 7d703a8..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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")
diff --git a/ripd/rip_memory.h b/ripd/rip_memory.h
deleted file mode 100644 (file)
index 1f9d8f5..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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 */
index d4fde5519bfcd2112a932c5f8b1d38608a3fade0..1238d0f0fc8b4ff50e85d78f8e4305767bd92a0a 100644 (file)
@@ -33,6 +33,7 @@
 #include "ripd/ripd.h"
 #include "ripd/rip_debug.h"
 #include "ripd/rip_cli.h"
+#include "ripd/rip_interface.h"
 
 /*
  * XPath: /frr-ripd:ripd/instance
@@ -103,12 +104,12 @@ static int ripd_instance_destroy(enum nb_event event,
 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;
 }
@@ -1483,241 +1484,337 @@ const struct frr_yang_module_info frr_ripd_info = {
        .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,
index 8307a95d27b3b11a792297d8b82105b3e8247bf6..776f121d59dac59af71e64e0b6a7220243e97b2d 100644 (file)
@@ -29,6 +29,8 @@
 
 #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)
 
index 08aa61257d2853e8cade46a696f3e4e238a1b117..4ad7309c41c3b30a0a3bc86a5982f6abde72c7e7 100644 (file)
@@ -29,6 +29,8 @@
 
 #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));
index 3216b8f89fda9417eba84d1980cdc033d8e43378..85d83c61dc3ca00efea00b85f522ee721dd11bf8 100644 (file)
@@ -231,6 +231,40 @@ static struct route_map_rule_cmd route_match_ip_next_hop_prefix_list_cmd = {
        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
@@ -537,6 +571,9 @@ void rip_route_map_init(void)
        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);
 
@@ -556,6 +593,7 @@ void rip_route_map_init(void)
        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);
index 3a1ffd17a6f47561d7b54a1e40f4c71e77509602..e0ff0430f81a4728cbe5524754975a60bdd0ed45 100644 (file)
 /* 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);
index 44f5932fb69a2c99e0bfa27a506cac86b9ce978c..7f2c3fd068e9e3c4f771bd46db2c87cfb67791f0 100644 (file)
@@ -24,7 +24,7 @@
 #include "hook.h"
 #include "nexthop.h"
 #include "distribute.h"
-#include "rip_memory.h"
+#include "memory.h"
 
 /* RIP version number. */
 #define RIPv1                            1
@@ -97,6 +97,8 @@
 #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;
index 2a63cc52296a2afaaf100b6b7f7fd4d0c845e0c8..312c1db6afd56c565f512922ab66605799fe0b36 100644 (file)
@@ -23,7 +23,6 @@ ripd_librip_a_SOURCES = \
        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 \
@@ -40,7 +39,6 @@ noinst_HEADERS += \
        ripd/rip_debug.h \
        ripd/rip_errors.h \
        ripd/rip_interface.h \
-       ripd/rip_memory.h \
        ripd/ripd.h \
        # end
 
index d83f4d27914506a3f6644c6cf164bf4b0e669cc2..49ed13a2c29b416d67275f3f86704f8b6473baa5 100644 (file)
@@ -49,6 +49,8 @@
 #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 *);
@@ -913,7 +915,7 @@ static struct ripng_interface *ri_new(void)
 {
        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
@@ -950,7 +952,7 @@ static int ripng_if_new_hook(struct interface *ifp)
 /* 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;
 }
diff --git a/ripngd/ripng_memory.c b/ripngd/ripng_memory.c
deleted file mode 100644 (file)
index f459566..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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")
diff --git a/ripngd/ripng_memory.h b/ripngd/ripng_memory.h
deleted file mode 100644 (file)
index 3dfc57b..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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 */
index 882c2fbc8c56182ad4ad7bb3e9107b0a0320c3a0..ba6e52fdda0e7f290443d1b73efe655a54524e93 100644 (file)
@@ -39,6 +39,8 @@
 #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))
index f8ac4a5cd5c1bb9a1d9bd17613b6848c7570dbc8..588f6db037dc96e00f7bd0d286a71874bd7ba4c3 100644 (file)
@@ -105,12 +105,12 @@ static int ripngd_instance_destroy(enum nb_event event,
 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;
 }
@@ -1012,158 +1012,220 @@ const struct frr_yang_module_info frr_ripngd_info = {
        .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,
index fe95ccfc2bdf18907fbf91fd6d2c10a58dbf20cc..0094c993add429f58a869e6b6d9eb920f93e9a55 100644 (file)
@@ -33,6 +33,8 @@
 
 #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)
 
index 5376007747cdc81c34ed6f7f673c6b8438f2d97c..109524e2129091f51c5977f07bffaadcd4be65f7 100644 (file)
@@ -34,6 +34,8 @@
 #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));
index 1bf1007fecd5a22bd635f17f1c5714802a27f8b4..ed9d77a3783de0f4e02b0c0c92178853d12e6e37 100644 (file)
@@ -30,6 +30,8 @@
 #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;
index 71bc43049ab039b3a565fb766718b8cb7d2cd37a..3314892e74afded39219148b8c4c4cf1823152e5 100644 (file)
 #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,
 };
index a2686304fcfafd5b9f1d359bbb61b09f5be79104..5a0d350a84b1108c686d8b1f1e5c0d12c2ac6f0e 100644 (file)
@@ -26,8 +26,7 @@
 #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
@@ -87,6 +86,8 @@
 #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;
index ea0ccf14827c52698bd5adbd7a1c14343ce243c8..eac0d673139a16b2149e810e2b0c153e00425b38 100644 (file)
@@ -17,7 +17,6 @@ ripngd_libripng_a_SOURCES = \
        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 \
@@ -34,7 +33,6 @@ ripngd/ripng_cli.$(OBJEXT): ripngd/ripng_cli_clippy.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 \
index 3053c1c074a94eb4df312b75cd2b8460ff99a853..ce1582b1ba1087d2d8da2e493f19bdbc74f74c9d 100644 (file)
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "id_alloc.h"
 
 #include <inttypes.h>
index 6b2b9ed8a5bd5f5b3482773836a5f72519e7947d..9cc6f80702c2b68f3052c5626aa73dc525742dcf 100644 (file)
  * 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>
index ce542413ba2554671977c2ac7934a757c9c4cca6..02fba97316d438018afb8216b2667fd2b96bddde 100644 (file)
@@ -149,7 +149,9 @@ def ltemplatePreRouterStartHook():
     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
index b9982d4900f9f4230f386c8cdb4bdb3b9d9fde30..c5e615d25210230e4995ec644f15cb9aaf2311a7 100644 (file)
@@ -55,8 +55,6 @@ Simplified `R1` config:
         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
index 0c24942f4304e826c0c8bd30d96ef770a7fbda16..71397a9942c5fcb82654b8331e4d844993404282 100644 (file)
@@ -11,8 +11,6 @@ log file bgpd.log
 !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
index a328f969d6e4c84d4a035b0cf7605e83b3491a78..57eec108cbc7263acad4fd19b5cbe4c49610ba7e 100644 (file)
@@ -14,7 +14,6 @@ vrrpd_libvrrp_a_SOURCES = \
        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 \
@@ -25,7 +24,6 @@ noinst_HEADERS += \
        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 \
index 3d535cbfba251557432251975f41bee5ac5a0d69..5213b27d32c21fdc624b5ecc2ef91c31cf66163d 100644 (file)
 #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;
@@ -768,7 +770,7 @@ static void vrrp_send_advertisement(struct vrrp_router *r)
        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
index fd4901fe22fed7c7cd4f1bb20089731942398bf5..5d355d04b5452e6d6adc4e75858fb73e5526a12e 100644 (file)
@@ -23,6 +23,7 @@
 #include <zebra.h>
 #include <netinet/ip.h>
 
+#include "lib/memory.h"
 #include "lib/hash.h"
 #include "lib/hook.h"
 #include "lib/if.h"
@@ -54,6 +55,8 @@
 /* User compatibility constant */
 #define CS2MS 10
 
+DECLARE_MGROUP(VRRPD)
+
 /* Configured defaults */
 struct vrrp_defaults {
        uint8_t priority;
index 46a92d936a32564b0ef6304cab3ce95d324dc121..6c6a06064de84f5b7d96e2835e5e23d91bc9b8ee 100644 (file)
@@ -39,6 +39,8 @@
 #include "vrrp_vty.h"
 #include "vrrp_zebra.h"
 
+DEFINE_MGROUP(VRRPD, "vrrpd")
+
 char backup_config_file[256];
 
 zebra_capabilities_t _caps_p[] = {
diff --git a/vrrpd/vrrp_memory.c b/vrrpd/vrrp_memory.c
deleted file mode 100644 (file)
index 30eef52..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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");
diff --git a/vrrpd/vrrp_memory.h b/vrrpd/vrrp_memory.h
deleted file mode 100644 (file)
index c3025d1..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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__ */
index c3f2afba4cbfed4d9882adcb33d224d926e03c98..c6b7ac1a7fad25028d7c67b94d3634dd26caa752 100644 (file)
 
 #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",
@@ -151,6 +152,11 @@ ssize_t vrrp_pkt_adver_build(struct vrrp_pkt **pkt, struct ipaddr *src,
        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)
index 475e4780d5d93bb687c963cb6ad909a0eca02d7b..c2ce22f00891aa2d377589a413bbe76cdfee724e 100644 (file)
@@ -135,6 +135,9 @@ ssize_t vrrp_pkt_adver_build(struct vrrp_pkt **pkt, struct ipaddr *src,
                             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.
  *
index 48d81b02582665e5395865a2866d8fde27c13fad..2dc3d3f8a393f30b325b2471828dc163303882cb 100644 (file)
@@ -29,7 +29,6 @@
 
 #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"
index 9c2de0f62b8cf72f23bcd0ad19111a45cc71d52d..b8957c2b00bbbab6d080810d08f79e7e8d27fb85 100644 (file)
@@ -373,6 +373,10 @@ void vtysh_config_parse_line(void *arg, const char *line)
                                 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
@@ -418,7 +422,8 @@ void vtysh_config_parse_line(void *arg, const char *line)
         || (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)
index 4971994346432f8131d7dbad65c4cbee04d1bf1f..2c306434a36dca516e0736137c81ced52a7ada85 100644 (file)
@@ -129,8 +129,18 @@ static const struct message family_str[] = {{AF_INET, "ipv4"},
                                            {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;
index 92c78a4cbb144a4a7dbad1b06312ef1024407d2c..d594accf4d01250b75c7f37fc9dae639b0c6412f 100644 (file)
@@ -330,6 +330,10 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
                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;
        }
 
@@ -2413,8 +2417,13 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
        }
 
        /* 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
index e181b495b8dde899e31847a09603fd4237f99600..5841c44b0334fa152735397c2b956cf933478802 100644 (file)
@@ -50,6 +50,8 @@ extern struct zebra_privs_t zserv_privs;
 
 #if defined(HAVE_RTADV)
 
+DEFINE_MTYPE_STATIC(ZEBRA, RTADV_PREFIX, "Router Advertisement Prefix")
+
 #ifdef OPEN_BSD
 #include <netinet/icmp6.h>
 #endif
index 1707d3a68b6dff3751de6d6606fb31a8efe96379..f93562b31b53a2263dc11d05b2455dc073b7efb5 100644 (file)
  * 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"
@@ -32,8 +36,8 @@
 #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
index ee041b1c3dbd95009cb1a79b9a80083aaae9875c..a9c2c5fe58b7e2efbe61b67dc2e40e5ebe4baf8a 100644 (file)
 #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")
index 667c73b2270fd348ef6bf8886dc31085c3e0c05c..e15f972493269c63906728368a5fceb6c311bf2d 100644 (file)
@@ -29,17 +29,9 @@ extern "C" {
 #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
 }
index cc614abac54f7940dc46eba0ea7f3cce482b1975..555bec95937bfa5716037b181e8af59606a7539f 100644 (file)
@@ -744,9 +744,10 @@ void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq)
                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;
@@ -760,7 +761,7 @@ void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq)
                 * 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;
@@ -769,11 +770,12 @@ void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq)
                                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);
                        }
 
index 1024f3a0525c425bbeb2d37f383f3d5d759ab7b0..5f397eb8c29f29a3fd5e28b465cce6a5e868987b 100644 (file)
@@ -50,6 +50,8 @@
 #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,
@@ -160,14 +162,15 @@ struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid, rnh_type_t type,
 
        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;
        }
@@ -271,8 +274,8 @@ static void zebra_delete_rnh(struct rnh *rnh, rnh_type_t type)
 
        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);
@@ -293,9 +296,9 @@ void zebra_add_rnh_client(struct rnh *rnh, struct zserv *client,
 {
        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);
@@ -312,9 +315,9 @@ void zebra_remove_rnh_client(struct rnh *rnh, struct zserv *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);
@@ -803,8 +806,8 @@ static void zebra_rnh_evaluate_entry(struct zebra_vrf *zvrf, afi_t afi,
 
        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;
@@ -1156,9 +1159,9 @@ static int zebra_cleanup_rnh_client(vrf_id_t vrf_id, afi_t afi,
        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) {
index 95a39411816ff4be7920f95c5934cd548deb2205..c7d2c0d2984a6fa7f26f812810ce0ec7ba5d6e8b 100644 (file)
@@ -43,6 +43,18 @@ static inline int rnh_resolve_via_default(int family)
                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,
index dbfe695a00ac0acae7ee1953b22c94da1d5f9683..2f7d50541ed2d3546f8d7232ab802ac65f85b700 100644 (file)
@@ -1254,6 +1254,40 @@ static struct route_map_rule_cmd route_match_ipv6_address_prefix_list_cmd = {
        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
@@ -1345,6 +1379,40 @@ static struct route_map_rule_cmd route_match_ip_nexthop_prefix_len_cmd = {
        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,
@@ -1927,6 +1995,9 @@ void zebra_route_map_init(void)
        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);
 
@@ -1936,6 +2007,9 @@ void zebra_route_map_init(void)
        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);
@@ -1947,6 +2021,8 @@ void zebra_route_map_init(void)
        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);
 
index 4352d688a1da7b04f552532ed5005ddeba95a6d3..1e9f9e4ec7d21401218246cb2dc9ea8d7e5b949b 100644 (file)
@@ -32,6 +32,8 @@
 #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,
index fdf0cbc693fc282b4570c443333f0d639baee37e..fcc94a7be906827bbd0392f5077c6c66c90a58a0 100644 (file)
@@ -48,7 +48,8 @@ static void zebra_vrf_table_create(struct zebra_vrf *zvrf, afi_t afi,
 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)
index 7596387fc7e2c5d3221065c49b2c8e76f88950d1..4289f4b6fa444d5c21ae256a7dc246eca5b22f19 100644 (file)
@@ -1387,7 +1387,9 @@ static void zvni_print_mac_hash(struct hash_bucket *bucket, void *ctxt)
                                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 {
@@ -1419,11 +1421,13 @@ static void zvni_print_mac_hash(struct hash_bucket *bucket, void *ctxt)
                        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",
@@ -1537,8 +1541,8 @@ static void zvni_print_mac_hash_all_vni(struct hash_bucket *bucket, void *ctxt)
                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);
        }