[quagga-dev 10594] [PATCH] ospfd: don't allow to set network type on loopback interfaces

Christian Franke chris at opensourcerouting.org
Thu Jul 11 09:56:29 BST 2013


OSPFd only allocates some stub information for loopback interfaces.
This causes a crash when the interface state machine is started on
that interface by configuring a different network type.

It doesn't make much sense to configure the network type of a loopback
interface, therefore, just forbid it.

See also bugzilla #670.

Signed-off-by: Christian Franke <chris at opensourcerouting.org>
---
 ospfd/ospf_vty.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 2ba8188..0de3ac5 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -5307,7 +5307,13 @@ DEFUN (ip_ospf_network,
   struct interface *ifp = vty->index;
   int old_type = IF_DEF_PARAMS (ifp)->type;
   struct route_node *rn;
-  
+
+  if (old_type == OSPF_IFTYPE_LOOPBACK)
+    {
+      vty_out (vty, "This is a loopback interface. Can't set network type.%s", VTY_NEWLINE);
+      return CMD_WARNING;
+    }
+
   if (strncmp (argv[0], "b", 1) == 0)
     IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
   else if (strncmp (argv[0], "n", 1) == 0)
-- 
1.7.10.4





More information about the Quagga-dev mailing list