diff options
| -rw-r--r-- | bgpd/bgp_route.c | 4 | ||||
| -rw-r--r-- | bgpd/bgp_table.c | 6 | ||||
| -rw-r--r-- | bgpd/bgp_table.h | 3 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 71 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 30 | ||||
| -rw-r--r-- | lib/mpls.h | 4 | ||||
| -rw-r--r-- | lib/termtable.c | 8 | ||||
| -rw-r--r-- | tools/etc/frr/daemons | 1 | ||||
| -rw-r--r-- | tools/etc/frr/daemons.conf | 1 | ||||
| -rw-r--r-- | vtysh/vtysh.c | 14 | ||||
| -rw-r--r-- | zebra/zebra_mpls.c | 39 |
11 files changed, 76 insertions, 105 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 979e7bda35..e7eb7b6d2f 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -3532,10 +3532,6 @@ bgp_cleanup_table(struct bgp_table *table, safi_t safi) && (ri->sub_type == BGP_ROUTE_NORMAL || ri->sub_type == BGP_ROUTE_AGGREGATE)) { -#if ENABLE_BGP_VNC - if (table->owner && table->owner->bgp) - vnc_import_bgp_del_route(table->owner->bgp, &rn->p, ri); -#endif bgp_zebra_withdraw (&rn->p, ri, safi); bgp_info_reap (rn, ri); } diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index ff0cfdd658..642807e7ab 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -50,12 +50,6 @@ bgp_table_unlock (struct bgp_table *rt) route_table_finish (rt->route_table); rt->route_table = NULL; - if (rt->owner) - { - peer_unlock (rt->owner); - rt->owner = NULL; - } - XFREE (MTYPE_BGP_TABLE, rt); } diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index cff270ebb9..7b22872628 100644 --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h @@ -31,9 +31,6 @@ struct bgp_table int lock; - /* The owner of this 'bgp_table' structure. */ - struct peer *owner; - struct route_table *route_table; uint64_t version; }; diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 88b434298e..b2635c9851 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1249,7 +1249,7 @@ DEFUN (bgp_maxmed_admin, DEFUN (bgp_maxmed_admin_medv, bgp_maxmed_admin_medv_cmd, - "bgp max-med administrative (0-4294967294)", + "bgp max-med administrative (0-4294967295)", BGP_STR "Advertise routes with max-med\n" "Administratively applied, for an indefinite period\n" @@ -1259,7 +1259,7 @@ DEFUN (bgp_maxmed_admin_medv, int idx_number = 3; bgp->v_maxmed_admin = 1; - VTY_GET_INTEGER ("max-med admin med-value", bgp->maxmed_admin_value, argv[idx_number]->arg); + bgp->maxmed_admin_value = strtoul (argv[idx_number]->arg, NULL, 10); bgp_maxmed_update(bgp); @@ -1268,7 +1268,7 @@ DEFUN (bgp_maxmed_admin_medv, DEFUN (no_bgp_maxmed_admin, no_bgp_maxmed_admin_cmd, - "no bgp max-med administrative [(0-4294967294)]", + "no bgp max-med administrative [(0-4294967295)]", NO_STR BGP_STR "Advertise routes with max-med\n" @@ -1285,24 +1285,7 @@ DEFUN (no_bgp_maxmed_admin, DEFUN (bgp_maxmed_onstartup, bgp_maxmed_onstartup_cmd, - "bgp max-med on-startup (5-86400)", - BGP_STR - "Advertise routes with max-med\n" - "Effective on a startup\n" - "Time (seconds) period for max-med\n") -{ - VTY_DECLVAR_CONTEXT(bgp, bgp); - int idx_number = 3; - VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[idx_number]->arg); - bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; - bgp_maxmed_update(bgp); - - return CMD_SUCCESS; -} - -DEFUN (bgp_maxmed_onstartup_medv, - bgp_maxmed_onstartup_medv_cmd, - "bgp max-med on-startup (5-86400) (0-4294967294)", + "bgp max-med on-startup (5-86400) [(0-4294967295)]", BGP_STR "Advertise routes with max-med\n" "Effective on a startup\n" @@ -1310,10 +1293,15 @@ DEFUN (bgp_maxmed_onstartup_medv, "Max MED value to be used\n") { VTY_DECLVAR_CONTEXT(bgp, bgp); - int idx_number = 3; - int idx_number_2 = 4; - VTY_GET_INTEGER ("max-med on-startup period", bgp->v_maxmed_onstartup, argv[idx_number]->arg); - VTY_GET_INTEGER ("max-med on-startup med-value", bgp->maxmed_onstartup_value, argv[idx_number_2]->arg); + int idx = 0; + + argv_find (argv, argc, "(5-86400)", &idx); + bgp->v_maxmed_onstartup = strtoul (argv[idx]->arg, NULL, 10); + if (argv_find (argv, argc, "(0-4294967295)", &idx)) + bgp->maxmed_onstartup_value = strtoul (argv[idx]->arg, NULL, 10); + else + bgp->maxmed_onstartup_value = BGP_MAXMED_VALUE_DEFAULT; + bgp_maxmed_update(bgp); return CMD_SUCCESS; @@ -1321,7 +1309,7 @@ DEFUN (bgp_maxmed_onstartup_medv, DEFUN (no_bgp_maxmed_onstartup, no_bgp_maxmed_onstartup_cmd, - "no bgp max-med on-startup [(5-86400) [(0-4294967294)]]", + "no bgp max-med on-startup [(5-86400) [(0-4294967295)]]", NO_STR BGP_STR "Advertise routes with max-med\n" @@ -1490,25 +1478,11 @@ DEFUN (no_bgp_wpkt_quanta, return bgp_wpkt_quanta_config_vty(vty, argv[idx_number]->arg, 0); } -static int -bgp_coalesce_config_vty (struct vty *vty, const char *num, char set) -{ - VTY_DECLVAR_CONTEXT(bgp, bgp); - - if (set) - VTY_GET_INTEGER_RANGE ("coalesce-time", bgp->coalesce_time, num, - 0, 4294967295); - else - bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; - - return CMD_SUCCESS; -} - int bgp_config_write_coalesce_time (struct vty *vty, struct bgp *bgp) { if (bgp->coalesce_time != BGP_DEFAULT_SUBGROUP_COALESCE_TIME) - vty_out (vty, " coalesce-time %d%s", + vty_out (vty, " coalesce-time %u%s", bgp->coalesce_time, VTY_NEWLINE); return 0; @@ -1521,8 +1495,12 @@ DEFUN (bgp_coalesce_time, "Subgroup coalesce timer\n" "Subgroup coalesce timer value (in ms)\n") { - int idx_number = 1; - return bgp_coalesce_config_vty(vty, argv[idx_number]->arg, 1); + VTY_DECLVAR_CONTEXT(bgp, bgp); + + int idx = 0; + argv_find (argv, argc, "(0-4294967295)", &idx); + bgp->coalesce_time = strtoul (argv[idx]->arg, NULL, 10); + return CMD_SUCCESS; } DEFUN (no_bgp_coalesce_time, @@ -1532,8 +1510,10 @@ DEFUN (no_bgp_coalesce_time, "Subgroup coalesce timer\n" "Subgroup coalesce timer value (in ms)\n") { - int idx_number = 2; - return bgp_coalesce_config_vty(vty, argv[idx_number]->arg, 0); + VTY_DECLVAR_CONTEXT(bgp, bgp); + + bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; + return CMD_SUCCESS; } /* Maximum-paths configuration */ @@ -10993,7 +10973,6 @@ bgp_vty_init (void) install_element (BGP_NODE, &bgp_maxmed_admin_medv_cmd); install_element (BGP_NODE, &bgp_maxmed_onstartup_cmd); install_element (BGP_NODE, &no_bgp_maxmed_onstartup_cmd); - install_element (BGP_NODE, &bgp_maxmed_onstartup_medv_cmd); /* bgp disable-ebgp-connected-nh-check */ install_element (BGP_NODE, &bgp_disable_connected_route_check_cmd); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 99db69b7c5..3d0bb8b039 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -6798,7 +6798,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp, ((! peer_group_active (peer) && peer->v_routeadv != BGP_DEFAULT_EBGP_ROUTEADV) || (peer_group_active (peer) && peer->v_routeadv != g_peer->v_routeadv))) { - vty_out (vty, " neighbor %s advertisement-interval %d%s", + vty_out (vty, " neighbor %s advertisement-interval %u%s", addr, peer->v_routeadv, VTY_NEWLINE); } @@ -6807,7 +6807,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp, ((! peer_group_active (peer) && (peer->keepalive != BGP_DEFAULT_KEEPALIVE || peer->holdtime != BGP_DEFAULT_HOLDTIME)) || (peer_group_active (peer) && (peer->keepalive != g_peer->keepalive || peer->holdtime != g_peer->holdtime)))) { - vty_out (vty, " neighbor %s timers %d %d%s", addr, + vty_out (vty, " neighbor %s timers %u %u%s", addr, peer->keepalive, peer->holdtime, VTY_NEWLINE); } @@ -6816,7 +6816,7 @@ bgp_config_write_peer_global (struct vty *vty, struct bgp *bgp, (peer_group_active (peer) && peer->connect != g_peer->connect))) { - vty_out (vty, " neighbor %s timers connect %d%s", addr, + vty_out (vty, " neighbor %s timers connect %u%s", addr, peer->connect, VTY_NEWLINE); } @@ -7159,11 +7159,11 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp, " neighbor %s maximum-prefix %lu", addr, peer->pmax[afi][safi]); if (peer->pmax_threshold[afi][safi] != MAXIMUM_PREFIX_THRESHOLD_DEFAULT) - vty_out (vty, " %d", peer->pmax_threshold[afi][safi]); + vty_out (vty, " %u", peer->pmax_threshold[afi][safi]); if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)) vty_out (vty, " warning-only"); if (peer->pmax_restart[afi][safi]) - vty_out (vty, " restart %d", peer->pmax_restart[afi][safi]); + vty_out (vty, " restart %u", peer->pmax_restart[afi][safi]); vty_out (vty, "%s", VTY_NEWLINE); } @@ -7226,7 +7226,7 @@ bgp_config_write_peer_af (struct vty *vty, struct bgp *bgp, if (peer->weight[afi][safi]) { afi_header_vty_out (vty, afi, safi, write, - " neighbor %s weight %d%s", + " neighbor %s weight %lu%s", addr, peer->weight[afi][safi], VTY_NEWLINE); } } @@ -7371,7 +7371,7 @@ bgp_config_write (struct vty *vty) } if (bm->rmap_update_timer != RMAP_DEFAULT_UPDATE_TIMER) - vty_out (vty, "bgp route-map delay-timer %d%s", bm->rmap_update_timer, + vty_out (vty, "bgp route-map delay-timer %u%s", bm->rmap_update_timer, VTY_NEWLINE); /* BGP configuration. */ @@ -7422,7 +7422,7 @@ bgp_config_write (struct vty *vty) /* BGP default local-preference. */ if (bgp->default_local_pref != BGP_DEFAULT_LOCAL_PREF) - vty_out (vty, " bgp default local-preference %d%s", + vty_out (vty, " bgp default local-preference %u%s", bgp->default_local_pref, VTY_NEWLINE); /* BGP default show-hostname */ @@ -7434,7 +7434,7 @@ bgp_config_write (struct vty *vty) /* BGP default subgroup-pkt-queue-max. */ if (bgp->default_subgroup_pkt_queue_max != BGP_DEFAULT_SUBGROUP_PKT_QUEUE_MAX) - vty_out (vty, " bgp default subgroup-pkt-queue-max %d%s", + vty_out (vty, " bgp default subgroup-pkt-queue-max %u%s", bgp->default_subgroup_pkt_queue_max, VTY_NEWLINE); /* BGP client-to-client reflection. */ @@ -7484,16 +7484,16 @@ bgp_config_write (struct vty *vty) if (bgp->v_maxmed_onstartup != BGP_MAXMED_ONSTARTUP_UNCONFIGURED) { - vty_out (vty, " bgp max-med on-startup %d", bgp->v_maxmed_onstartup); + vty_out (vty, " bgp max-med on-startup %u", bgp->v_maxmed_onstartup); if (bgp->maxmed_onstartup_value != BGP_MAXMED_VALUE_DEFAULT) - vty_out (vty, " %d", bgp->maxmed_onstartup_value); + vty_out (vty, " %u", bgp->maxmed_onstartup_value); vty_out (vty, "%s", VTY_NEWLINE); } if (bgp->v_maxmed_admin != BGP_MAXMED_ADMIN_UNCONFIGURED) { vty_out (vty, " bgp max-med administrative"); if (bgp->maxmed_admin_value != BGP_MAXMED_VALUE_DEFAULT) - vty_out (vty, " %d", bgp->maxmed_admin_value); + vty_out (vty, " %u", bgp->maxmed_admin_value); vty_out (vty, "%s", VTY_NEWLINE); } @@ -7505,10 +7505,10 @@ bgp_config_write (struct vty *vty) /* BGP graceful-restart. */ if (bgp->stalepath_time != BGP_DEFAULT_STALEPATH_TIME) - vty_out (vty, " bgp graceful-restart stalepath-time %d%s", + vty_out (vty, " bgp graceful-restart stalepath-time %u%s", bgp->stalepath_time, VTY_NEWLINE); if (bgp->restart_time != BGP_DEFAULT_RESTART_TIME) - vty_out (vty, " bgp graceful-restart restart-time %d%s", + vty_out (vty, " bgp graceful-restart restart-time %u%s", bgp->restart_time, VTY_NEWLINE); if (bgp_flag_check (bgp, BGP_FLAG_GRACEFUL_RESTART)) vty_out (vty, " bgp graceful-restart%s", VTY_NEWLINE); @@ -7567,7 +7567,7 @@ bgp_config_write (struct vty *vty) /* BGP timers configuration. */ if (bgp->default_keepalive != BGP_DEFAULT_KEEPALIVE && bgp->default_holdtime != BGP_DEFAULT_HOLDTIME) - vty_out (vty, " timers bgp %d %d%s", bgp->default_keepalive, + vty_out (vty, " timers bgp %u %u%s", bgp->default_keepalive, bgp->default_holdtime, VTY_NEWLINE); /* peer-group */ diff --git a/lib/mpls.h b/lib/mpls.h index 6cf0142755..c963e55087 100644 --- a/lib/mpls.h +++ b/lib/mpls.h @@ -40,6 +40,10 @@ #define MPLS_MIN_UNRESERVED_LABEL 16 #define MPLS_MAX_UNRESERVED_LABEL 1048575 +/* Default min and max SRGB label range */ +#define MPLS_DEFAULT_MIN_SRGB_LABEL 16000 +#define MPLS_DEFAULT_MAX_SRGB_LABEL 23999 + #define IS_MPLS_RESERVED_LABEL(label) \ (label >= MPLS_MIN_RESERVED_LABEL && label <= MPLS_MAX_RESERVED_LABEL) diff --git a/lib/termtable.c b/lib/termtable.c index fb16e5dba1..283fa173d8 100644 --- a/lib/termtable.c +++ b/lib/termtable.c @@ -123,15 +123,13 @@ static struct ttable_cell *ttable_insert_row_va(struct ttable *tt, int i, assert(i >= -1 && i < tt->nrows); char *res, *orig, *section; - const char *f; struct ttable_cell *row; int col = 0; int ncols = 0; /* count how many columns we have */ - f = format; - for (; f[ncols]; f[ncols] == '|' ? ncols++ : *f++) - ; + for (int i = 0; format[i]; i++) + ncols += !!(format[i] == '|'); ncols++; if (tt->ncols == 0) @@ -338,7 +336,7 @@ char *ttable_dump(struct ttable *tt, const char *newline) /* calculate number of lines en total */ nlines = tt->nrows; nlines += tt->style.border.top_on ? 1 : 0; - nlines += tt->style.border.bottom_on ? 1 : 1; // makes life easier + nlines += 1; // tt->style.border.bottom_on ? 1 : 1; makes life easier for (int i = 0; i < tt->nrows; i++) { /* if leftmost cell has top / bottom border, whole row does */ nlines += tt->table[i][0].style.border.top_on ? 1 : 0; diff --git a/tools/etc/frr/daemons b/tools/etc/frr/daemons index eb7a5c9a96..a460827924 100644 --- a/tools/etc/frr/daemons +++ b/tools/etc/frr/daemons @@ -32,3 +32,4 @@ pimd=no ldpd=no nhrpd=no eigrpd=no +babeld=no diff --git a/tools/etc/frr/daemons.conf b/tools/etc/frr/daemons.conf index 21ae29d4c0..3f734eef02 100644 --- a/tools/etc/frr/daemons.conf +++ b/tools/etc/frr/daemons.conf @@ -15,6 +15,7 @@ pimd_options=" --daemon -A 127.0.0.1" ldpd_options=" --daemon -A 127.0.0.1" nhrpd_options=" --daemon -A 127.0.0.1" eigrpd_options=" --daemon -A 127.0.0.1" +babeld_options=" --daemon -A 127.0.0.1" # The list of daemons to watch is automatically generated by the init script. watchfrr_enable=yes diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index ffdfd5d725..76c7702fa0 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2029,17 +2029,19 @@ DEFUNSH (VTYSH_INTERFACE, DEFUN (vtysh_show_thread, vtysh_show_thread_cmd, "show thread cpu [FILTER]", - SHOW_STR - "Thread information\n" - "Thread CPU usage\n" - "Display filter (rwtexb)\n") + SHOW_STR + "Thread information\n" + "Thread CPU usage\n" + "Display filter (rwtexb)\n") { - int idx_filter = 3; unsigned int i; + int idx = 0; int ret = CMD_SUCCESS; char line[100]; - sprintf(line, "show thread cpu %s\n", (argc == 4) ? argv[idx_filter]->arg : ""); + const char *filter = argv_find (argv, argc, "FILTER", &idx) ? argv[idx]->arg : ""; + + snprintf(line, sizeof(line), "do show thread cpu %s\n", filter); for (i = 0; i < array_size(vtysh_client); i++) if ( vtysh_client[i].fd >= 0 ) { diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index fb46184b62..8987d0b272 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -60,7 +60,7 @@ extern struct zebra_t zebrad; /* static function declarations */ static void -fec_evaluate (struct zebra_vrf *zvrf, int add); +fec_evaluate (struct zebra_vrf *zvrf); static u_int32_t fec_derive_label_from_index (struct zebra_vrf *vrf, zebra_fec_t *fec); static int @@ -357,7 +357,7 @@ lsp_uninstall (struct zebra_vrf *zvrf, mpls_label_t label) * their local labels and trigger client updates. */ static void -fec_evaluate (struct zebra_vrf *zvrf, int add) +fec_evaluate (struct zebra_vrf *zvrf) { struct route_node *rn; zebra_fec_t *fec; @@ -385,13 +385,8 @@ fec_evaluate (struct zebra_vrf *zvrf, int add) /* Save old label, determine new label. */ old_label = fec->label; - if (add) - { - new_label = zvrf->mpls_srgb.start_label + fec->label_index; - if (new_label >= zvrf->mpls_srgb.end_label) - new_label = MPLS_INVALID_LABEL; - } - else + new_label = zvrf->mpls_srgb.start_label + fec->label_index; + if (new_label >= zvrf->mpls_srgb.end_label) new_label = MPLS_INVALID_LABEL; /* If label has changed, update FEC and clients. */ @@ -399,8 +394,8 @@ fec_evaluate (struct zebra_vrf *zvrf, int add) continue; if (IS_ZEBRA_DEBUG_MPLS) - zlog_debug ("Update fec %s new label %u upon label block %s", - buf, new_label, add ? "ADD" : "DEL"); + zlog_debug ("Update fec %s new label %u upon label block", + buf, new_label); fec->label = new_label; fec_update_clients (fec); @@ -2937,7 +2932,7 @@ zebra_mpls_label_block_add (struct zebra_vrf *zvrf, u_int32_t start_label, zvrf->mpls_srgb.end_label = end_label; /* Evaluate registered FECs to see if any get a label or not. */ - fec_evaluate (zvrf, 1); + fec_evaluate (zvrf); return 0; } @@ -2947,11 +2942,11 @@ zebra_mpls_label_block_add (struct zebra_vrf *zvrf, u_int32_t start_label, int zebra_mpls_label_block_del (struct zebra_vrf *zvrf) { - zvrf->mpls_srgb.start_label = 0; - zvrf->mpls_srgb.end_label = 0; + zvrf->mpls_srgb.start_label = MPLS_DEFAULT_MIN_SRGB_LABEL; + zvrf->mpls_srgb.end_label = MPLS_DEFAULT_MAX_SRGB_LABEL; /* Process registered FECs to clear their local label, if needed. */ - fec_evaluate (zvrf, 0); + fec_evaluate (zvrf); return 0; } @@ -2964,9 +2959,13 @@ zebra_mpls_write_label_block_config (struct vty *vty, struct zebra_vrf *zvrf) if (zvrf->mpls_srgb.start_label == 0) return 0; - vty_out(vty, "mpls label global-block %u %u%s", - zvrf->mpls_srgb.start_label, zvrf->mpls_srgb.end_label, - VTY_NEWLINE); + if ((zvrf->mpls_srgb.start_label != MPLS_DEFAULT_MIN_SRGB_LABEL) || + (zvrf->mpls_srgb.end_label != MPLS_DEFAULT_MAX_SRGB_LABEL)) + { + vty_out(vty, "mpls label global-block %u %u%s", + zvrf->mpls_srgb.start_label, zvrf->mpls_srgb.end_label, + VTY_NEWLINE); + } return 1; } @@ -3000,8 +2999,8 @@ zebra_mpls_init_tables (struct zebra_vrf *zvrf) zvrf->fec_table[AFI_IP] = route_table_init(); zvrf->fec_table[AFI_IP6] = route_table_init(); zvrf->mpls_flags = 0; - zvrf->mpls_srgb.start_label = 0; - zvrf->mpls_srgb.end_label = 0; + zvrf->mpls_srgb.start_label = MPLS_DEFAULT_MIN_SRGB_LABEL; + zvrf->mpls_srgb.end_label = MPLS_DEFAULT_MAX_SRGB_LABEL; } /* |
