]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: don't allow to set network type on loopback interfaces
authorChristian Franke <chris@opensourcerouting.org>
Thu, 11 Jul 2013 07:56:29 +0000 (07:56 +0000)
committerDavid Lamparter <equinox@opensourcerouting.org>
Wed, 14 May 2014 14:46:22 +0000 (16:46 +0200)
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@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospfd/ospf_vty.c

index 1489b20a4cfce0e9b71fe1eaa2cea3610a1dd1de..ee8c90190022c5ef56fef6ba6939ff4925fc623c 100644 (file)
@@ -5309,7 +5309,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)