diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/bfd.c | 29 | ||||
| -rw-r--r-- | lib/bfd.h | 47 | ||||
| -rw-r--r-- | lib/if.h | 12 | ||||
| -rw-r--r-- | lib/libfrr.h | 2 | ||||
| -rw-r--r-- | lib/log.c | 2 | ||||
| -rw-r--r-- | lib/log.h | 10 | ||||
| -rw-r--r-- | lib/sigevent.c | 34 | ||||
| -rw-r--r-- | lib/sigevent.h | 16 | ||||
| -rw-r--r-- | lib/subdir.am | 3 | ||||
| -rw-r--r-- | lib/thread.c | 2 | ||||
| -rw-r--r-- | lib/vty.c | 6 |
11 files changed, 51 insertions, 112 deletions
@@ -646,32 +646,16 @@ void bfd_sess_set_vrf(struct bfd_session_params *bsp, vrf_id_t vrf_id) bsp->args.vrf_id = vrf_id; } -void bfd_sess_set_mininum_ttl(struct bfd_session_params *bsp, uint8_t min_ttl) +void bfd_sess_set_hop_count(struct bfd_session_params *bsp, uint8_t hops) { - assert(min_ttl != 0); - - if (bsp->args.ttl == ((BFD_SINGLE_HOP_TTL + 1) - min_ttl)) - return; - - /* If already installed, remove the old setting. */ - _bfd_sess_remove(bsp); - - /* Invert TTL value: protocol expects number of hops. */ - min_ttl = (BFD_SINGLE_HOP_TTL + 1) - min_ttl; - bsp->args.ttl = min_ttl; - bsp->args.mhop = (min_ttl > 1); -} - -void bfd_sess_set_hop_count(struct bfd_session_params *bsp, uint8_t min_ttl) -{ - if (bsp->args.ttl == min_ttl) + if (bsp->args.ttl == hops) return; /* If already installed, remove the old setting. */ _bfd_sess_remove(bsp); - bsp->args.ttl = min_ttl; - bsp->args.mhop = (min_ttl > 1); + bsp->args.ttl = hops; + bsp->args.mhop = (hops > 1); } @@ -706,11 +690,6 @@ enum bfd_session_state bfd_sess_status(const struct bfd_session_params *bsp) return bsp->bss.state; } -uint8_t bfd_sess_minimum_ttl(const struct bfd_session_params *bsp) -{ - return ((BFD_SINGLE_HOP_TTL + 1) - bsp->args.ttl); -} - uint8_t bfd_sess_hop_count(const struct bfd_session_params *bsp) { return bsp->args.ttl; @@ -181,39 +181,14 @@ void bfd_sess_set_vrf(struct bfd_session_params *bsp, vrf_id_t vrf_id); * Configure the BFD session single/multi hop setting. * * NOTE: - * If the TTL changed the session is removed and must be installed again - * with `bfd_sess_install`. + * If the number of hops is changed the session is removed and must be + * installed again with `bfd_sess_install`. * * \param bsp BFD session parameters. - * \param min_ttl minimum TTL value expected (255 for single hop, 254 for - * multi hop with single hop, 253 for multi hop with two hops - * and so on). See `BFD_SINGLE_HOP_TTL` and - * `BFD_MULTI_HOP_MIN_TTL` for defaults. - * - * To simplify things if your protocol only knows the amount of hops it is - * better to use `bfd_sess_set_hops` instead. + * \param hops maximum amount of hops expected (1 for single hop, 2 or + * more for multi hop). */ -void bfd_sess_set_mininum_ttl(struct bfd_session_params *bsp, uint8_t min_ttl); - -/** To use single hop the minimum TTL must be set to this. */ -#define BFD_SINGLE_HOP_TTL 255 -/** To use multi hop the minimum TTL must be set to this or less. */ -#define BFD_MULTI_HOP_MIN_TTL 254 - -/** - * This function is the inverted version of `bfd_sess_set_minimum_ttl`. - * Instead of receiving the minimum expected TTL, it receives the amount of - * hops the protocol will jump. - * - * NOTE: - * If the TTL changed the session is removed and must be installed again - * with `bfd_sess_install`. - * - * \param bsp BFD session parameters. - * \param min_ttl minimum amount of hops expected (1 for single hop, 2 or - * more for multi hop). - */ -void bfd_sess_set_hop_count(struct bfd_session_params *bsp, uint8_t min_ttl); +void bfd_sess_set_hop_count(struct bfd_session_params *bsp, uint8_t hops); /** * Configure the BFD session to set the Control Plane Independent bit. @@ -278,17 +253,7 @@ void bfd_sess_uninstall(struct bfd_session_params *bsp); enum bfd_session_state bfd_sess_status(const struct bfd_session_params *bsp); /** - * Get BFD session minimum TTL configured value. - * - * \param bsp session parameters. - * - * \returns configured minimum TTL. - */ -uint8_t bfd_sess_minimum_ttl(const struct bfd_session_params *bsp); - -/** - * Inverted version of `bfd_sess_minimum_ttl`. Gets the amount of hops in the - * way to the peer. + * Get BFD session amount of hops configured value. * * \param bsp session parameters. * @@ -399,16 +399,12 @@ struct connected { /* The ZEBRA_IFC_REAL flag should be set if and only if this address exists in the kernel and is actually usable. (A case where it exists - but - is not yet usable would be IPv6 with DAD) + but is not yet usable would be IPv6 with DAD) The ZEBRA_IFC_CONFIGURED flag should be set if and only if this - address - was configured by the user from inside quagga. + address was configured by the user from inside frr. The ZEBRA_IFC_QUEUED flag should be set if and only if the address - exists - in the kernel. It may and should be set although the address might - not be - usable yet. (compare with ZEBRA_IFC_REAL) + exists in the kernel. It may and should be set although the + address might not be usable yet. (compare with ZEBRA_IFC_REAL) The ZEBRA_IFC_DOWN flag is used to record that an address is present, but down/unavailable. */ diff --git a/lib/libfrr.h b/lib/libfrr.h index 3dc5d7af81..ed7e9c099e 100644 --- a/lib/libfrr.h +++ b/lib/libfrr.h @@ -94,7 +94,7 @@ struct frr_daemon_info { const char *copyright; char startinfo[128]; - struct quagga_signal_t *signals; + struct frr_signal_t *signals; size_t n_signals; struct zebra_privs_t *privs; @@ -64,7 +64,7 @@ const char *lookup_msg(const struct message *mz, int kz, const char *nf) } /* For time string format. */ -size_t quagga_timestamp(int timestamp_precision, char *buf, size_t buflen) +size_t frr_timestamp(int timestamp_precision, char *buf, size_t buflen) { static struct { time_t last; @@ -102,9 +102,9 @@ extern void zlog_backtrace_sigsafe(int priority, void *program_counter); It caches the most recent localtime result and can therefore avoid multiple calls within the same second. If buflen is too small, *buf will be set to '\0', and 0 will be returned. */ -#define QUAGGA_TIMESTAMP_LEN 40 -extern size_t quagga_timestamp(int timestamp_precision /* # subsecond digits */, - char *buf, size_t buflen); +#define FRR_TIMESTAMP_LEN 40 +extern size_t frr_timestamp(int timestamp_precision /* # subsecond digits */, + char *buf, size_t buflen); extern void zlog_hexdump(const void *mem, size_t len); extern const char *zlog_sanitize(char *buf, size_t bufsz, const void *in, @@ -135,8 +135,8 @@ struct timestamp_control { size_t len; /* length of rendered timestamp */ int precision; /* configuration parameter */ int already_rendered; /* should be initialized to 0 */ - char buf[QUAGGA_TIMESTAMP_LEN]; /* will contain the rendered timestamp - */ + char buf[FRR_TIMESTAMP_LEN]; /* will contain the rendered timestamp + */ }; /* Defines for use in command construction: */ diff --git a/lib/sigevent.c b/lib/sigevent.c index 6710527ae9..00bc31f517 100644 --- a/lib/sigevent.c +++ b/lib/sigevent.c @@ -36,10 +36,10 @@ /* master signals descriptor struct */ -static struct quagga_sigevent_master_t { +static struct frr_sigevent_master_t { struct thread *t; - struct quagga_signal_t *signals; + struct frr_signal_t *signals; int sigc; volatile sig_atomic_t caught; @@ -48,10 +48,10 @@ static struct quagga_sigevent_master_t { /* Generic signal handler * Schedules signal event thread */ -static void quagga_signal_handler(int signo) +static void frr_signal_handler(int signo) { int i; - struct quagga_signal_t *sig; + struct frr_signal_t *sig; for (i = 0; i < sigmaster.sigc; i++) { sig = &(sigmaster.signals[i]); @@ -91,9 +91,9 @@ bool frr_sigevent_check(sigset_t *setp) } /* check if signals have been caught and run appropriate handlers */ -int quagga_sigevent_process(void) +int frr_sigevent_process(void) { - struct quagga_signal_t *sig; + struct frr_signal_t *sig; int i; #ifdef SIGEVENT_BLOCK_SIGNALS /* shouldn't need to block signals, but potentially may be needed */ @@ -110,7 +110,7 @@ int quagga_sigevent_process(void) if ((sigprocmask(SIG_BLOCK, &newmask, &oldmask)) < 0) { flog_err_sys(EC_LIB_SYSTEM_CALL, - "quagga_signal_timer: couldnt block signals!"); + "frr_signal_timer: couldnt block signals!"); return -1; } #endif /* SIGEVENT_BLOCK_SIGNALS */ @@ -143,15 +143,15 @@ int quagga_sigevent_process(void) #ifdef SIGEVENT_SCHEDULE_THREAD /* timer thread to check signals. shouldn't be needed */ -int quagga_signal_timer(struct thread *t) +int frr_signal_timer(struct thread *t) { - struct quagga_sigevent_master_t *sigm; + struct frr_sigevent_master_t *sigm; sigm = THREAD_ARG(t); sigm->t = NULL; - thread_add_timer(sigm->t->master, quagga_signal_timer, &sigmaster, - QUAGGA_SIGNAL_TIMER_INTERVAL, &sigm->t); - return quagga_sigevent_process(); + thread_add_timer(sigm->t->master, frr_signal_timer, &sigmaster, + FRR_SIGNAL_TIMER_INTERVAL, &sigm->t); + return frr_sigevent_process(); } #endif /* SIGEVENT_SCHEDULE_THREAD */ @@ -163,7 +163,7 @@ static int signal_set(int signo) struct sigaction sig; struct sigaction osig; - sig.sa_handler = &quagga_signal_handler; + sig.sa_handler = &frr_signal_handler; sigfillset(&sig.sa_mask); sig.sa_flags = 0; if (signo == SIGALRM) { @@ -348,11 +348,11 @@ static void trap_default_signals(void) } void signal_init(struct thread_master *m, int sigc, - struct quagga_signal_t signals[]) + struct frr_signal_t signals[]) { int i = 0; - struct quagga_signal_t *sig; + struct frr_signal_t *sig; /* First establish some default handlers that can be overridden by the application. */ @@ -370,7 +370,7 @@ void signal_init(struct thread_master *m, int sigc, #ifdef SIGEVENT_SCHEDULE_THREAD sigmaster.t = NULL; - thread_add_timer(m, quagga_signal_timer, &sigmaster, - QUAGGA_SIGNAL_TIMER_INTERVAL, &sigmaster.t); + thread_add_timer(m, frr_signal_timer, &sigmaster, + FRR_SIGNAL_TIMER_INTERVAL, &sigmaster.t); #endif /* SIGEVENT_SCHEDULE_THREAD */ } diff --git a/lib/sigevent.h b/lib/sigevent.h index 4a39b22889..dd1ee99587 100644 --- a/lib/sigevent.h +++ b/lib/sigevent.h @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _QUAGGA_SIGNAL_H -#define _QUAGGA_SIGNAL_H +#ifndef _FRR_SIGNAL_H +#define _FRR_SIGNAL_H #include <thread.h> @@ -29,9 +29,9 @@ extern "C" { #endif -#define QUAGGA_SIGNAL_TIMER_INTERVAL 2L +#define FRR_SIGNAL_TIMER_INTERVAL 2L -struct quagga_signal_t { +struct frr_signal_t { int signal; /* signal number */ void (*handler)(void); /* handler to call */ @@ -42,11 +42,11 @@ struct quagga_signal_t { * takes: * - pointer to valid struct thread_master * - number of elements in passed in signals array - * - array of quagga_signal_t's describing signals to handle + * - array of frr_signal_t's describing signals to handle * and handlers to use for each signal */ extern void signal_init(struct thread_master *m, int sigc, - struct quagga_signal_t *signals); + struct frr_signal_t *signals); /* @@ -58,10 +58,10 @@ extern void signal_init(struct thread_master *m, int sigc, bool frr_sigevent_check(sigset_t *setp); /* check whether there are signals to handle, process any found */ -extern int quagga_sigevent_process(void); +extern int frr_sigevent_process(void); #ifdef __cplusplus } #endif -#endif /* _QUAGGA_SIGNAL_H */ +#endif /* _FRR_SIGNAL_H */ diff --git a/lib/subdir.am b/lib/subdir.am index dab5fb9e83..bb10d71ed1 100644 --- a/lib/subdir.am +++ b/lib/subdir.am @@ -3,7 +3,7 @@ # lib_LTLIBRARIES += lib/libfrr.la lib_libfrr_la_LDFLAGS = $(LIB_LDFLAGS) -version-info 0:0:0 -Xlinker -e_libfrr_version -lib_libfrr_la_LIBADD = $(LIBCAP) $(UNWIND_LIBS) $(LIBYANG_LIBS) $(LUA_LIB) $(UST_LIBS) $(LIBM) +lib_libfrr_la_LIBADD = $(LIBCAP) $(UNWIND_LIBS) $(LIBYANG_LIBS) $(LUA_LIB) $(UST_LIBS) $(LIBCRYPT) $(LIBDL) $(LIBM) lib_libfrr_la_SOURCES = \ lib/agg_table.c \ @@ -130,7 +130,6 @@ nodist_lib_libfrr_la_SOURCES = \ yang/ietf/ietf-interfaces.yang.c \ yang/ietf/ietf-bgp-types.yang.c \ yang/frr-module-translator.yang.c \ - yang/frr-nexthop.yang.c \ # end vtysh_scan += \ diff --git a/lib/thread.c b/lib/thread.c index 5dbba6363d..7b223ed6de 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -1695,7 +1695,7 @@ struct thread *thread_fetch(struct thread_master *m, struct thread *fetch) do { /* Handle signals if any */ if (m->handle_signals) - quagga_sigevent_process(); + frr_sigevent_process(); pthread_mutex_lock(&m->mtx); @@ -283,10 +283,10 @@ done: /* Output current time to the vty. */ void vty_time_print(struct vty *vty, int cr) { - char buf[QUAGGA_TIMESTAMP_LEN]; + char buf[FRR_TIMESTAMP_LEN]; - if (quagga_timestamp(0, buf, sizeof(buf)) == 0) { - zlog_info("quagga_timestamp error"); + if (frr_timestamp(0, buf, sizeof(buf)) == 0) { + zlog_info("frr_timestamp error"); return; } if (cr) |
