version 1.1.1.1, 2012/02/21 17:26:12
|
version 1.1.1.2, 2012/10/09 09:22:28
|
Line 447 ospf6_asbr_redistribute_add (int type, int ifindex, st
|
Line 447 ospf6_asbr_redistribute_add (int type, int ifindex, st
|
memset (&troute, 0, sizeof (troute)); |
memset (&troute, 0, sizeof (troute)); |
memset (&tinfo, 0, sizeof (tinfo)); |
memset (&tinfo, 0, sizeof (tinfo)); |
troute.route_option = &tinfo; |
troute.route_option = &tinfo; |
|
tinfo.ifindex = ifindex; |
|
|
ret = route_map_apply (ospf6->rmap[type].map, prefix, |
ret = route_map_apply (ospf6->rmap[type].map, prefix, |
RMAP_OSPF6, &troute); |
RMAP_OSPF6, &troute); |
Line 616 ospf6_asbr_redistribute_remove (int type, int ifindex,
|
Line 617 ospf6_asbr_redistribute_remove (int type, int ifindex,
|
|
|
DEFUN (ospf6_redistribute, |
DEFUN (ospf6_redistribute, |
ospf6_redistribute_cmd, |
ospf6_redistribute_cmd, |
"redistribute (static|kernel|connected|ripng|bgp)", | "redistribute " QUAGGA_REDIST_STR_OSPF6D, |
"Redistribute\n" |
"Redistribute\n" |
"Static route\n" | QUAGGA_REDIST_HELP_STR_OSPF6D |
"Kernel route\n" | |
"Connected route\n" | |
"RIPng route\n" | |
"BGP route\n" | |
) |
) |
{ |
{ |
int type = 0; | int type; |
|
|
if (strncmp (argv[0], "sta", 3) == 0) | type = proto_redistnum(AFI_IP6, argv[0]); |
type = ZEBRA_ROUTE_STATIC; | if (type < 0 || type == ZEBRA_ROUTE_OSPF6) |
else if (strncmp (argv[0], "ker", 3) == 0) | return CMD_WARNING; |
type = ZEBRA_ROUTE_KERNEL; | |
else if (strncmp (argv[0], "con", 3) == 0) | |
type = ZEBRA_ROUTE_CONNECT; | |
else if (strncmp (argv[0], "rip", 3) == 0) | |
type = ZEBRA_ROUTE_RIPNG; | |
else if (strncmp (argv[0], "bgp", 3) == 0) | |
type = ZEBRA_ROUTE_BGP; | |
|
|
ospf6_asbr_redistribute_unset (type); |
ospf6_asbr_redistribute_unset (type); |
ospf6_asbr_routemap_unset (type); |
ospf6_asbr_routemap_unset (type); |
Line 646 DEFUN (ospf6_redistribute,
|
Line 636 DEFUN (ospf6_redistribute,
|
|
|
DEFUN (ospf6_redistribute_routemap, |
DEFUN (ospf6_redistribute_routemap, |
ospf6_redistribute_routemap_cmd, |
ospf6_redistribute_routemap_cmd, |
"redistribute (static|kernel|connected|ripng|bgp) route-map WORD", | "redistribute " QUAGGA_REDIST_STR_OSPF6D " route-map WORD", |
"Redistribute\n" |
"Redistribute\n" |
"Static routes\n" | QUAGGA_REDIST_HELP_STR_OSPF6D |
"Kernel route\n" | |
"Connected route\n" | |
"RIPng route\n" | |
"BGP route\n" | |
"Route map reference\n" |
"Route map reference\n" |
"Route map name\n" |
"Route map name\n" |
) |
) |
{ |
{ |
int type = 0; | int type; |
|
|
if (strncmp (argv[0], "sta", 3) == 0) | type = proto_redistnum(AFI_IP6, argv[0]); |
type = ZEBRA_ROUTE_STATIC; | if (type < 0 || type == ZEBRA_ROUTE_OSPF6) |
else if (strncmp (argv[0], "ker", 3) == 0) | return CMD_WARNING; |
type = ZEBRA_ROUTE_KERNEL; | |
else if (strncmp (argv[0], "con", 3) == 0) | |
type = ZEBRA_ROUTE_CONNECT; | |
else if (strncmp (argv[0], "rip", 3) == 0) | |
type = ZEBRA_ROUTE_RIPNG; | |
else if (strncmp (argv[0], "bgp", 3) == 0) | |
type = ZEBRA_ROUTE_BGP; | |
|
|
ospf6_asbr_redistribute_unset (type); |
ospf6_asbr_redistribute_unset (type); |
ospf6_asbr_routemap_set (type, argv[1]); |
ospf6_asbr_routemap_set (type, argv[1]); |
Line 678 DEFUN (ospf6_redistribute_routemap,
|
Line 657 DEFUN (ospf6_redistribute_routemap,
|
|
|
DEFUN (no_ospf6_redistribute, |
DEFUN (no_ospf6_redistribute, |
no_ospf6_redistribute_cmd, |
no_ospf6_redistribute_cmd, |
"no redistribute (static|kernel|connected|ripng|bgp)", | "no redistribute " QUAGGA_REDIST_STR_OSPF6D, |
NO_STR |
NO_STR |
"Redistribute\n" |
"Redistribute\n" |
"Static route\n" | QUAGGA_REDIST_HELP_STR_OSPF6D |
"Kernel route\n" | |
"Connected route\n" | |
"RIPng route\n" | |
"BGP route\n" | |
) |
) |
{ |
{ |
int type = 0; | int type; |
|
|
if (strncmp (argv[0], "sta", 3) == 0) | type = proto_redistnum(AFI_IP6, argv[0]); |
type = ZEBRA_ROUTE_STATIC; | if (type < 0 || type == ZEBRA_ROUTE_OSPF6) |
else if (strncmp (argv[0], "ker", 3) == 0) | return CMD_WARNING; |
type = ZEBRA_ROUTE_KERNEL; | |
else if (strncmp (argv[0], "con", 3) == 0) | |
type = ZEBRA_ROUTE_CONNECT; | |
else if (strncmp (argv[0], "rip", 3) == 0) | |
type = ZEBRA_ROUTE_RIPNG; | |
else if (strncmp (argv[0], "bgp", 3) == 0) | |
type = ZEBRA_ROUTE_BGP; | |
|
|
ospf6_asbr_redistribute_unset (type); |
ospf6_asbr_redistribute_unset (type); |
ospf6_asbr_routemap_unset (type); |
ospf6_asbr_routemap_unset (type); |
Line 813 ospf6_routemap_rule_match_address_prefixlist_cmd =
|
Line 781 ospf6_routemap_rule_match_address_prefixlist_cmd =
|
ospf6_routemap_rule_match_address_prefixlist_free, |
ospf6_routemap_rule_match_address_prefixlist_free, |
}; |
}; |
|
|
|
/* `match interface IFNAME' */ |
|
/* Match function should return 1 if match is success else return |
|
zero. */ |
static route_map_result_t |
static route_map_result_t |
|
ospf6_routemap_rule_match_interface (void *rule, struct prefix *prefix, |
|
route_map_object_t type, void *object) |
|
{ |
|
struct interface *ifp; |
|
struct ospf6_external_info *ei; |
|
|
|
if (type == RMAP_OSPF6) |
|
{ |
|
ei = ((struct ospf6_route *) object)->route_option; |
|
ifp = if_lookup_by_name ((char *)rule); |
|
|
|
if (ifp != NULL |
|
&& ei->ifindex == ifp->ifindex) |
|
return RMAP_MATCH; |
|
} |
|
|
|
return RMAP_NOMATCH; |
|
} |
|
|
|
/* Route map `interface' match statement. `arg' should be |
|
interface name. */ |
|
static void * |
|
ospf6_routemap_rule_match_interface_compile (const char *arg) |
|
{ |
|
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg); |
|
} |
|
|
|
/* Free route map's compiled `interface' value. */ |
|
static void |
|
ospf6_routemap_rule_match_interface_free (void *rule) |
|
{ |
|
XFREE (MTYPE_ROUTE_MAP_COMPILED, rule); |
|
} |
|
|
|
/* Route map commands for interface matching. */ |
|
struct route_map_rule_cmd |
|
ospf6_routemap_rule_match_interface_cmd = |
|
{ |
|
"interface", |
|
ospf6_routemap_rule_match_interface, |
|
ospf6_routemap_rule_match_interface_compile, |
|
ospf6_routemap_rule_match_interface_free |
|
}; |
|
|
|
static route_map_result_t |
ospf6_routemap_rule_set_metric_type (void *rule, struct prefix *prefix, |
ospf6_routemap_rule_set_metric_type (void *rule, struct prefix *prefix, |
route_map_object_t type, void *object) |
route_map_object_t type, void *object) |
{ |
{ |
Line 990 DEFUN (ospf6_routemap_no_match_address_prefixlist,
|
Line 1006 DEFUN (ospf6_routemap_no_match_address_prefixlist,
|
return route_map_command_status (vty, ret); |
return route_map_command_status (vty, ret); |
} |
} |
|
|
|
/* "match interface" */ |
|
DEFUN (ospf6_routemap_match_interface, |
|
ospf6_routemap_match_interface_cmd, |
|
"match interface WORD", |
|
MATCH_STR |
|
"Match first hop interface of route\n" |
|
"Interface name\n") |
|
{ |
|
return route_map_add_match ((struct route_map_index *) vty->index, |
|
"interface", argv[0]); |
|
} |
|
|
|
/* "no match interface WORD" */ |
|
DEFUN (ospf6_routemap_no_match_interface, |
|
ospf6_routemap_no_match_interface_cmd, |
|
"no match interface", |
|
MATCH_STR |
|
NO_STR |
|
"Match first hop interface of route\n") |
|
{ |
|
int ret = route_map_delete_match ((struct route_map_index *) vty->index, |
|
"interface", (argc == 0) ? NULL : argv[0]); |
|
return route_map_command_status (vty, ret); |
|
} |
|
|
|
ALIAS (ospf6_routemap_no_match_interface, |
|
ospf6_routemap_no_match_interface_val_cmd, |
|
"no match interface WORD", |
|
MATCH_STR |
|
NO_STR |
|
"Match first hop interface of route\n" |
|
"Interface name\n") |
|
|
/* add "set metric-type" */ |
/* add "set metric-type" */ |
DEFUN (ospf6_routemap_set_metric_type, |
DEFUN (ospf6_routemap_set_metric_type, |
ospf6_routemap_set_metric_type_cmd, |
ospf6_routemap_set_metric_type_cmd, |
Line 1082 ospf6_routemap_init (void)
|
Line 1131 ospf6_routemap_init (void)
|
route_map_delete_hook (ospf6_asbr_routemap_update); |
route_map_delete_hook (ospf6_asbr_routemap_update); |
|
|
route_map_install_match (&ospf6_routemap_rule_match_address_prefixlist_cmd); |
route_map_install_match (&ospf6_routemap_rule_match_address_prefixlist_cmd); |
|
route_map_install_match (&ospf6_routemap_rule_match_interface_cmd); |
|
|
route_map_install_set (&ospf6_routemap_rule_set_metric_type_cmd); |
route_map_install_set (&ospf6_routemap_rule_set_metric_type_cmd); |
route_map_install_set (&ospf6_routemap_rule_set_metric_cmd); |
route_map_install_set (&ospf6_routemap_rule_set_metric_cmd); |
route_map_install_set (&ospf6_routemap_rule_set_forwarding_cmd); |
route_map_install_set (&ospf6_routemap_rule_set_forwarding_cmd); |
Line 1089 ospf6_routemap_init (void)
|
Line 1140 ospf6_routemap_init (void)
|
/* Match address prefix-list */ |
/* Match address prefix-list */ |
install_element (RMAP_NODE, &ospf6_routemap_match_address_prefixlist_cmd); |
install_element (RMAP_NODE, &ospf6_routemap_match_address_prefixlist_cmd); |
install_element (RMAP_NODE, &ospf6_routemap_no_match_address_prefixlist_cmd); |
install_element (RMAP_NODE, &ospf6_routemap_no_match_address_prefixlist_cmd); |
|
|
|
/* Match interface */ |
|
install_element (RMAP_NODE, &ospf6_routemap_match_interface_cmd); |
|
install_element (RMAP_NODE, &ospf6_routemap_no_match_interface_cmd); |
|
install_element (RMAP_NODE, &ospf6_routemap_no_match_interface_val_cmd); |
|
|
/* ASE Metric Type (e.g. Type-1/Type-2) */ |
/* ASE Metric Type (e.g. Type-1/Type-2) */ |
install_element (RMAP_NODE, &ospf6_routemap_set_metric_type_cmd); |
install_element (RMAP_NODE, &ospf6_routemap_set_metric_type_cmd); |