diff options
Diffstat (limited to 'ospf6d/ospf6_asbr.c')
-rw-r--r-- | ospf6d/ospf6_asbr.c | 92 |
1 files changed, 68 insertions, 24 deletions
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 6eca142d..136824bc 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -154,7 +154,6 @@ ospf6_asbr_lsa_add (struct ospf6_lsa *lsa) struct prefix asbr_id; struct ospf6_route *asbr_entry, *route; char buf[64]; - int i; external = (struct ospf6_as_external_lsa *) OSPF6_LSA_HEADER_END (lsa->header); @@ -213,18 +212,17 @@ ospf6_asbr_lsa_add (struct ospf6_lsa *lsa) route->path.type = OSPF6_PATH_TYPE_EXTERNAL2; route->path.metric_type = 2; route->path.cost = asbr_entry->path.cost; - route->path.cost_e2 = OSPF6_ASBR_METRIC (external); + route->path.u.cost_e2 = OSPF6_ASBR_METRIC (external); } else { route->path.type = OSPF6_PATH_TYPE_EXTERNAL1; route->path.metric_type = 1; route->path.cost = asbr_entry->path.cost + OSPF6_ASBR_METRIC (external); - route->path.cost_e2 = 0; + route->path.u.cost_e2 = 0; } - for (i = 0; i < OSPF6_MULTI_PATH_LIMIT; i++) - ospf6_nexthop_copy (&route->nexthop[i], &asbr_entry->nexthop[i]); + ospf6_route_copy_nexthops (route, asbr_entry); if (IS_OSPF6_DEBUG_EXAMIN (AS_EXTERNAL)) { @@ -240,7 +238,7 @@ ospf6_asbr_lsa_remove (struct ospf6_lsa *lsa) { struct ospf6_as_external_lsa *external; struct prefix prefix; - struct ospf6_route *route; + struct ospf6_route *route, *nroute; char buf[64]; external = (struct ospf6_as_external_lsa *) @@ -274,8 +272,9 @@ ospf6_asbr_lsa_remove (struct ospf6_lsa *lsa) for (ospf6_route_lock (route); route && ospf6_route_is_prefix (&prefix, route); - route = ospf6_route_next (route)) + route = nroute) { + nroute = ospf6_route_next (route); if (route->type != OSPF6_DEST_TYPE_NETWORK) continue; if (route->path.origin.type != lsa->header->type) @@ -403,13 +402,29 @@ ospf6_asbr_redistribute_unset (int type) if (info->type != type) continue; - ospf6_asbr_redistribute_remove (info->type, route->nexthop[0].ifindex, - &route->prefix); + ospf6_asbr_redistribute_remove (info->type, 0, &route->prefix); } ospf6_asbr_routemap_unset (type); } +/* When an area is unstubified, flood all the external LSAs in the area */ +void +ospf6_asbr_send_externals_to_area (struct ospf6_area *oa) +{ + struct ospf6_lsa *lsa; + + for (lsa = ospf6_lsdb_head (oa->ospf6->lsdb); lsa; + lsa = ospf6_lsdb_next (lsa)) + { + if (ntohs (lsa->header->type) == OSPF6_LSTYPE_AS_EXTERNAL) + { + zlog_debug ("%s: Flooding AS-External LSA %s\n", __func__, lsa->name); + ospf6_flood_area (NULL, lsa, oa); + } + } +} + void ospf6_asbr_redistribute_add (int type, ifindex_t ifindex, struct prefix *prefix, u_int nexthop_num, struct in6_addr *nexthop) @@ -483,9 +498,11 @@ ospf6_asbr_redistribute_add (int type, ifindex_t ifindex, struct prefix *prefix, } info->type = type; - match->nexthop[0].ifindex = ifindex; + if (nexthop_num && nexthop) - memcpy (&match->nexthop[0].address, nexthop, sizeof (struct in6_addr)); + ospf6_route_add_nexthop (match, ifindex, nexthop); + else + ospf6_route_add_nexthop (match, ifindex, NULL); /* create/update binding in external_id_table */ prefix_id.family = AF_INET; @@ -528,9 +545,10 @@ ospf6_asbr_redistribute_add (int type, ifindex_t ifindex, struct prefix *prefix, } info->type = type; - route->nexthop[0].ifindex = ifindex; if (nexthop_num && nexthop) - memcpy (&route->nexthop[0].address, nexthop, sizeof (struct in6_addr)); + ospf6_route_add_nexthop (route, ifindex, nexthop); + else + ospf6_route_add_nexthop (route, ifindex, NULL); /* create/update binding in external_id_table */ prefix_id.family = AF_INET; @@ -680,6 +698,15 @@ DEFUN (no_ospf6_redistribute, return CMD_SUCCESS; } +ALIAS (no_ospf6_redistribute, + no_ospf6_redistribute_route_map_cmd, + "no redistribute " QUAGGA_REDIST_STR_OSPF6D " route-map WORD", + NO_STR + "Redistribute\n" + QUAGGA_REDIST_HELP_STR_OSPF6D + "Route map reference\n" + "Route map name\n") + int ospf6_redistribute_config_write (struct vty *vty) { @@ -968,13 +995,13 @@ route_map_command_status (struct vty *vty, int ret) switch (ret) { case RMAP_RULE_MISSING: - vty_out (vty, "Can't find rule.%s", VNL); + vty_out (vty, "OSPF6 Can't find rule.%s", VNL); break; case RMAP_COMPILE_ERROR: - vty_out (vty, "Argument is malformed.%s", VNL); + vty_out (vty, "OSPF6 Argument is malformed.%s", VNL); break; default: - vty_out (vty, "route-map add set failed.%s", VNL); + vty_out (vty, "OSPF6 route-map add set failed.%s", VNL); break; } return CMD_WARNING; @@ -1089,17 +1116,30 @@ DEFUN (set_metric, /* delete "set metric" */ DEFUN (no_set_metric, no_set_metric_cmd, - "no set metric <0-4294967295>", + "no set metric", NO_STR - "Set value\n" - "Metric\n" - "METRIC value\n") + SET_STR + "Metric value for destination routing protocol\n") { - int ret = route_map_delete_set ((struct route_map_index *) vty->index, - "metric", argv[0]); + int ret = 0; + + if (argc == 0) + ret = route_map_delete_set ((struct route_map_index *) vty->index, + "metric", NULL); + else + ret = route_map_delete_set ((struct route_map_index *) vty->index, + "metric", argv[0]); return route_map_command_status (vty, ret); } +ALIAS (no_set_metric, + no_set_metric_val_cmd, + "no set metric <0-4294967295>", + NO_STR + SET_STR + "Metric value for destination routing protocol\n" + "Metric value\n") + /* add "set forwarding-address" */ DEFUN (ospf6_routemap_set_forwarding, ospf6_routemap_set_forwarding_cmd, @@ -1158,6 +1198,7 @@ ospf6_routemap_init (void) /* ASE Metric */ install_element (RMAP_NODE, &set_metric_cmd); install_element (RMAP_NODE, &no_set_metric_cmd); + install_element (RMAP_NODE, &no_set_metric_val_cmd); /* ASE Metric */ install_element (RMAP_NODE, &ospf6_routemap_set_forwarding_cmd); @@ -1256,13 +1297,13 @@ ospf6_asbr_external_route_show (struct vty *vty, struct ospf6_route *route) inet_ntop (AF_INET6, &info->forwarding, forwarding, sizeof (forwarding)); else snprintf (forwarding, sizeof (forwarding), ":: (ifindex %d)", - route->nexthop[0].ifindex); + ospf6_route_get_first_nh_index (route)); vty_out (vty, "%c %-32s %-15s type-%d %5lu %s%s", zebra_route_char(info->type), prefix, id, route->path.metric_type, (u_long) (route->path.metric_type == 2 ? - route->path.cost_e2 : route->path.cost), + route->path.u.cost_e2 : route->path.cost), forwarding, VNL); } @@ -1277,6 +1318,8 @@ DEFUN (show_ipv6_ospf6_redistribute, { struct ospf6_route *route; + OSPF6_CMD_CHECK_RUNNING (); + ospf6_redistribute_show_config (vty); for (route = ospf6_route_head (ospf6->external_table); route; @@ -1308,6 +1351,7 @@ ospf6_asbr_init (void) install_element (OSPF6_NODE, &ospf6_redistribute_cmd); install_element (OSPF6_NODE, &ospf6_redistribute_routemap_cmd); install_element (OSPF6_NODE, &no_ospf6_redistribute_cmd); + install_element (OSPF6_NODE, &no_ospf6_redistribute_route_map_cmd); } void |