X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=zebra%2Fzebra_fpm.c;h=fa48c03c713abb52b198822860f78771a1dfee75;hb=61678a82f875a2f584f9602153a2f3f16472b951;hp=32b9763c56a5ac4da95d3681ae35a75df7842a54;hpb=a12bb225a6681b7e7eb0aac105cbc8b745675131;p=mirror_frr.git diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index 32b9763c5..fa48c03c7 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -498,6 +498,11 @@ static inline void zfpm_write_off(void) THREAD_WRITE_OFF(zfpm_g->t_write); } +static inline void zfpm_connect_off(void) +{ + THREAD_TIMER_OFF(zfpm_g->t_connect); +} + /* * zfpm_conn_up_thread_cb * @@ -711,7 +716,6 @@ static void zfpm_connection_down(const char *detail) * Start thread to clean up state after the connection goes down. */ assert(!zfpm_g->t_conn_down); - zfpm_debug("Starting conn_down thread"); zfpm_rnodes_iter_init(&zfpm_g->t_conn_down_state.iter); zfpm_g->t_conn_down = NULL; thread_add_timer_msec(zfpm_g->master, zfpm_conn_down_thread_cb, NULL, 0, @@ -732,7 +736,6 @@ static int zfpm_read_cb(struct thread *thread) fpm_msg_hdr_t *hdr; zfpm_g->stats.read_cb_calls++; - zfpm_g->t_read = NULL; /* * Check if async connect is now done. @@ -806,8 +809,6 @@ static int zfpm_read_cb(struct thread *thread) goto done; } - zfpm_debug("Read out a full fpm message"); - /* * Just throw it away for now. */ @@ -829,7 +830,7 @@ static bool zfpm_updates_pending(void) /* * zfpm_writes_pending * - * Returns TRUE if we may have something to write to the FPM. + * Returns true if we may have something to write to the FPM. */ static int zfpm_writes_pending(void) { @@ -1160,7 +1161,6 @@ static int zfpm_write_cb(struct thread *thread) int num_writes; zfpm_g->stats.write_cb_calls++; - zfpm_g->t_write = NULL; /* * Check if async connect is now done. @@ -1244,12 +1244,11 @@ static int zfpm_connect_cb(struct thread *t) int sock, ret; struct sockaddr_in serv; - zfpm_g->t_connect = NULL; assert(zfpm_g->state == ZFPM_STATE_ACTIVE); sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) { - zfpm_debug("Failed to create socket for connect(): %s", + zlog_err("Failed to create socket for connect(): %s", strerror(errno)); zfpm_g->stats.connect_no_sock++; return 0; @@ -1403,7 +1402,7 @@ static void zfpm_start_connect_timer(const char *reason) /* * zfpm_is_enabled * - * Returns TRUE if the zebra FPM module has been enabled. + * Returns true if the zebra FPM module has been enabled. */ static inline int zfpm_is_enabled(void) { @@ -1413,7 +1412,7 @@ static inline int zfpm_is_enabled(void) /* * zfpm_conn_is_up * - * Returns TRUE if the connection to the FPM is up. + * Returns true if the connection to the FPM is up. */ static inline int zfpm_conn_is_up(void) { @@ -1927,6 +1926,9 @@ static inline void zfpm_init_message_format(const char *format) "FPM protobuf message format is not available"); return; } + flog_warn(EC_ZEBRA_PROTOBUF_NOT_AVAILABLE, + "FPM protobuf message format is deprecated and scheduled to be removed. " + "Please convert to using netlink format or contact dev@lists.frrouting.org with your use case."); zfpm_g->message_format = ZFPM_MSG_FORMAT_PROTOBUF; return; } @@ -1969,10 +1971,10 @@ static struct cmd_node zebra_node = {ZEBRA_NODE, "", 1}; * One-time initialization of the Zebra FPM module. * * @param[in] port port at which FPM is running. - * @param[in] enable TRUE if the zebra FPM module should be enabled + * @param[in] enable true if the zebra FPM module should be enabled * @param[in] format to use to talk to the FPM. Can be 'netink' or 'protobuf'. * - * Returns TRUE on success. + * Returns true on success. */ static int zfpm_init(struct thread_master *master) { @@ -2029,11 +2031,24 @@ static int zfpm_init(struct thread_master *master) return 0; } +static int zfpm_fini(void) +{ + zfpm_write_off(); + zfpm_read_off(); + zfpm_connect_off(); + + zfpm_stop_stats_timer(); + + hook_unregister(rib_update, zfpm_trigger_update); + return 0; +} + static int zebra_fpm_module_init(void) { hook_register(rib_update, zfpm_trigger_update); hook_register(zebra_rmac_update, zfpm_trigger_rmac_update); hook_register(frr_late_init, zfpm_init); + hook_register(frr_early_fini, zfpm_fini); return 0; }