[quagga-dev 5142] Re: [PATCH] RIPv2 Redistributing Static Routes

Daniel Ng daniel_ng11 at lycos.com
Wed Nov 28 00:35:14 GMT 2007


 <paul <at> clubi.ie> writes:
> Looks good, except that you're changing the ZEBRA_ROUTE_CONNECT case 
> ;). Perhaps this'd be clearer as a switch on rinfo->type?

Ah yes. You're right.

> 
> BTW, if using GNU diff, it's useful to pass the '-p' argument to it 
> so that diff puts the function name in the preamble for each chunk. 
> Helps the reader.

Great, thanks for the tip.

Here's what I think you mean. I will test it:

--- ripd.c 2007-11-22 16:19:10.000000000 +1100
+++ ripd.c 2007-11-28 10:16:38.000000000 +1100
@@ -2269,12 +2269,27 @@ rip_output_process (struct connected *if
              * (in order to handle the case when multiple subnets are
              * configured on the same interface).
              */
-     if (rinfo->type == ZEBRA_ROUTE_RIP  &&
-                 rinfo->ifindex == ifc->ifp->ifindex)
-       continue;
-     if (rinfo->type == ZEBRA_ROUTE_CONNECT &&
-                 prefix_match((struct prefix *)p, ifc->address))
-       continue;
+            switch(rinfo->type)
+            {
+              case ZEBRA_ROUTE_RIP:
+              case ZEBRA_ROUTE_STATIC:
+              {
+                if (rinfo->ifindex == ifc->ifp->ifindex)
+                  continue;
+                break;
+              }
+
+              case ZEBRA_ROUTE_CONNECT:
+              {
+                if (prefix_match((struct prefix *)p, ifc->address))
+                  continue;
+                break;
+              }
+
+              default:
+                break;
+            }
+
    }

  /* Preparation for route-map. */
@@ -2367,12 +2382,27 @@ rip_output_process (struct connected *if
              * (in order to handle the case when multiple subnets are
              * configured on the same interface).
              */
-   if (rinfo->type == ZEBRA_ROUTE_RIP  &&
-        rinfo->ifindex == ifc->ifp->ifindex)
-        rinfo->metric_out = RIP_METRIC_INFINITY;
-   if (rinfo->type == ZEBRA_ROUTE_CONNECT &&
-              prefix_match((struct prefix *)p, ifc->address))
-        rinfo->metric_out = RIP_METRIC_INFINITY;
+          switch(rinfo->type)
+          {
+            case ZEBRA_ROUTE_RIP:
+            case ZEBRA_ROUTE_STATIC:
+            {
+              if (rinfo->ifindex == ifc->ifp->ifindex)
+                rinfo->metric_out = RIP_METRIC_INFINITY;
+              break;
+            }
+
+            case ZEBRA_ROUTE_CONNECT:
+            {
+              if (prefix_match((struct prefix *)p, ifc->address))
+                rinfo->metric_out = RIP_METRIC_INFINITY;
+              break;
+            }
+
+            default:
+              break;
+          }
+
  }

  /* Prepare preamble, auth headers, if needs be */







More information about the Quagga-dev mailing list