]> git.proxmox.com Git - mirror_frr.git/commitdiff
vtysh: dynamically generate the list of daemons for commands
authorIgor Ryzhov <iryzhov@nfware.com>
Thu, 1 Oct 2020 22:16:23 +0000 (01:16 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Fri, 2 Oct 2020 12:06:27 +0000 (15:06 +0300)
Some daemons were actually missing from the static definitions: nhrpd,
babeld, eigrpd and bfdd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
22 files changed:
Makefile.am
babeld/subdir.am
bfdd/subdir.am
bgpd/subdir.am
eigrpd/subdir.am
isisd/subdir.am
ldpd/subdir.am
lib/command.h
nhrpd/subdir.am
ospf6d/subdir.am
ospfd/subdir.am
pbrd/subdir.am
pimd/subdir.am
ripd/subdir.am
ripngd/subdir.am
sharpd/subdir.am
staticd/subdir.am
vrrpd/subdir.am
vtysh/daemons.pl [new file with mode: 0755]
vtysh/subdir.am
vtysh/vtysh.c
zebra/subdir.am

index 425d7bb311f7633395d798db36e3aa2f60ddcc2b..b6e8a2bce81d36bb9c20e956640f0279668a67df 100644 (file)
@@ -112,6 +112,7 @@ dist_examples_DATA =
 dist_yangmodels_DATA =
 man_MANS =
 vtysh_scan =
+vtysh_daemons =
 clippy_scan =
 
 ## libtool, the self-made GNU scourge
index 7827e7dc58151a31ebce40b1d393923e76416ea3..8e5b46350d2d2979a0cca4c2b9faf817e0661c98 100644 (file)
@@ -11,6 +11,7 @@ vtysh_scan += \
        babeld/babel_zebra.c \
        babeld/babeld.c \
        # end
+vtysh_daemons += babeld
 endif
 
 babeld_libbabel_a_SOURCES = \
index a79620c45cdc0d0bba6d0b0f35e84d0cd85a51c1..d0e3c1e8d2d60fe185e89255832f0faf0081a789 100644 (file)
@@ -8,6 +8,7 @@ sbin_PROGRAMS += bfdd/bfdd
 dist_examples_DATA += bfdd/bfdd.conf.sample
 vtysh_scan += bfdd/bfdd_vty.c
 vtysh_scan += bfdd/bfdd_cli.c
+vtysh_daemons += bfdd
 man8 += $(MANBUILD)/frr-bfdd.8
 endif
 
index a5393e25acdc79ff7473d1fb62797ae0cac6b8c1..d1f93957ee1a80ef87a133ab0f973ed93ae9a149 100644 (file)
@@ -30,6 +30,8 @@ vtysh_scan += \
 vtysh_scan += bgpd/bgp_rpki.c
 vtysh_scan += bgpd/bgp_bmp.c
 
+vtysh_daemons += bgpd
+
 if ENABLE_BGP_VNC
 vtysh_scan += \
        bgpd/rfapi/bgp_rfapi_cfg.c \
index 8b86b9c8a7461cc26d7d5199dcb23cd1c4eb48a4..98f39440c36d8cc0b7935c67432a2cc00efa686e 100644 (file)
@@ -12,6 +12,7 @@ vtysh_scan += \
        eigrpd/eigrp_vty.c \
        # end
 #      eigrpd/eigrp_routemap.c
+vtysh_daemons += eigrpd
 man8 += $(MANBUILD)/frr-eigrpd.8
 endif
 
index c2e4b4eac076afb8fd62673bc5b2c82c5c48317f..1d59592626728ead44101e7eed3463ae6d20509d 100644 (file)
@@ -16,6 +16,7 @@ vtysh_scan += \
        isisd/isis_vty_fabricd.c \
        isisd/isisd.c \
        # end
+vtysh_daemons += isisd
 man8 += $(MANBUILD)/frr-isisd.8
 endif
 
@@ -35,6 +36,7 @@ vtysh_scan += \
        isisd/isisd.c \
        # end
 endif
+vtysh_daemons += fabricd
 endif
 
 noinst_HEADERS += \
index 0b38c37872c8a1761c54f06418ee035d19ce8ba5..2058d2596a6d7e992eca01817bf4bb86948bd2dc 100644 (file)
@@ -7,6 +7,7 @@ noinst_LIBRARIES += ldpd/libldp.a
 sbin_PROGRAMS += ldpd/ldpd
 dist_examples_DATA += ldpd/ldpd.conf.sample
 vtysh_scan += ldpd/ldp_vty_cmds.c
+vtysh_daemons += ldpd
 man8 += $(MANBUILD)/frr-ldpd.8
 endif
 
index d828989118b225e97126a480b54d5894910629a2..dc148a92a80ceccfa4d35e23d8f5fd7a531d260c 100644 (file)
@@ -437,12 +437,6 @@ struct cmd_node {
 #define NEIGHBOR_ADDR_STR2 "Neighbor address\nNeighbor IPv6 address\nInterface name or neighbor tag\n"
 #define NEIGHBOR_ADDR_STR3 "Neighbor address\nIPv6 address\nInterface name\n"
 
-/* Daemons lists */
-#define DAEMONS_STR                                                            \
-       "For the zebra daemon\nFor the rip daemon\nFor the ripng daemon\nFor the ospf daemon\nFor the ospfv6 daemon\nFor the bgp daemon\nFor the isis daemon\nFor the pbr daemon\nFor the fabricd daemon\nFor the pim daemon\nFor the static daemon\nFor the sharpd daemon\nFor the vrrpd daemon\nFor the ldpd daemon\n"
-#define DAEMONS_LIST                                                           \
-       "<zebra|ripd|ripngd|ospfd|ospf6d|bgpd|isisd|pbrd|fabricd|pimd|staticd|sharpd|vrrpd|ldpd>"
-
 /* Graceful Restart cli help strings */
 #define GR_CMD "Global Graceful Restart command\n"
 #define NO_GR_CMD "Undo Global Graceful Restart command\n"
index 8cfc25b7bd820b225203b95aef1651faef0b536c..61b1fe31b2f203ba4293ec8d5b942bf29eb774ab 100644 (file)
@@ -5,6 +5,7 @@
 if NHRPD
 sbin_PROGRAMS += nhrpd/nhrpd
 vtysh_scan += nhrpd/nhrp_vty.c
+vtysh_daemons += nhrpd
 man8 += $(MANBUILD)/frr-nhrpd.8
 endif
 
index 9bb68383101ef58aae71beb7ec2905d6ed84a723..ec6e59353343f1cc9412822cb2ebb417462a16fb 100644 (file)
@@ -23,6 +23,7 @@ vtysh_scan += \
        ospf6d/ospf6_zebra.c \
        ospf6d/ospf6d.c \
        # end
+vtysh_daemons += ospf6d
 if SNMP
 module_LTLIBRARIES += ospf6d/ospf6d_snmp.la
 endif
index 236b76a1f7ba1aa57a70b863b34ee9602853152a..e586937478dda3dc57ab3f7656a80bb51d73498a 100644 (file)
@@ -17,6 +17,7 @@ vtysh_scan += \
        ospfd/ospf_sr.c \
        ospfd/ospf_vty.c \
        # end
+vtysh_daemons += ospfd
 if SNMP
 module_LTLIBRARIES += ospfd/ospfd_snmp.la
 endif
index 42f279988bcf646f1c8ef093fcb1e3d66bc983e6..7ad071af3b659b3b8ef824ec74d7b18384aee39d 100644 (file)
@@ -10,6 +10,7 @@ vtysh_scan += \
        pbrd/pbr_vty.c \
        pbrd/pbr_debug.c \
        # end
+vtysh_daemons += pbrd
 man8 += $(MANBUILD)/frr-pbrd.8
 endif
 
index 85406515448b1c1f23f0eb2ed9edd09e451dd37a..8952d15aaaacdfdaf8ece90f74a6614431110a25 100644 (file)
@@ -9,6 +9,7 @@ bin_PROGRAMS += pimd/mtracebis
 noinst_PROGRAMS += pimd/test_igmpv3_join
 dist_examples_DATA += pimd/pimd.conf.sample
 vtysh_scan += pimd/pim_cmd.c
+vtysh_daemons += pimd
 man8 += $(MANBUILD)/frr-pimd.8
 man8 += $(MANBUILD)/mtracebis.8
 endif
index 9b86c6551776e56f0612d9b7fef9ff26369315b0..875239e871ac4f35110c1268bc38210baa304166 100644 (file)
@@ -11,6 +11,7 @@ vtysh_scan += \
        ripd/rip_debug.c \
        ripd/ripd.c \
        # end
+vtysh_daemons += ripd
 
 if SNMP
 module_LTLIBRARIES += ripd/ripd_snmp.la
index 48ba3613728f6666f395408b9ef87ad177a2ce4a..8d370f1b5d5440201f59d2ae071d294074f2cfa5 100644 (file)
@@ -10,6 +10,7 @@ vtysh_scan += \
        ripngd/ripng_debug.c \
        ripngd/ripngd.c \
        # end
+vtysh_daemons += ripngd
 man8 += $(MANBUILD)/frr-ripngd.8
 endif
 
index 4c43c50d435d0dc90e310f89c5fa759dd4c8d0a4..d161eb6327a4e391b0e6c24c7b5a21dcfdea902b 100644 (file)
@@ -7,6 +7,7 @@ noinst_LIBRARIES += sharpd/libsharp.a
 sbin_PROGRAMS += sharpd/sharpd
 dist_examples_DATA += sharpd/sharpd.conf.sample
 vtysh_scan += sharpd/sharp_vty.c
+vtysh_daemons += sharpd
 man8 += $(MANBUILD)/frr-sharpd.8
 endif
 
index eba7f270bb10824bd7c41bfb163107beda6c5d08..9c630e8f5ff6db4e0eb874759a88e29a192abd38 100644 (file)
@@ -7,6 +7,7 @@ noinst_LIBRARIES += staticd/libstatic.a
 sbin_PROGRAMS += staticd/staticd
 dist_examples_DATA += staticd/staticd.conf.sample
 vtysh_scan += staticd/static_vty.c
+vtysh_daemons += staticd
 man8 += $(MANBUILD)/frr-staticd.8
 endif
 
index 412ee1c3cfe56bef39bae4936c72cfc75250e384..96ae5308941743e7090ea0ca8d94c4cc566a5488 100644 (file)
@@ -7,6 +7,7 @@ noinst_LIBRARIES += vrrpd/libvrrp.a
 sbin_PROGRAMS += vrrpd/vrrpd
 # dist_examples_DATA += staticd/staticd.conf.sample
 vtysh_scan += vrrpd/vrrp_vty.c
+vtysh_daemons += vrrpd
 man8 += $(MANBUILD)/frr-vrrpd.8
 endif
 
diff --git a/vtysh/daemons.pl b/vtysh/daemons.pl
new file mode 100755 (executable)
index 0000000..fc95173
--- /dev/null
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+##
+## generate daemons list and help strings
+##
+## Copyright (C) 2020 NFWare Inc.
+##
+## 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., 51 Franklin St, Fifth Floor, Boston, MA
+## 02110-1301, USA.
+##
+
+use strict;
+
+my @daemons_list = ();
+my @daemons_str = ();
+
+foreach (@ARGV) {
+       push (@daemons_list, $_);
+       push (@daemons_str, "For the $_ daemon\\n");
+}
+
+print "#define DAEMONS_LIST \"<" . join('|', @daemons_list) . ">\"\n";
+print "#define DAEMONS_STR \"" . join('', @daemons_str) . "\"\n";
index e7a1049b68cbe79017da595a89cfaf52fffdd9f8..1e4439d274d60402a0367d06b03fbae1bcd20d07 100644 (file)
@@ -26,6 +26,16 @@ noinst_HEADERS += \
 
 vtysh_vtysh_LDADD = lib/libfrr.la $(LIBCAP) $(LIBREADLINE) $(LIBS) $(LIBPAM)
 
+EXTRA_DIST += vtysh/daemons.pl
+
+BUILT_SOURCES += vtysh/vtysh_daemons.h
+
+# force vtysh_daemons.h
+$(vtysh_vtysh_OBJECTS): vtysh/vtysh_daemons.h
+
+vtysh/vtysh_daemons.h:
+       $(PERL) vtysh/daemons.pl $(vtysh_daemons) > vtysh/vtysh_daemons.h
+
 AM_V_EXTRACT = $(am__v_EXTRACT_$(V))
 am__v_EXTRACT_ = $(am__v_EXTRACT_$(AM_DEFAULT_VERBOSITY))
 am__v_EXTRACT_0 = @echo "  EXTRACT " $@;
index 9993e733533a3f4af4b9c75d0a282d99522b6139..63610a328750af3ce1ba4fa50f0aa8d21e45f2ad 100644 (file)
@@ -38,6 +38,7 @@
 #include "memory.h"
 #include "filter.h"
 #include "vtysh/vtysh.h"
+#include "vtysh/vtysh_daemons.h"
 #include "log.h"
 #include "bgpd/bgp_vty.h"
 #include "ns.h"
index ab53351ae3a2626d83f0069d1eb406a032496ae7..4533d6bafcc9099256a41671b9c068b44cc1990a 100644 (file)
@@ -25,6 +25,8 @@ vtysh_scan += \
 vtysh_scan += zebra/irdp_interface.c
 vtysh_scan += zebra/zebra_fpm.c
 
+vtysh_daemons += zebra
+
 if IRDP
 module_LTLIBRARIES += zebra/zebra_irdp.la
 endif