]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_vty.c
*: Convert thread_add_XXX functions to event_add_XXX
[mirror_frr.git] / bgpd / bgp_vty.c
index cf9a05b198f582dbb7dfe5f10c925c65c7335ca8..95f2b82e934f67257a2f0fca5d07e3f10340cfd6 100644 (file)
@@ -16,7 +16,7 @@
 #include "buffer.h"
 #include "linklist.h"
 #include "stream.h"
-#include "thread.h"
+#include "event.h"
 #include "log.h"
 #include "memory.h"
 #include "lib_vty.h"
@@ -8893,7 +8893,7 @@ DEFPY(neighbor_path_attribute_discard,
 {
        struct peer *peer;
        int idx = 0;
-       const char *discard_attrs = NULL;
+       char *discard_attrs = NULL;
 
        peer = peer_and_group_lookup_vty(vty, neighbor);
        if (!peer)
@@ -8905,6 +8905,8 @@ DEFPY(neighbor_path_attribute_discard,
 
        bgp_path_attribute_discard_vty(vty, peer, discard_attrs, true);
 
+       XFREE(MTYPE_TMP, discard_attrs);
+
        return CMD_SUCCESS;
 }
 
@@ -8920,7 +8922,7 @@ DEFPY(no_neighbor_path_attribute_discard,
 {
        struct peer *peer;
        int idx = 0;
-       const char *discard_attrs = NULL;
+       char *discard_attrs = NULL;
 
        peer = peer_and_group_lookup_vty(vty, neighbor);
        if (!peer)
@@ -8932,6 +8934,8 @@ DEFPY(no_neighbor_path_attribute_discard,
 
        bgp_path_attribute_discard_vty(vty, peer, discard_attrs, false);
 
+       XFREE(MTYPE_TMP, discard_attrs);
+
        return CMD_SUCCESS;
 }
 
@@ -8946,7 +8950,7 @@ DEFPY(neighbor_path_attribute_treat_as_withdraw,
 {
        struct peer *peer;
        int idx = 0;
-       const char *withdraw_attrs = NULL;
+       char *withdraw_attrs = NULL;
 
        peer = peer_and_group_lookup_vty(vty, neighbor);
        if (!peer)
@@ -8958,6 +8962,8 @@ DEFPY(neighbor_path_attribute_treat_as_withdraw,
 
        bgp_path_attribute_withdraw_vty(vty, peer, withdraw_attrs, true);
 
+       XFREE(MTYPE_TMP, withdraw_attrs);
+
        return CMD_SUCCESS;
 }
 
@@ -8973,7 +8979,7 @@ DEFPY(no_neighbor_path_attribute_treat_as_withdraw,
 {
        struct peer *peer;
        int idx = 0;
-       const char *withdraw_attrs = NULL;
+       char *withdraw_attrs = NULL;
 
        peer = peer_and_group_lookup_vty(vty, neighbor);
        if (!peer)
@@ -8985,6 +8991,8 @@ DEFPY(no_neighbor_path_attribute_treat_as_withdraw,
 
        bgp_path_attribute_withdraw_vty(vty, peer, withdraw_attrs, false);
 
+       XFREE(MTYPE_TMP, withdraw_attrs);
+
        return CMD_SUCCESS;
 }
 
@@ -11668,37 +11676,22 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
                                vty_out(vty, "4 ");
                                vty_out(vty, ASN_FORMAT_SPACE(bgp->asnotation),
                                        &peer->as);
-                               if (show_wide) {
+                               if (show_wide)
                                        vty_out(vty,
                                                ASN_FORMAT_SPACE(
                                                        bgp->asnotation),
                                                peer->change_local_as
                                                        ? &peer->change_local_as
                                                        : &peer->local_as);
-                                       vty_out(vty,
-                                               " %9u %9u %8" PRIu64
-                                               " %4zu %4zu %8s",
-                                               PEER_TOTAL_RX(peer),
-                                               PEER_TOTAL_TX(peer),
-                                               peer->version[afi][safi],
-                                               inq_count, outq_count,
-                                               peer_uptime(peer->uptime,
-                                                           timebuf,
-                                                           BGP_UPTIME_LEN, 0,
-                                                           NULL));
-                               } else {
-                                       vty_out(vty,
-                                               " %9u %9u %8" PRIu64
-                                               " %4zu %4zu %8s",
-                                               PEER_TOTAL_RX(peer),
-                                               PEER_TOTAL_TX(peer),
-                                               peer->version[afi][safi],
-                                               inq_count, outq_count,
-                                               peer_uptime(peer->uptime,
-                                                           timebuf,
-                                                           BGP_UPTIME_LEN, 0,
-                                                           NULL));
-                               }
+                               vty_out(vty,
+                                       " %9u %9u %8" PRIu64 " %4zu %4zu %8s",
+                                       PEER_TOTAL_RX(peer),
+                                       PEER_TOTAL_TX(peer),
+                                       peer->version[afi][safi], inq_count,
+                                       outq_count,
+                                       peer_uptime(peer->uptime, timebuf,
+                                                   BGP_UPTIME_LEN, 0, NULL));
+
                                if (peer_established(peer)) {
                                        if (peer->afc_recv[afi][safi]) {
                                                if (CHECK_FLAG(
@@ -18771,14 +18764,14 @@ static const struct cmd_variable_handler bgp_var_peergroup[] = {
 
 DEFINE_HOOK(bgp_config_end, (struct bgp *bgp), (bgp));
 
-static struct thread *t_bgp_cfg;
+static struct event *t_bgp_cfg;
 
 bool bgp_config_inprocess(void)
 {
        return thread_is_scheduled(t_bgp_cfg);
 }
 
-static void bgp_config_finish(struct thread *t)
+static void bgp_config_finish(struct event *t)
 {
        struct listnode *node;
        struct bgp *bgp;
@@ -18791,8 +18784,8 @@ static void bgp_config_start(void)
 {
 #define BGP_PRE_CONFIG_MAX_WAIT_SECONDS 600
        THREAD_OFF(t_bgp_cfg);
-       thread_add_timer(bm->master, bgp_config_finish, NULL,
-                        BGP_PRE_CONFIG_MAX_WAIT_SECONDS, &t_bgp_cfg);
+       event_add_timer(bm->master, bgp_config_finish, NULL,
+                       BGP_PRE_CONFIG_MAX_WAIT_SECONDS, &t_bgp_cfg);
 }
 
 /* When we receive a hook the configuration is read,
@@ -18819,8 +18812,8 @@ static void bgp_config_end(void)
        /* Start a new timer to make sure we don't send EoR
         * before route-maps are processed.
         */
-       thread_add_timer(bm->master, bgp_config_finish, NULL,
-                        bgp_post_config_delay, &t_bgp_cfg);
+       event_add_timer(bm->master, bgp_config_finish, NULL,
+                       bgp_post_config_delay, &t_bgp_cfg);
 }
 
 static int config_write_interface_one(struct vty *vty, struct vrf *vrf)