diff options
Diffstat (limited to 'bgpd/bgp_route.c')
| -rw-r--r-- | bgpd/bgp_route.c | 96 |
1 files changed, 50 insertions, 46 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 88147e2b68..f327e34f2a 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -301,16 +301,7 @@ bgp_pcount_adjust (struct bgp_node *rn, struct bgp_info *ri) static int bgp_label_index_differs (struct bgp_info *ri1, struct bgp_info *ri2) { - u_int32_t ri1_label_index = BGP_INVALID_LABEL_INDEX; - u_int32_t ri2_label_index = BGP_INVALID_LABEL_INDEX; - - if (ri1->attr->flag & ATTR_FLAG_BIT (BGP_ATTR_LABEL_INDEX)) - ri1_label_index = ri1->attr->extra->label_index; - - if (ri2->attr->flag & ATTR_FLAG_BIT (BGP_ATTR_LABEL_INDEX)) - ri2_label_index = ri2->attr->extra->label_index; - - return (!(ri1_label_index == ri2_label_index)); + return (!(ri1->attr->extra->label_index == ri2->attr->extra->label_index)); } /* Set/unset bgp_info flags, adjusting any other state as needed. @@ -1960,7 +1951,8 @@ bgp_process_main (struct work_queue *wq, void *data) new_select->sub_type != old_select->sub_type) { if (new_select->sub_type == BGP_ROUTE_STATIC && - new_select->attr->flag & ATTR_FLAG_BIT (BGP_ATTR_LABEL_INDEX)) + new_select->attr->flag & ATTR_FLAG_BIT (BGP_ATTR_PREFIX_SID) && + new_select->attr->extra->label_index != BGP_INVALID_LABEL_INDEX) { if (CHECK_FLAG (rn->flags, BGP_NODE_REGISTERED_FOR_LABEL)) bgp_unregister_for_label (rn); @@ -3824,7 +3816,7 @@ bgp_static_update (struct bgp *bgp, struct prefix *p, if (bgp_static->label_index != BGP_INVALID_LABEL_INDEX) { (bgp_attr_extra_get (&attr))->label_index = bgp_static->label_index; - attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_LABEL_INDEX); + attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_PREFIX_SID); } /* Apply route-map. */ @@ -5765,11 +5757,11 @@ bgp_aggregate_unset (struct vty *vty, const char *prefix_str, } aggregate = rn->info; - if (aggregate->safi & SAFI_UNICAST) + if (aggregate->safi == SAFI_UNICAST) bgp_aggregate_delete (bgp, &p, afi, SAFI_UNICAST, aggregate); - if (aggregate->safi & SAFI_LABELED_UNICAST) + if (aggregate->safi == SAFI_LABELED_UNICAST) bgp_aggregate_delete (bgp, &p, afi, SAFI_LABELED_UNICAST, aggregate); - if (aggregate->safi & SAFI_MULTICAST) + if (aggregate->safi == SAFI_MULTICAST) bgp_aggregate_delete (bgp, &p, afi, SAFI_MULTICAST, aggregate); /* Unlock aggregate address configuration. */ @@ -5825,11 +5817,11 @@ bgp_aggregate_set (struct vty *vty, const char *prefix_str, rn->info = aggregate; /* Aggregate address insert into BGP routing table. */ - if (safi & SAFI_UNICAST) + if (safi == SAFI_UNICAST) bgp_aggregate_add (bgp, &p, afi, SAFI_UNICAST, aggregate); - if (safi & SAFI_LABELED_UNICAST) + if (safi == SAFI_LABELED_UNICAST) bgp_aggregate_add (bgp, &p, afi, SAFI_LABELED_UNICAST, aggregate); - if (safi & SAFI_MULTICAST) + if (safi == SAFI_MULTICAST) bgp_aggregate_add (bgp, &p, afi, SAFI_MULTICAST, aggregate); return CMD_SUCCESS; @@ -5868,9 +5860,8 @@ DEFUN (aggregate_address_mask, { int idx = 0; argv_find (argv, argc, "A.B.C.D", &idx); - char *prefix = argv[idx++]->arg; - argv_find (argv, argc, "A.B.C.D", &idx); - char *mask = argv[idx]->arg; + char *prefix = argv[idx]->arg; + char *mask = argv[idx+1]->arg; int as_set = argv_find (argv, argc, "as-set", &idx) ? AGGREGATE_AS_SET : 0; idx = 0; int summary_only = argv_find (argv, argc, "summary-only", &idx) ? AGGREGATE_SUMMARY_ONLY : 0; @@ -5918,9 +5909,8 @@ DEFUN (no_aggregate_address_mask, { int idx = 0; argv_find (argv, argc, "A.B.C.D", &idx); - char *prefix = argv[idx++]->arg; - argv_find (argv, argc, "A.B.C.D", &idx); - char *mask = argv[idx]->arg; + char *prefix = argv[idx]->arg; + char *mask = argv[idx+1]->arg; char prefix_str[BUFSIZ]; int ret = netmask_str2prefix_str (prefix, mask, prefix_str); @@ -7653,26 +7643,23 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p, if (binfo->extra && binfo->extra->damp_info) bgp_damp_info_vty (vty, binfo, json_path); - /* Label information */ - if ((bgp_labeled_safi(safi) && binfo->extra) || - (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LABEL_INDEX)))) + /* Remove Label */ + if (bgp_labeled_safi(safi) && binfo->extra) { - if (bgp_labeled_safi(safi) && binfo->extra) - { - uint32_t label = label_pton(binfo->extra->tag); - if (json_paths) - json_object_int_add(json_path, "remoteLabel", label); - else - vty_out(vty, " Remote label: %d%s", label, VTY_NEWLINE); - } + uint32_t label = label_pton(binfo->extra->tag); + if (json_paths) + json_object_int_add(json_path, "remoteLabel", label); + else + vty_out(vty, " Remote label: %d%s", label, VTY_NEWLINE); + } - if (CHECK_FLAG (attr->flag, ATTR_FLAG_BIT (BGP_ATTR_LABEL_INDEX))) - { - if (json_paths) - json_object_int_add(json_path, "labelIndex", attr->extra->label_index); - else - vty_out(vty, " Label Index: %d%s", attr->extra->label_index, VTY_NEWLINE); - } + /* Label Index */ + if (attr->extra->label_index != BGP_INVALID_LABEL_INDEX) + { + if (json_paths) + json_object_int_add(json_path, "labelIndex", attr->extra->label_index); + else + vty_out(vty, " Label Index: %d%s", attr->extra->label_index, VTY_NEWLINE); } /* Line 8 display Addpath IDs */ @@ -9548,8 +9535,17 @@ DEFUN (show_ip_bgp_vpn_all_route_prefix, vty_out (vty, "Can't find default instance%s", VTY_NEWLINE); return CMD_WARNING; } - network = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL; - network = argv_find (argv, argc, "A.B.C.D/M", &idx) ? argv[idx]->arg : NULL; + + if (argv_find (argv, argc, "A.B.C.D", &idx)) + network = argv[idx]->arg; + else if (argv_find (argv, argc, "A.B.C.D/M", &idx)) + network = argv[idx]->arg; + else + { + vty_out (vty, "Unable to figure out Network%s", VTY_NEWLINE); + return CMD_WARNING; + } + return bgp_show_route (vty, bgp, network, AFI_IP, SAFI_MPLS_VPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } #endif /* KEEP_OLD_VPN_COMMANDS */ @@ -9569,8 +9565,16 @@ DEFUN (show_ip_bgp_l2vpn_evpn_all_route_prefix, { int idx = 0; char *network = NULL; - network = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL; - network = argv_find (argv, argc, "A.B.C.D/M", &idx) ? argv[idx]->arg : NULL; + + if (argv_find (argv, argc, "A.B.C.D", &idx)) + network = argv[idx]->arg; + else if (argv_find (argv, argc, "A.B.C.D/M", &idx)) + network = argv[idx]->arg; + else + { + vty_out (vty, "Unable to figure out Network%s", VTY_NEWLINE); + return CMD_WARNING; + } return bgp_show_route (vty, NULL, network, AFI_L2VPN, SAFI_EVPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); } |
