summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/frrcu.h2
-rw-r--r--lib/libfrr.c45
-rw-r--r--lib/libfrr.h2
-rw-r--r--lib/libospf.h2
-rw-r--r--lib/seqlock.c33
5 files changed, 66 insertions, 18 deletions
diff --git a/lib/frrcu.h b/lib/frrcu.h
index 9f07a69b52..81ab5528a9 100644
--- a/lib/frrcu.h
+++ b/lib/frrcu.h
@@ -156,7 +156,7 @@ extern void rcu_enqueue(struct rcu_head *head, const struct rcu_action *action);
#define rcu_call(func, ptr, field) \
do { \
typeof(ptr) _ptr = (ptr); \
- void (*fptype)(typeof(ptr)); \
+ void (*_fptype)(typeof(ptr)); \
struct rcu_head *_rcu_head = &_ptr->field; \
static const struct rcu_action _rcu_action = { \
.type = RCUA_CALL, \
diff --git a/lib/libfrr.c b/lib/libfrr.c
index 876efe23a8..338a7d0340 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -102,23 +102,25 @@ static void opt_extend(const struct optspec *os)
#define OPTION_SCRIPTDIR 1009
static const struct option lo_always[] = {
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
- {"daemon", no_argument, NULL, 'd'},
- {"module", no_argument, NULL, 'M'},
- {"profile", required_argument, NULL, 'F'},
- {"pathspace", required_argument, NULL, 'N'},
- {"vrfdefaultname", required_argument, NULL, 'o'},
- {"vty_socket", required_argument, NULL, OPTION_VTYSOCK},
- {"moduledir", required_argument, NULL, OPTION_MODULEDIR},
- {"scriptdir", required_argument, NULL, OPTION_SCRIPTDIR},
- {"log", required_argument, NULL, OPTION_LOG},
- {"log-level", required_argument, NULL, OPTION_LOGLEVEL},
- {"command-log-always", no_argument, NULL, OPTION_LOGGING},
- {"limit-fds", required_argument, NULL, OPTION_LIMIT_FDS},
- {NULL}};
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'v' },
+ { "daemon", no_argument, NULL, 'd' },
+ { "module", no_argument, NULL, 'M' },
+ { "profile", required_argument, NULL, 'F' },
+ { "pathspace", required_argument, NULL, 'N' },
+ { "vrfdefaultname", required_argument, NULL, 'o' },
+ { "graceful_restart", optional_argument, NULL, 'K' },
+ { "vty_socket", required_argument, NULL, OPTION_VTYSOCK },
+ { "moduledir", required_argument, NULL, OPTION_MODULEDIR },
+ { "scriptdir", required_argument, NULL, OPTION_SCRIPTDIR },
+ { "log", required_argument, NULL, OPTION_LOG },
+ { "log-level", required_argument, NULL, OPTION_LOGLEVEL },
+ { "command-log-always", no_argument, NULL, OPTION_LOGGING },
+ { "limit-fds", required_argument, NULL, OPTION_LIMIT_FDS },
+ { NULL }
+};
static const struct optspec os_always = {
- "hvdM:F:N:o:",
+ "hvdM:F:N:o:K::",
" -h, --help Display this help and exit\n"
" -v, --version Print program version\n"
" -d, --daemon Runs in daemon mode\n"
@@ -126,13 +128,15 @@ static const struct optspec os_always = {
" -F, --profile Use specified configuration profile\n"
" -N, --pathspace Insert prefix into config & socket paths\n"
" -o, --vrfdefaultname Set default VRF name.\n"
+ " -K, --graceful_restart FRR starting in Graceful Restart mode, with optional route-cleanup timer\n"
" --vty_socket Override vty socket path\n"
" --moduledir Override modules directory\n"
" --scriptdir Override scripts directory\n"
" --log Set Logging to stdout, syslog, or file:<name>\n"
" --log-level Set Logging Level to use, debug, info, warn, etc\n"
" --limit-fds Limit number of fds supported\n",
- lo_always};
+ lo_always
+};
static bool logging_to_stdout = false; /* set when --log stdout specified */
@@ -358,6 +362,8 @@ void frr_preinit(struct frr_daemon_info *daemon, int argc, char **argv)
strlcpy(frr_protonameinst, di->logname, sizeof(frr_protonameinst));
di->cli_mode = FRR_CLI_CLASSIC;
+ di->graceful_restart = false;
+ di->gr_cleanup_time = 0;
/* we may be starting with extra FDs open for whatever purpose,
* e.g. logging, some module, etc. Recording them here allows later
@@ -520,6 +526,11 @@ static int frr_opt(int opt)
di->db_file = optarg;
break;
#endif
+ case 'K':
+ di->graceful_restart = true;
+ if (optarg)
+ di->gr_cleanup_time = atoi(optarg);
+ break;
case 'C':
if (di->flags & FRR_NO_SPLIT_CONFIG)
return 1;
diff --git a/lib/libfrr.h b/lib/libfrr.h
index 77d70448a9..db9cfbcb1f 100644
--- a/lib/libfrr.h
+++ b/lib/libfrr.h
@@ -118,6 +118,8 @@ struct frr_daemon_info {
bool dryrun;
bool daemon_mode;
bool terminal;
+ bool graceful_restart;
+ int gr_cleanup_time;
enum frr_cli_mode cli_mode;
struct event *read_in;
diff --git a/lib/libospf.h b/lib/libospf.h
index 0ac490a00e..8a208beb3c 100644
--- a/lib/libospf.h
+++ b/lib/libospf.h
@@ -58,8 +58,10 @@ extern "C" {
#define OSPF_HELLO_DELAY_DEFAULT 10
#define OSPF_ROUTER_PRIORITY_DEFAULT 1
#define OSPF_RETRANSMIT_INTERVAL_DEFAULT 5
+#define OSPF_RETRANSMIT_WINDOW_DEFAULT 50 /* milliseconds */
#define OSPF_TRANSMIT_DELAY_DEFAULT 1
#define OSPF_DEFAULT_BANDWIDTH 10000 /* Mbps */
+#define OSPF_ACK_DELAY_DEFAULT 1
#define OSPF_DEFAULT_REF_BANDWIDTH 100000 /* Kbps */
diff --git a/lib/seqlock.c b/lib/seqlock.c
index 62ce316920..e74e6718bf 100644
--- a/lib/seqlock.c
+++ b/lib/seqlock.c
@@ -26,6 +26,39 @@
* OS specific synchronization wrappers *
****************************************/
+#ifndef __has_feature /* not available on old GCC */
+#define __has_feature(x) 0
+#endif
+
+#if (defined(__SANITIZE_THREAD__) || __has_feature(thread_sanitizer))
+/* TSAN really does not understand what is going on with the low-level
+ * futex/umtx calls. This leads to a whole bunch of warnings, a lot of which
+ * also have _extremely_ misleading text - since TSAN does not understand that
+ * there is in fact a synchronization primitive involved, it can end up pulling
+ * in completely unrelated things.
+ *
+ * What does work is the "unsupported platform" seqlock implementation based
+ * on a pthread mutex + condvar, since TSAN of course suppports these.
+ *
+ * It may be possible to also fix this with TSAN annotations (__tsan_acquire
+ * and __tsan_release), but using those (correctly) is not easy either, and
+ * for now just get things rolling.
+ */
+
+#ifdef HAVE_SYNC_LINUX_FUTEX
+#undef HAVE_SYNC_LINUX_FUTEX
+#endif
+
+#ifdef HAVE_SYNC_OPENBSD_FUTEX
+#undef HAVE_SYNC_OPENBSD_FUTEX
+#endif
+
+#ifdef HAVE_SYNC_UMTX_OP
+#undef HAVE_SYNC_UMTX_OP
+#endif
+
+#endif /* TSAN */
+
/*
* Linux: sys_futex()
*/