lib: put route_types.txt to real use

this replaces most occurences of routing protocol lists by preprocessor
defines from route_types.h. the latter is autogenerated from
route_types.txt by a perl script (previously awk). adding a routing
protocol now is mostly a matter of changing route_types.txt and log.c.

Conflicts:

	lib/route_types.awk
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 922e1c0..ae0a286 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -617,27 +617,16 @@
 
 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;
+  int type;
 
-  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;
+  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);
@@ -647,29 +636,18 @@
 
 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;
+  int type;
 
-  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;
+  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]);
@@ -679,28 +657,17 @@
 
 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;
+  int type;
 
-  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;
+  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);