]> git.puffer.fish Git - mirror/frr.git/commitdiff
sharpd: Add Super Happy Advanced Routing Protocol
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 10 Nov 2017 17:55:16 +0000 (12:55 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 27 Nov 2017 14:16:30 +0000 (09:16 -0500)
Add a daemon that will allow us to test the zapi
as well as test route install/removal times from
the kernel.

The current commands are:

install route <starting ip address> nexthop <nexthop> (1-1000000)

This command starts installing at <starting ip address>/32
(1-100000) routes that it auto-increments by 1
Installation start time is noted in the log and finish
time is noted as well.

remove routes <starting ip address> (1-1000000)

This command removes routes at <starting ip address>/32
and removes (1-100000) routes created by the install route
command.

This code can be considered experimental and *is not*
something that should be run in a production environment.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
22 files changed:
Makefile.am
configure.ac
lib/log.c
lib/route_types.txt
redhat/daemons
sharpd/sharp_main.c [new file with mode: 0644]
sharpd/sharp_vty.c [new file with mode: 0644]
sharpd/sharp_vty.h [new file with mode: 0644]
sharpd/sharp_zebra.c [new file with mode: 0644]
sharpd/sharp_zebra.h [new file with mode: 0644]
sharpd/sharpd.conf.sample [new file with mode: 0644]
sharpd/subdir.am [new file with mode: 0644]
tools/etc/frr/daemons
tools/etc/frr/daemons.conf
tools/etc/iproute2/rt_protos.d/frr.conf
tools/frr
vtysh/Makefile.am
vtysh/extract.pl.in
vtysh/vtysh.c
vtysh/vtysh.h
zebra/rt_netlink.c
zebra/rt_netlink.h

index dfa9d7a1753eaa8ebd1b1c96bfa6f7c753a63989..2468dc733d42d1e455dff72947816ea4721f760a 100644 (file)
@@ -53,6 +53,7 @@ include nhrpd/subdir.am
 include ldpd/subdir.am
 include babeld/subdir.am
 include eigrpd/subdir.am
+include sharpd/subdir.am
 include pimd/subdir.am
 
 SUBDIRS = . @LIBRFP@ @RFPTEST@ \
index cdbd48fe3cccd14d954d8e2ba74692f0cce840a6..16cc8901a331f37d209d9a27a4bbc886e377386d 100755 (executable)
@@ -201,6 +201,7 @@ else
    fi
 fi
 AM_CONDITIONAL([DEV_BUILD], [test "x$enable_dev_build" = "xyes"])
+AM_CONDITIONAL([SHARPD], [test "x$enable_dev_build" = "xyes"])
 
 dnl always want these CFLAGS
 AC_C_FLAG([-fno-omit-frame-pointer])
index 89d7052d1eadb8e0d216abb7dfb667e241216b9f..7589934b69420e031a91b729adea64d06b3f0e92 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -1045,6 +1045,8 @@ int proto_redistnum(int afi, const char *s)
                        return ZEBRA_ROUTE_NHRP;
                else if (strmatch(s, "babel"))
                        return ZEBRA_ROUTE_BABEL;
+               else if (strmatch(s, "sharp"))
+                       return ZEBRA_ROUTE_SHARP;
        }
        if (afi == AFI_IP6) {
                if (strmatch(s, "kernel"))
@@ -1071,6 +1073,8 @@ int proto_redistnum(int afi, const char *s)
                        return ZEBRA_ROUTE_NHRP;
                else if (strmatch(s, "babel"))
                        return ZEBRA_ROUTE_BABEL;
+               else if (strmatch(s, "sharp"))
+                       return ZEBRA_ROUTE_SHARP;
        }
        return -1;
 }
index 386d9992f7c3866cfa1cab15ade0838e687622c4..4e764a14c139ab898bbd9717542c99545662b30a 100644 (file)
@@ -77,6 +77,7 @@ ZEBRA_ROUTE_BGP_DIRECT, bgp-direct, NULL,  'b', 0, 0, "BGP-Direct"
 #  bgp unicast -> vnc 
 ZEBRA_ROUTE_BGP_DIRECT_EXT, bgp-direct-to-nve-groups, NULL, 'e', 0, 0, "BGP2VNC"
 ZEBRA_ROUTE_BABEL,      babel,     babeld, 'A', 1, 1, "Babel"
+ZEBRA_ROUTE_SHARP,    sharp,     sharpd, 'D', 1, 1, "SHARP"
 ZEBRA_ROUTE_ALL,        wildcard,  none,   '-', 0, 0, "-"
 
 
@@ -101,3 +102,4 @@ ZEBRA_ROUTE_TABLE,  "Non-main Kernel Routing Table"
 ZEBRA_ROUTE_LDP,    "Label Distribution Protocol (LDP)"
 ZEBRA_ROUTE_VNC_DIRECT,    "VNC direct (not via zebra) routes"
 ZEBRA_ROUTE_BABEL,  "Babel routing protocol (Babel)"
+ZEBRA_ROUTE_SHARP, "Super Happy Advanced Routing Protocol (sharpd)"
index c163f4d2ce3366310311854ae4970202d5e2b3f7..889e288e576644f7e8f24048db4b60955a75206e 100644 (file)
@@ -49,6 +49,7 @@ pimd=no
 nhrpd=no
 eigrpd=no
 babeld=no
+sharpd=no
 #
 # Command line options for the daemons
 #
@@ -64,6 +65,7 @@ pimd_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")
 
 #
 # If the vtysh_enable is yes, then the unified config is read
diff --git a/sharpd/sharp_main.c b/sharpd/sharp_main.c
new file mode 100644 (file)
index 0000000..1c80cf0
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * SHARP - main code
+ * Copyright (C) Cumulus Networks, Inc.
+ *               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 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/version.h>
+#include "getopt.h"
+#include "thread.h"
+#include "prefix.h"
+#include "linklist.h"
+#include "if.h"
+#include "vector.h"
+#include "vty.h"
+#include "command.h"
+#include "filter.h"
+#include "plist.h"
+#include "stream.h"
+#include "log.h"
+#include "memory.h"
+#include "privs.h"
+#include "sigevent.h"
+#include "zclient.h"
+#include "keychain.h"
+#include "distribute.h"
+#include "libfrr.h"
+#include "routemap.h"
+
+#include "sharp_zebra.h"
+#include "sharp_vty.h"
+
+uint32_t total_routes = 0;
+uint32_t installed_routes = 0;
+uint32_t removed_routes = 0;
+
+zebra_capabilities_t _caps_p[] = {
+       ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN,
+};
+
+struct zebra_privs_t sharp_privs = {
+#if defined(FRR_USER) && defined(FRR_GROUP)
+       .user = FRR_USER,
+       .group = FRR_GROUP,
+#endif
+#if defined(VTY_GROUP)
+       .vty_group = VTY_GROUP,
+#endif
+       .caps_p = _caps_p,
+       .cap_num_p = array_size(_caps_p),
+       .cap_num_i = 0};
+
+struct option longopts[] = {{0}};
+
+/* Master of threads. */
+struct thread_master *master;
+
+/* SIGHUP handler. */
+static void sighup(void)
+{
+       zlog_info("SIGHUP received");
+}
+
+/* SIGINT / SIGTERM handler. */
+static void sigint(void)
+{
+       zlog_notice("Terminating on signal");
+
+       exit(0);
+}
+
+/* SIGUSR1 handler. */
+static void sigusr1(void)
+{
+       zlog_rotate();
+}
+
+struct quagga_signal_t sharp_signals[] = {
+       {
+               .signal = SIGHUP,
+               .handler = &sighup,
+       },
+       {
+               .signal = SIGUSR1,
+               .handler = &sigusr1,
+       },
+       {
+               .signal = SIGINT,
+               .handler = &sigint,
+       },
+       {
+               .signal = SIGTERM,
+               .handler = &sigint,
+       },
+};
+
+#define SHARP_VTY_PORT 2614
+
+FRR_DAEMON_INFO(sharpd, SHARP, .vty_port = SHARP_VTY_PORT,
+
+               .proghelp = "Implementation of a Sharp of routes daemon.",
+
+               .signals = sharp_signals,
+               .n_signals = array_size(sharp_signals),
+
+               .privs = &sharp_privs, )
+
+extern void sharp_vty_init(void);
+
+int main(int argc, char **argv, char **envp)
+{
+       frr_preinit(&sharpd_di, argc, argv);
+       frr_opt_add("", longopts, "");
+
+       while (1) {
+               int opt;
+
+               opt = frr_getopt(argc, argv, NULL);
+
+               if (opt == EOF)
+                       break;
+
+               switch (opt) {
+               case 0:
+                       break;
+               default:
+                       frr_help_exit(1);
+                       break;
+               }
+       }
+
+       master = frr_init();
+
+       vrf_init(NULL, NULL, NULL, NULL);
+
+       sharp_zebra_init();
+
+       /* Get configuration file. */
+       sharp_vty_init();
+
+       frr_config_fork();
+       frr_run(master);
+
+       /* Not reached. */
+       return 0;
+}
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c
new file mode 100644 (file)
index 0000000..47bb37c
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * SHARP - vty code
+ * Copyright (C) Cumulus Networks, Inc.
+ *               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 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 "vty.h"
+#include "command.h"
+#include "prefix.h"
+#include "nexthop.h"
+#include "log.h"
+
+#include "sharpd/sharp_zebra.h"
+#include "sharpd/sharp_vty.h"
+#include "sharpd/sharp_vty_clippy.c"
+
+extern uint32_t total_routes;
+extern uint32_t installed_routes;
+extern uint32_t removed_routes;
+
+DEFPY (install_routes,
+       install_routes_cmd,
+       "install routes A.B.C.D$start nexthop A.B.C.D$nexthop (1-1000000)$routes",
+       "install some routes\n"
+       "Routes to install\n"
+       "Address to start /32 generation at\n"
+       "Nexthop to use\n"
+       "Nexthop address\n"
+       "How many to create\n")
+{
+       int i;
+       struct prefix p;
+       struct nexthop nhop;
+       uint32_t temp;
+
+       total_routes = routes;
+       installed_routes = 0;
+
+       memset(&p, 0, sizeof(p));
+       memset(&nhop, 0, sizeof(nhop));
+
+       p.family = AF_INET;
+       p.prefixlen = 32;
+       p.u.prefix4 = start;
+
+       nhop.gate.ipv4 = nexthop;
+       nhop.type = NEXTHOP_TYPE_IPV4;
+
+       zlog_debug("Inserting %ld routes", routes);
+
+       temp = ntohl(p.u.prefix4.s_addr);
+       for (i = 0 ; i < routes ; i++) {
+               route_add(&p, &nhop);
+               p.u.prefix4.s_addr = htonl(++temp);
+       }
+
+       return CMD_SUCCESS;
+}
+
+DEFPY (remove_routes,
+       remove_routes_cmd,
+       "remove routes A.B.C.D$start (1-1000000)$routes",
+       "Remove some routes\n"
+       "Routes to remove\n"
+       "Starting spot\n"
+       "Routes to uniinstall\n")
+{
+       int i;
+       struct prefix p;
+       uint32_t temp;
+
+       total_routes = routes;
+       removed_routes = 0;
+
+       memset(&p, 0, sizeof(p));
+
+       p.family = AF_INET;
+       p.prefixlen = 32;
+       p.u.prefix4 = start;
+
+       zlog_debug("Removing %ld routes", routes);
+
+       temp = ntohl(p.u.prefix4.s_addr);
+       for (i = 0; i < routes ; i++) {
+               route_delete(&p);
+               p.u.prefix4.s_addr = htonl(++temp);
+       }
+
+       return CMD_SUCCESS;
+}
+
+void sharp_vty_init(void)
+{
+       install_element(ENABLE_NODE, &install_routes_cmd);
+       install_element(ENABLE_NODE, &remove_routes_cmd);
+       return;
+}
diff --git a/sharpd/sharp_vty.h b/sharpd/sharp_vty.h
new file mode 100644 (file)
index 0000000..d4af095
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * VTY library for SHARP
+ * Copyright (C) Cumulus Networks, Inc.
+ *               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 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 __SHARP_VTY_H__
+#define __SHARP_VTY_H__
+
+extern void sharp_vty_init(void);
+#endif
diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c
new file mode 100644 (file)
index 0000000..4a5ae13
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * Zebra connect code.
+ * Copyright (C) Cumulus Networks, Inc.
+ *               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 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 "thread.h"
+#include "command.h"
+#include "network.h"
+#include "prefix.h"
+#include "routemap.h"
+#include "table.h"
+#include "stream.h"
+#include "memory.h"
+#include "zclient.h"
+#include "filter.h"
+#include "plist.h"
+#include "log.h"
+#include "nexthop.h"
+
+#include "sharp_zebra.h"
+
+/* Zebra structure to hold current status. */
+struct zclient *zclient = NULL;
+
+/* For registering threads. */
+extern struct thread_master *master;
+
+static struct interface *zebra_interface_if_lookup(struct stream *s)
+{
+       char ifname_tmp[INTERFACE_NAMSIZ];
+
+       /* Read interface name. */
+       stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
+
+       /* And look it up. */
+       return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
+}
+
+/* Inteface addition message from zebra. */
+static int interface_add(int command, struct zclient *zclient,
+                              zebra_size_t length, vrf_id_t vrf_id)
+{
+       struct interface *ifp;
+
+       ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
+
+       if (!ifp->info)
+               return 0;
+
+       return 0;
+}
+
+static int interface_delete(int command, struct zclient *zclient,
+                           zebra_size_t length, vrf_id_t vrf_id)
+{
+       struct interface *ifp;
+       struct stream *s;
+
+       s = zclient->ibuf;
+       /* zebra_interface_state_read () updates interface structure in iflist
+        */
+       ifp = zebra_interface_state_read(s, vrf_id);
+
+       if (ifp == NULL)
+               return 0;
+
+       if_set_index(ifp, IFINDEX_INTERNAL);
+
+       return 0;
+}
+
+static int interface_address_add(int command, struct zclient *zclient,
+                                zebra_size_t length, vrf_id_t vrf_id)
+{
+
+       zebra_interface_address_read(command, zclient->ibuf, vrf_id);
+
+       return 0;
+}
+
+static int interface_address_delete(int command, struct zclient *zclient,
+                                   zebra_size_t length, vrf_id_t vrf_id)
+{
+       struct connected *c;
+
+       c = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
+
+       if (!c)
+               return 0;
+
+       connected_free(c);
+       return 0;
+}
+
+static int interface_state_up(int command, struct zclient *zclient,
+                             zebra_size_t length, vrf_id_t vrf_id)
+{
+
+       zebra_interface_if_lookup(zclient->ibuf);
+
+       return 0;
+}
+
+static int interface_state_down(int command, struct zclient *zclient,
+                               zebra_size_t length, vrf_id_t vrf_id)
+{
+
+       zebra_interface_state_read(zclient->ibuf, vrf_id);
+
+       return 0;
+}
+
+extern uint32_t total_routes;
+extern uint32_t installed_routes;
+
+static int notify_owner(int command, struct zclient *zclient,
+                       zebra_size_t length, vrf_id_t vrf_id)
+{
+       struct prefix p;
+       enum zapi_route_notify_owner note;
+
+       if (!zapi_route_notify_decode(zclient->ibuf, &p, &note))
+               return -1;
+
+       installed_routes++;
+
+       if (total_routes == installed_routes)
+               zlog_debug("Installed All Items");
+       return 0;
+}
+
+static void zebra_connected(struct zclient *zclient)
+{
+       zclient_send_reg_requests(zclient, VRF_DEFAULT);
+}
+
+void route_add(struct prefix *p, struct nexthop *nh)
+{
+       struct zapi_route api;
+       struct zapi_nexthop *api_nh;
+
+       memset(&api, 0, sizeof(api));
+       api.vrf_id = VRF_DEFAULT;
+       api.type = ZEBRA_ROUTE_SHARP;
+       api.safi = SAFI_UNICAST;
+       memcpy(&api.prefix, p, sizeof(*p));
+
+       SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
+
+       api_nh = &api.nexthops[0];
+       api_nh->gate.ipv4 = nh->gate.ipv4;
+       api_nh->type = nh->type;
+       api_nh->ifindex = nh->ifindex;
+       api.nexthop_num = 1;
+
+       zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
+}
+
+void route_delete(struct prefix *p)
+{
+       struct zapi_route api;
+
+       memset(&api, 0, sizeof(api));
+       api.vrf_id = VRF_DEFAULT;
+       api.type = ZEBRA_ROUTE_SHARP;
+       api.safi = SAFI_UNICAST;
+       memcpy(&api.prefix, p, sizeof(*p));
+       zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
+
+       return;
+}
+
+extern struct zebra_privs_t sharp_privs;
+
+void sharp_zebra_init(void)
+{
+       struct zclient_options opt = { .receive_notify = true };
+
+       zclient = zclient_new_notify(master, &opt);
+
+       zclient_init(zclient, ZEBRA_ROUTE_SHARP, 0, &sharp_privs);
+       zclient->zebra_connected = zebra_connected;
+       zclient->interface_add = interface_add;
+       zclient->interface_delete = interface_delete;
+       zclient->interface_up = interface_state_up;
+       zclient->interface_down = interface_state_down;
+       zclient->interface_address_add = interface_address_add;
+       zclient->interface_address_delete = interface_address_delete;
+       zclient->notify_owner = notify_owner;
+}
diff --git a/sharpd/sharp_zebra.h b/sharpd/sharp_zebra.h
new file mode 100644 (file)
index 0000000..97100f6
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Zebra connect library for SHARP
+ * Copyright (C) Cumulus Networks, Inc.
+ *               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 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 __SHARP_ZEBRA_H__
+#define __SHARP_ZEBRA_H__
+
+extern void sharp_zebra_init(void);
+
+extern void route_add(struct prefix *p, struct nexthop *nh);
+extern void route_delete(struct prefix *p);
+#endif
diff --git a/sharpd/sharpd.conf.sample b/sharpd/sharpd.conf.sample
new file mode 100644 (file)
index 0000000..bb1c2ed
--- /dev/null
@@ -0,0 +1,3 @@
+!
+!
+log stdout
diff --git a/sharpd/subdir.am b/sharpd/subdir.am
new file mode 100644 (file)
index 0000000..da7d68e
--- /dev/null
@@ -0,0 +1,21 @@
+#
+# sharpd
+#
+
+if SHARPD
+noinst_LIBRARIES += sharpd/libsharp.a
+sbin_PROGRAMS += sharpd/sharpd
+dist_examples_DATA += sharpd/sharpd.conf.sample
+endif
+
+sharpd_libsharp_a_SOURCES = \
+       sharpd/sharp_zebra.c \
+       sharpd/sharp_vty.c \
+       # end
+
+sharpd/sharp_vty_clippy.c: $(CLIPPY_DEPS)
+sharpd/sharp_vty.$(OBJEXT): sharpd/sharp_vty_clippy.c
+
+sharpd_sharpd_SOURCES = sharpd/sharp_main.c
+sharpd_sharpd_LDADD = sharpd/libsharp.a lib/libfrr.la @LIBCAP@
+
index a4608279241010a0c52402b72516d95334b51c17..ac17fed03a062da4a0a2d234b7c0913f01546319 100644 (file)
@@ -33,3 +33,4 @@ ldpd=no
 nhrpd=no
 eigrpd=no
 babeld=no
+sharpd=no
index 0d92d13671ab63a0fa097c9e2527a7c996ed807c..3f40836c90bda4857aad02024c7c90c2c02a9357 100644 (file)
@@ -16,6 +16,7 @@ ldpd_options="  --daemon -A 127.0.0.1"
 nhrpd_options="  --daemon -A 127.0.0.1"
 eigrpd_options="  --daemon -A 127.0.0.1"
 babeld_options="  --daemon -A 127.0.0.1"
+sharpd_options="  --daemon -A 127.0.0.1"
 
 # The list of daemons to watch is automatically generated by the init script.
 watchfrr_enable=yes
index 2d3b884e7e7ef2f90bd65b5392a56fe99c280161..b8d4c1c03b1d03a90e84ee98d76f1fd656d9d862 100644 (file)
@@ -8,3 +8,4 @@
 191  nhrp
 192  eigrp
 193  ldp
+194  sharp
\ No newline at end of file
index 78190aadb06bea071a7dde088f603a2559a6c1fc..0f6140d3ecf37d75f659b2f6e55ad3a0f8459f6c 100755 (executable)
--- a/tools/frr
+++ b/tools/frr
@@ -21,7 +21,7 @@ V_PATH=/var/run/frr
 # Local Daemon selection may be done by using /etc/frr/daemons.
 # See /usr/share/doc/frr/README.Debian.gz for further information.
 # Keep zebra first and do not list watchfrr!
-DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd babeld pimd ldpd nhrpd eigrpd"
+DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd babeld pimd ldpd nhrpd eigrpd sharpd"
 MAX_INSTANCES=5
 RELOAD_SCRIPT=/usr/lib/frr/frr-reload.py
 
index 5156d336b31d71c3e250d1eb3033cda31414f79e..3ddb6aba54092765a4caea729beed5ad00d83047 100644 (file)
@@ -132,6 +132,10 @@ vtysh_scan += $(top_srcdir)/babeld/babel_zebra.c
 vtysh_scan += $(top_srcdir)/babeld/babeld.c
 endif
 
+if SHARPD
+vtysh_scan += $(top_srcdir)/sharpd/sharp_vty.c
+endif
+
 if SNMP
 vtysh_scan += $(top_srcdir)/lib/agentx.c
 endif
index f33c7b9603a10c7ac3a24586dadfb96135e4e13a..dedf3d1647329db314ac4ca48c4a1b1b753b57aa 100755 (executable)
@@ -82,7 +82,7 @@ foreach (@ARGV) {
             $protocol = "VTYSH_RIPD";
         }
         elsif ($file =~ /lib\/routemap\.c$/) {
-            $protocol = "VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_PIMD|VTYSH_EIGRPD";
+            $protocol = "VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_ZEBRA|VTYSH_PIMD|VTYSH_EIGRPD|VTYSH_SHARPD";
         }
         elsif ($file =~ /lib\/vrf\.c$/) {
             $protocol = "VTYSH_ALL";
index b0216072401343fe335155eaae09c4b3b0ce02bd..35a9d8b94d8b851c70cbc4ace1133c959067ed1a 100644 (file)
@@ -74,6 +74,7 @@ struct vtysh_client vtysh_client[] = {
        {.fd = -1, .name = "nhrpd", .flag = VTYSH_NHRPD, .next = NULL},
        {.fd = -1, .name = "eigrpd", .flag = VTYSH_EIGRPD, .next = NULL},
        {.fd = -1, .name = "babeld", .flag = VTYSH_BABELD, .next = NULL},
+        {.fd = -1, .name = "sharpd", .flag = VTYSH_SHARPD, .next = NULL},
        {.fd = -1, .name = "watchfrr", .flag = VTYSH_WATCHFRR, .next = NULL},
 };
 
index 9d6ea4bda440df6c43e9b3f6deea0b22ca6b122c..c584d7a9058ff70c915fa35f90c1aefcaf42f5bc 100644 (file)
@@ -37,13 +37,15 @@ DECLARE_MGROUP(MVTYSH)
 #define VTYSH_NHRPD  0x800
 #define VTYSH_EIGRPD 0x1000
 #define VTYSH_BABELD 0x2000
+#define VTYSH_SHARPD 0x4000
+
 
 /* commands in REALLYALL are crucial to correct vtysh operation */
 #define VTYSH_REALLYALL          ~0U
 /* watchfrr is not in ALL since library CLI functions should not be
  * run on it (logging & co. should stay in a fixed/frozen config, and
  * things like prefix lists are not even initialised) */
-#define VTYSH_ALL        VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_LDPD|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_NHRPD|VTYSH_EIGRPD|VTYSH_BABELD
+#define VTYSH_ALL        VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_LDPD|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_NHRPD|VTYSH_EIGRPD|VTYSH_BABELD|VTYSH_SHARPD
 #define VTYSH_RMAP       VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_PIMD|VTYSH_EIGRPD
 #define VTYSH_INTERFACE          VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_ISISD|VTYSH_PIMD|VTYSH_NHRPD|VTYSH_EIGRPD|VTYSH_BABELD
 #define VTYSH_NS          VTYSH_ZEBRA
index a1ef5ba98670062bd3ea27efa54a7d0892d112f8..3830e1fbdefbe24302ee474682906c1729422dbf 100644 (file)
@@ -98,7 +98,7 @@ static inline int is_selfroute(int proto)
            || (proto == RTPROT_ISIS) || (proto == RTPROT_RIPNG)
            || (proto == RTPROT_NHRP) || (proto == RTPROT_EIGRP)
            || (proto == RTPROT_LDP) || (proto == RTPROT_BABEL)
-           || (proto == RTPROT_RIP)) {
+           || (proto == RTPROT_RIP) || (proto == RTPROT_SHARP)) {
                return 1;
        }
 
@@ -139,6 +139,9 @@ static inline int zebra2proto(int proto)
        case ZEBRA_ROUTE_LDP:
                proto = RTPROT_LDP;
                break;
+       case ZEBRA_ROUTE_SHARP:
+               proto = RTPROT_SHARP;
+               break;
        default:
                proto = RTPROT_ZEBRA;
                break;
index afb03f878d95c92a651cd0d365f603205eefb4fa..51350fd6fb114d135a31d5f43f50e53d64df44b9 100644 (file)
@@ -51,6 +51,7 @@
 #define RTPROT_NHRP        191
 #define RTPROT_EIGRP       192
 #define RTPROT_LDP         193
+#define RTPROT_SHARP       194
 
 void rt_netlink_init(void);