[quagga-dev 4390] Re: ospf default-information strangeness

Andrew J. Schorr aschorr at telemetry-investments.com
Sat Sep 23 17:14:27 BST 2006


On Sat, Sep 23, 2006 at 12:08:58PM -0400, Andrew J. Schorr wrote:
> But even worse, now that I look further, there seems to be a bug in
> this function.  The 2nd arg 'originate' seems to be ignored if
> ospf_is_type_redistributed(DEFAULT_ROUTE) is already true.  Doesn't
> that suggest that changes in that value (DEFAULT_ORIGINATE_ALWAYS
> vs. DEFAULT_ORIGINATE_ZEBRA) may be ignored?
> 
> And I just confirmed it.  If you set 'default-information originate metric
> 10 metric-type 1', and then enter the same command again with 'always',
> you will not see 'always' in the 'show running-config' output.
> 
> And it's not clear to me whether the fix is simply to set default_originate
> to the new value.  Is there anything else that may need to be done
> in conjunction with this change?  Is calling ospf_external_lsa_refresh_default
> sufficient to implement the changed policy?

So the question is whether the attached patch is sufficient, or if it's
actually more complicated than that...

Regards,
Andy
-------------- next part --------------
Index: ospfd/ospf_zebra.c
===================================================================
RCS file: /var/cvsroot/quagga/ospfd/ospf_zebra.c,v
retrieving revision 1.40
diff -b -u -p -r1.40 ospf_zebra.c
--- ospfd/ospf_zebra.c	12 May 2006 23:02:46 -0000	1.40
+++ ospfd/ospf_zebra.c	23 Sep 2006 16:13:11 -0000
@@ -576,21 +576,15 @@ int
 ospf_redistribute_default_set (struct ospf *ospf, int originate,
                                int mtype, int mvalue)
 {
-  int force = 0;
-
-  if (ospf_is_type_redistributed (DEFAULT_ROUTE))
-    {
-      if (mtype != ospf->dmetric[DEFAULT_ROUTE].type)
-        {
+  ospf->default_originate = originate;
           ospf->dmetric[DEFAULT_ROUTE].type = mtype;
-          force = 1;
-        }
-      if (mvalue != ospf->dmetric[DEFAULT_ROUTE].value)
-        {
-          force = 1;
           ospf->dmetric[DEFAULT_ROUTE].value = mvalue;
-        }
 
+  if (ospf_is_type_redistributed (DEFAULT_ROUTE))
+    {
+      /* if ospf->default_originate changes value, is calling
+	 ospf_external_lsa_refresh_default sufficient to implement
+	 the change? */
       ospf_external_lsa_refresh_default (ospf);
 
       if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))
@@ -601,10 +595,6 @@ ospf_redistribute_default_set (struct os
       return CMD_SUCCESS;
     }
 
-  ospf->default_originate = originate;
-  ospf->dmetric[DEFAULT_ROUTE].type = mtype;
-  ospf->dmetric[DEFAULT_ROUTE].value = mvalue;
-
   zclient_redistribute_default (ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient);
 
   if (IS_DEBUG_OSPF (zebra, ZEBRA_REDISTRIBUTE))


More information about the Quagga-dev mailing list