summaryrefslogtreecommitdiff
path: root/ospf6d
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2009-09-16 01:52:42 +0200
committerDenis Ovsienko <infrastation@yandex.ru>2011-11-21 18:24:50 +0400
commitdaca2cf463496e5844812ea13a4fafefafe4853f (patch)
treefa15ebaba782e946197a18d4739b2539f4c9a1a9 /ospf6d
parent6864a990771c66384a66cd6e7db443529460b0a6 (diff)
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
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_asbr.c75
1 files changed, 21 insertions, 54 deletions
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 685b147c..d6c1517e 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -616,27 +616,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 +635,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 +656,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);