]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: fix redistribution of new protocols
authorDavid Lamparter <equinox@diac24.net>
Wed, 26 Aug 2009 22:27:40 +0000 (00:27 +0200)
committerDenis Ovsienko <infrastation@yandex.ru>
Tue, 13 Dec 2011 15:12:55 +0000 (19:12 +0400)
redistribute is currently limited to "known" protocols. there is no
reason for this limitation, so, remove it.

zebra/redistribute.c

index a8107aeb856781cdce948b69213bad72921bb807..4276f1d04ffaff6282509f073ce6dad0db24ca92 100644 (file)
@@ -245,26 +245,15 @@ zebra_redistribute_add (int command, struct zserv *client, int length)
 
   type = stream_getc (client->ibuf);
 
-  switch (type)
+  if (type == 0 || type >= ZEBRA_ROUTE_MAX)
+    return;
+
+  if (! client->redist[type])
     {
-    case ZEBRA_ROUTE_KERNEL:
-    case ZEBRA_ROUTE_CONNECT:
-    case ZEBRA_ROUTE_STATIC:
-    case ZEBRA_ROUTE_RIP:
-    case ZEBRA_ROUTE_RIPNG:
-    case ZEBRA_ROUTE_OSPF:
-    case ZEBRA_ROUTE_OSPF6:
-    case ZEBRA_ROUTE_BGP:
-      if (! client->redist[type])
-       {
-         client->redist[type] = 1;
-         zebra_redistribute (client, type);
-       }
-      break;
-    default:
-      break;
+      client->redist[type] = 1;
+      zebra_redistribute (client, type);
     }
-}     
+}
 
 void
 zebra_redistribute_delete (int command, struct zserv *client, int length)
@@ -273,22 +262,11 @@ zebra_redistribute_delete (int command, struct zserv *client, int length)
 
   type = stream_getc (client->ibuf);
 
-  switch (type)
-    {
-    case ZEBRA_ROUTE_KERNEL:
-    case ZEBRA_ROUTE_CONNECT:
-    case ZEBRA_ROUTE_STATIC:
-    case ZEBRA_ROUTE_RIP:
-    case ZEBRA_ROUTE_RIPNG:
-    case ZEBRA_ROUTE_OSPF:
-    case ZEBRA_ROUTE_OSPF6:
-    case ZEBRA_ROUTE_BGP:
-      client->redist[type] = 0;
-      break;
-    default:
-      break;
-    }
-}     
+  if (type == 0 || type >= ZEBRA_ROUTE_MAX)
+    return;
+
+  client->redist[type] = 0;
+}
 
 void
 zebra_redistribute_default_add (int command, struct zserv *client, int length)