summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_asbr.c
diff options
context:
space:
mode:
authorAvneesh Sachdev <avneesh@opensourcerouting.org>2012-04-11 23:51:08 -0700
committerAvneesh Sachdev <avneesh@opensourcerouting.org>2012-04-11 23:51:08 -0700
commit14d2bbaa3f4aa53152472694c29f336808e47313 (patch)
treee39bdddef4ea53207dd8fb61e1fd6b54d8c7721d /ospf6d/ospf6_asbr.c
parent51d4ef832c1e58150325630e25c442866e5a6cf5 (diff)
parente96b312150d8e376c1ef463793d1929eca3618d5 (diff)
Merge quagga mainline into the google ISIS code.
The steps were: $ git checkout google-is-is $ git merge quagga $ git checkout google-is-is -- isisd # Resolve conflicts in the following: lib/md5.h zebra/rt_netlink.c zebra/zebra_rib.c zebra/zserv.c Note that the content in the isisd directory is left unchanged in the merge. As a result, changes made to isisd as part of the following commits on the quagga mainline are dropped. # 8ced4e82 is the merge base, e96b3121 is the current quagga master $ git log --oneline --reverse 8ced4e82..e96b3121 -- isisd 5574999 isisd: fix crash on "no router isis" (BZ#536) 8998075 isisd: raise hello rate for DIS (BZ#539) 306ca83 isisd: include hash.h, not hash.c b82cdeb delete CVS keywords 2f65867 isisd: indent longopts array b511468 quagga: option "-z" ("--socket <path>") added 05e54ee build: delete .cvsignore files b4e45f6 fix zebra protocol after MP-BGP changes 7fd6cd8 isisd: fix circuit state machine 907fd95 isisd: send proper LSP after DIS election d034aa0 isisd: fix wrong next-hops from SPF c25eaff isisd: unexpected kernel routing table (BZ#544) e6b03b7 isisd: implement MD5 circuit authentication
Diffstat (limited to 'ospf6d/ospf6_asbr.c')
-rw-r--r--ospf6d/ospf6_asbr.c164
1 files changed, 110 insertions, 54 deletions
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 3efaab44..ae0a286d 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -447,6 +447,7 @@ ospf6_asbr_redistribute_add (int type, int ifindex, struct prefix *prefix,
memset (&troute, 0, sizeof (troute));
memset (&tinfo, 0, sizeof (tinfo));
troute.route_option = &tinfo;
+ tinfo.ifindex = ifindex;
ret = route_map_apply (ospf6->rmap[type].map, prefix,
RMAP_OSPF6, &troute);
@@ -616,27 +617,16 @@ ospf6_asbr_redistribute_remove (int type, int ifindex, struct prefix *prefix)
DEFUN (ospf6_redistribute,
ospf6_redistribute_cmd,
- "redistribute (static|kernel|connected|ripng|bgp)",
+ "redistribute " QUAGGA_REDIST_STR_OSPF6D,
"Redistribute\n"
- "Static route\n"
- "Kernel route\n"
- "Connected route\n"
- "RIPng route\n"
- "BGP route\n"
+ QUAGGA_REDIST_HELP_STR_OSPF6D
)
{
- int type = 0;
-
- if (strncmp (argv[0], "sta", 3) == 0)
- type = ZEBRA_ROUTE_STATIC;
- else if (strncmp (argv[0], "ker", 3) == 0)
- 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;
+ int type;
+
+ type = proto_redistnum(AFI_IP6, argv[0]);
+ if (type < 0 || type == ZEBRA_ROUTE_OSPF6)
+ return CMD_WARNING;
ospf6_asbr_redistribute_unset (type);
ospf6_asbr_routemap_unset (type);
@@ -646,29 +636,18 @@ DEFUN (ospf6_redistribute,
DEFUN (ospf6_redistribute_routemap,
ospf6_redistribute_routemap_cmd,
- "redistribute (static|kernel|connected|ripng|bgp) route-map WORD",
+ "redistribute " QUAGGA_REDIST_STR_OSPF6D " route-map WORD",
"Redistribute\n"
- "Static routes\n"
- "Kernel route\n"
- "Connected route\n"
- "RIPng route\n"
- "BGP route\n"
+ QUAGGA_REDIST_HELP_STR_OSPF6D
"Route map reference\n"
"Route map name\n"
)
{
- int type = 0;
-
- if (strncmp (argv[0], "sta", 3) == 0)
- type = ZEBRA_ROUTE_STATIC;
- else if (strncmp (argv[0], "ker", 3) == 0)
- 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;
+ int type;
+
+ type = proto_redistnum(AFI_IP6, argv[0]);
+ if (type < 0 || type == ZEBRA_ROUTE_OSPF6)
+ return CMD_WARNING;
ospf6_asbr_redistribute_unset (type);
ospf6_asbr_routemap_set (type, argv[1]);
@@ -678,28 +657,17 @@ DEFUN (ospf6_redistribute_routemap,
DEFUN (no_ospf6_redistribute,
no_ospf6_redistribute_cmd,
- "no redistribute (static|kernel|connected|ripng|bgp)",
+ "no redistribute " QUAGGA_REDIST_STR_OSPF6D,
NO_STR
"Redistribute\n"
- "Static route\n"
- "Kernel route\n"
- "Connected route\n"
- "RIPng route\n"
- "BGP route\n"
+ QUAGGA_REDIST_HELP_STR_OSPF6D
)
{
- int type = 0;
-
- if (strncmp (argv[0], "sta", 3) == 0)
- type = ZEBRA_ROUTE_STATIC;
- else if (strncmp (argv[0], "ker", 3) == 0)
- 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;
+ int type;
+
+ type = proto_redistnum(AFI_IP6, argv[0]);
+ if (type < 0 || type == ZEBRA_ROUTE_OSPF6)
+ return CMD_WARNING;
ospf6_asbr_redistribute_unset (type);
ospf6_asbr_routemap_unset (type);
@@ -813,6 +781,54 @@ ospf6_routemap_rule_match_address_prefixlist_cmd =
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
+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,
route_map_object_t type, void *object)
@@ -990,6 +1006,39 @@ DEFUN (ospf6_routemap_no_match_address_prefixlist,
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" */
DEFUN (ospf6_routemap_set_metric_type,
ospf6_routemap_set_metric_type_cmd,
@@ -1082,6 +1131,8 @@ ospf6_routemap_init (void)
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_interface_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_forwarding_cmd);
@@ -1090,6 +1141,11 @@ ospf6_routemap_init (void)
install_element (RMAP_NODE, &ospf6_routemap_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) */
install_element (RMAP_NODE, &ospf6_routemap_set_metric_type_cmd);
install_element (RMAP_NODE, &ospf6_routemap_no_set_metric_type_cmd);