summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COMMUNITY.md21
-rw-r--r--Makefile.am5
-rw-r--r--bgpd/bgp_vty.c4
-rwxr-xr-xconfigure.ac12
-rw-r--r--doc/ospfclient.8.in2
-rw-r--r--lib/grammar_sandbox.c30
-rw-r--r--lib/hash.c17
-rw-r--r--lib/hash.h4
-rw-r--r--lib/thread.c6
-rw-r--r--lib/vty.h9
-rw-r--r--lib/zebra.h2
-rw-r--r--tests/Makefile.am4
-rw-r--r--tools/Makefile.am2
13 files changed, 79 insertions, 39 deletions
diff --git a/COMMUNITY.md b/COMMUNITY.md
index a441929b31..b0d087c382 100644
--- a/COMMUNITY.md
+++ b/COMMUNITY.md
@@ -380,3 +380,24 @@ CLI's are a complicated ugly beast. Additions or changes to the CLI
should use a DEFUN to encapsulate one setting as much as is possible.
Additionally as new DEFUN's are added to the system, documentation
should be provided for the new commands.
+
+### Backwards Compatibility
+
+As a general principle, changes to CLI and code in the lib/ directory
+should be made in a backwards compatible fashion. This means that
+changes that are purely stylistic in nature should be avoided, e.g.,
+renaming an existing macro or library function name without any
+functional change. When adding new parameters to common functions, it is
+also good to consider if this too should be done in a backward
+compatible fashion, e.g., by preserving the old form in addition to
+adding the new form.
+
+This is not to say that minor or even major functional changes to CLI
+and common code should be avoided, but rather that the benefit gained
+from a change should be weighed against the added cost/complexity to
+existing code. Also, that when making such changes, it is good to
+preserve compatibility when possible to do so without introducing
+maintenance overhead/cost. It is also important to keep in mind,
+existing code includes code that may reside in private repositories (and
+is yet to be submitted) or code that has yet to be migrated from Quagga
+to FRR.
diff --git a/Makefile.am b/Makefile.am
index d18837c083..0092ba8c10 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,9 +8,8 @@ SUBDIRS = lib qpb fpm @ZEBRA@ @LIBRFP@ @RFPTEST@ \
DIST_SUBDIRS = lib qpb fpm zebra bgpd ripd ripngd ospfd ospf6d ldpd \
isisd watchfrr vtysh ospfclient doc m4 pkgsrc redhat tests \
- solaris pimd nhrpd eigrpd @LIBRFP@ @RFPTEST@ tools snapcraft \
- babeld \
- python \
+ solaris pimd nhrpd eigrpd bgpd/rfp-example/librfp \
+ bgpd/rfp-example/rfptest tools snapcraft babeld python \
# end
EXTRA_DIST = aclocal.m4 SERVICES REPORTING-BUGS \
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 3c649fd657..9b23940d49 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -7365,7 +7365,7 @@ afi_safi_print (afi_t afi, safi_t safi)
else if (afi == AFI_IP && safi == SAFI_MULTICAST)
return "IPv4 Multicast";
else if (afi == AFI_IP && safi == SAFI_LABELED_UNICAST)
- return "IPv4 labeled-unicast";
+ return "IPv4 Labeled Unicast";
else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
return "IPv4 VPN";
else if (afi == AFI_IP && safi == SAFI_ENCAP)
@@ -7375,7 +7375,7 @@ afi_safi_print (afi_t afi, safi_t safi)
else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
return "IPv6 Multicast";
else if (afi == AFI_IP6 && safi == SAFI_LABELED_UNICAST)
- return "IPv6 labeled-unicast";
+ return "IPv6 Labeled Unicast";
else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
return "IPv6 VPN";
else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
diff --git a/configure.ac b/configure.ac
index 03951503c1..4cfa829f2a 100755
--- a/configure.ac
+++ b/configure.ac
@@ -1969,10 +1969,11 @@ AC_CACHE_VAL(ac_cv_htonl_works,
)
AC_MSG_RESULT($ac_cv_htonl_works)
-AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
+AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
ripngd/Makefile bgpd/Makefile ospfd/Makefile watchfrr/Makefile
ospf6d/Makefile ldpd/Makefile isisd/Makefile vtysh/Makefile
doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
+ bgpd/rfp-example/rfptest/Makefile bgpd/rfp-example/librfp/Makefile
babeld/Makefile
pimd/Makefile
eigrpd/Makefile
@@ -1982,7 +1983,7 @@ AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
pkgsrc/Makefile
python/Makefile
fpm/Makefile
- redhat/frr.spec
+ redhat/frr.spec
snapcraft/Makefile
snapcraft/snapcraft.yaml
lib/version.h
@@ -2007,13 +2008,6 @@ AC_CONFIG_FILES([Makefile lib/Makefile qpb/Makefile zebra/Makefile ripd/Makefile
pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh
pkgsrc/eigrpd.sh])
-if test "${enable_bgp_vnc}" != "no"; then
- if test "${with_rfp_path}" = "bgpd/rfp-example" ; then
- AC_CONFIG_FILES([bgpd/rfp-example/rfptest/Makefile bgpd/rfp-example/librfp/Makefile])
- else
- AC_CONFIG_FILES([${with_rfp_path}/rfptest/Makefile ${with_rfp_path}/librfp/Makefile])
- fi
-fi
AC_CONFIG_FILES([solaris/Makefile])
diff --git a/doc/ospfclient.8.in b/doc/ospfclient.8.in
index fb996a541f..a304beffda 100644
--- a/doc/ospfclient.8.in
+++ b/doc/ospfclient.8.in
@@ -1,5 +1,5 @@
.\" This file was originally generated by help2man 1.36.
-.TH OSPFCLIENT "1" "July 2010"
+.TH OSPFCLIENT "8" "July 2010"
.SH NAME
ospfclient \- an example ospf-api client
.SH SYNOPSIS
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c
index 9bb672dc53..454e076f06 100644
--- a/lib/grammar_sandbox.c
+++ b/lib/grammar_sandbox.c
@@ -50,6 +50,12 @@ init_cmdgraph (struct vty *, struct graph **);
/** shim interface commands **/
struct graph *nodegraph = NULL, *nodegraph_free = NULL;
+#define check_nodegraph() \
+ do { if (!nodegraph) { \
+ vty_outln(vty, "nodegraph not initialized"); \
+ return CMD_WARNING; \
+ } } while (0)
+
DEFUN (grammar_test,
grammar_test_cmd,
"grammar parse LINE...",
@@ -57,6 +63,8 @@ DEFUN (grammar_test,
"parse a command\n"
"command to pass to new parser\n")
{
+ check_nodegraph();
+
int idx_command = 2;
// make a string from tokenized command line
char *command = argv_concat (argv, argc, idx_command);
@@ -85,6 +93,8 @@ DEFUN (grammar_test_complete,
"attempt to complete input on DFA\n"
"command to complete\n")
{
+ check_nodegraph();
+
int idx_command = 2;
char *cmdstr = argv_concat (argv, argc, idx_command);
if (!cmdstr)
@@ -143,6 +153,8 @@ DEFUN (grammar_test_match,
"attempt to match input on DFA\n"
"command to match\n")
{
+ check_nodegraph();
+
int idx_command = 2;
if (argv[2]->arg[0] == '#')
return CMD_SUCCESS;
@@ -209,6 +221,8 @@ DEFUN (grammar_test_doc,
"Test function for docstring\n"
"Command end\n")
{
+ check_nodegraph();
+
// create cmd_element with docstring
struct cmd_element *cmd = XCALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_element));
cmd->string = XSTRDUP (MTYPE_CMD_TOKENS, "test docstring <example|selector follow> (1-255) end VARIABLE [OPTION|set lol] . VARARG");
@@ -243,12 +257,10 @@ DEFUN (grammar_test_show,
"print current accumulated DFA\n"
"include docstrings\n")
{
- struct graph_node *stack[MAXDEPTH];
+ check_nodegraph();
- if (!nodegraph)
- vty_out(vty, "nodegraph uninitialized\r\n");
- else
- pretty_print_graph (vty, vector_slot (nodegraph->nodes, 0), 0, argc >= 3, stack, 0);
+ struct graph_node *stack[MAXDEPTH];
+ pretty_print_graph (vty, vector_slot (nodegraph->nodes, 0), 0, argc >= 3, stack, 0);
return CMD_SUCCESS;
}
@@ -259,14 +271,12 @@ DEFUN (grammar_test_dot,
"print current graph for dot\n"
".dot filename\n")
{
+ check_nodegraph();
+
struct graph_node *stack[MAXDEPTH];
struct graph_node *visited[MAXDEPTH*MAXDEPTH];
size_t vpos = 0;
- if (!nodegraph) {
- vty_out(vty, "nodegraph uninitialized\r\n");
- return CMD_SUCCESS;
- }
FILE *ofd = fopen(argv[2]->arg, "w");
if (!ofd) {
vty_out(vty, "%s: %s\r\n", argv[2]->arg, strerror(errno));
@@ -476,8 +486,6 @@ DEFUN (grammar_access,
/* this is called in vtysh.c to set up the testing shim */
void grammar_sandbox_init(void) {
- init_cmdgraph (NULL, &nodegraph);
-
// install all enable elements
install_element (ENABLE_NODE, &grammar_test_cmd);
install_element (ENABLE_NODE, &grammar_test_show_cmd);
diff --git a/lib/hash.c b/lib/hash.c
index 95643bbae0..bdb2e097c6 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -87,13 +87,8 @@ hash_alloc_intern (void *arg)
}
#define hash_update_ssq(hz, old, new) \
- do { \
- long double res; \
- res = powl(old, 2.0); \
- hz->stats.ssq -= (uint64_t) res;\
- res = powl(new, 2.0); \
- hz->stats.ssq += (uint64_t) res; \
- } while (0); \
+ atomic_fetch_add_explicit(&hz->stats.ssq, (new + old)*(new - old),\
+ memory_order_relaxed);
/* Expand hash if the chain length exceeds the threshold. */
static void hash_expand (struct hash *hash)
@@ -428,6 +423,13 @@ DEFUN(show_hash_stats,
long double ssq; // ssq casted to long double
pthread_mutex_lock (&_hashes_mtx);
+ if (!_hashes)
+ {
+ pthread_mutex_unlock (&_hashes_mtx);
+ vty_outln (vty, "No hash tables in use.");
+ return CMD_SUCCESS;
+ }
+
for (ALL_LIST_ELEMENTS_RO (_hashes, ln, h))
{
if (!h->name)
@@ -482,6 +484,5 @@ DEFUN(show_hash_stats,
void
hash_cmd_init ()
{
- _hashes = list_new();
install_element (ENABLE_NODE, &show_hash_stats_cmd);
}
diff --git a/lib/hash.h b/lib/hash.h
index 01d2b1ddc8..3b2671afae 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -53,9 +53,9 @@ struct hash_backet
struct hashstats
{
/* number of empty hash buckets */
- _Atomic int empty;
+ _Atomic uint_fast32_t empty;
/* sum of squares of bucket length */
- _Atomic uint64_t ssq;
+ _Atomic uint_fast32_t ssq;
};
struct hash
diff --git a/lib/thread.c b/lib/thread.c
index 4e72d4c96f..26fb46e49b 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -564,6 +564,12 @@ thread_master_free_unused (struct thread_master *m)
void
thread_master_free (struct thread_master *m)
{
+ pthread_mutex_lock (&masters_mtx);
+ {
+ listnode_delete (masters, m);
+ }
+ pthread_mutex_unlock (&masters_mtx);
+
thread_array_free (m, m->read);
thread_array_free (m, m->write);
thread_queue_free (m, m->timer);
diff --git a/lib/vty.h b/lib/vty.h
index a76b9f5a17..b4a55180d3 100644
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -182,6 +182,15 @@ struct vty_arg
/* Small macro to determine newline is newline only or linefeed needed. */
#define VTYNL ((vty->type == VTY_TERM) ? "\r\n" : "\n")
+/* for compatibility */
+#define VTY_NEWLINE VTYNL
+#define VTY_GET_INTEGER(desc,v,str) {(v)=strtoul ((str), NULL, 10);}
+#define VTY_GET_INTEGER_RANGE(desc,v,str,min,max) {(v)=strtoul ((str), NULL, 10);}
+#define VTY_GET_ULONG(desc,v,str) {(v)=strtoul ((str), NULL, 10);}
+#define VTY_GET_ULL(desc,v,str) {(v)=strtoull ((str), NULL, 10);}
+#define VTY_GET_IPV4_ADDRESS(desc,v,str) inet_aton ((str), &(v))
+#define VTY_GET_IPV4_PREFIX(desc,v,str) str2prefix_ipv4 ((str), &(v))
+
/* Default time out value */
#define VTY_TIMEOUT_DEFAULT 600
diff --git a/lib/zebra.h b/lib/zebra.h
index 901a49073d..7f2609c125 100644
--- a/lib/zebra.h
+++ b/lib/zebra.h
@@ -126,7 +126,7 @@ typedef unsigned char u_int8_t;
#define __APPLE_USE_RFC_3542
#endif
-#include "lib/openbsd-tree.h"
+#include "openbsd-tree.h"
#include <netinet/in.h>
#include <netinet/in_systm.h>
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 559d769702..8f612c45a5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -148,7 +148,9 @@ EXTRA_DIST = \
lib/test_stream.refout \
lib/test_table.py \
lib/test_timer_correctness.py \
- lib/test_ttable.py
+ lib/test_ttable.py \
+ lib/test_ttable.refout \
+ # end
.PHONY: tests.xml
tests.xml: $(check_PROGRAMS)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index dd32d0dab0..e5a118972b 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -11,6 +11,6 @@ permutations_LDADD = ../lib/libfrr.la
sbin_SCRIPTS = frr-reload.py frr
-EXTRA_DIST += frr.service frr-reload.py frr
+EXTRA_DIST += frr.service frr-reload.py frr etc
ssd_SOURCES = start-stop-daemon.c