patch from Frank van Maarseveen <F.vanMaarseveen@inter.NL.net>
[zebra 14599] PATCH: permit [no]multicast command for (yet) inactive interfaces
diff --git a/zebra/interface.c b/zebra/interface.c
index 5629ebb..9846805 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -182,6 +182,14 @@
void
if_add_update (struct interface *ifp)
{
+ struct zebra_if *if_data;
+
+ if_data = ifp->info;
+ if (if_data->multicast == IF_ZEBRA_MULTICAST_ON)
+ if_set_flags (ifp, IFF_MULTICAST);
+ else if (if_data->multicast == IF_ZEBRA_MULTICAST_OFF)
+ if_unset_flags (ifp, IFF_MULTICAST);
+
zebra_interface_add_update (ifp);
if (! CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
@@ -739,16 +747,19 @@
struct zebra_if *if_data;
ifp = (struct interface *) vty->index;
- ret = if_set_flags (ifp, IFF_MULTICAST);
- if (ret < 0)
+ if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
{
- vty_out (vty, "Can't set multicast flag%s", VTY_NEWLINE);
- return CMD_WARNING;
+ ret = if_set_flags (ifp, IFF_MULTICAST);
+ if (ret < 0)
+ {
+ vty_out (vty, "Can't set multicast flag%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ if_refresh (ifp);
}
- if_refresh (ifp);
if_data = ifp->info;
if_data->multicast = IF_ZEBRA_MULTICAST_ON;
-
+
return CMD_SUCCESS;
}
@@ -763,13 +774,16 @@
struct zebra_if *if_data;
ifp = (struct interface *) vty->index;
- ret = if_unset_flags (ifp, IFF_MULTICAST);
- if (ret < 0)
+ if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
{
- vty_out (vty, "Can't unset multicast flag%s", VTY_NEWLINE);
- return CMD_WARNING;
+ ret = if_unset_flags (ifp, IFF_MULTICAST);
+ if (ret < 0)
+ {
+ vty_out (vty, "Can't unset multicast flag%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ if_refresh (ifp);
}
- if_refresh (ifp);
if_data = ifp->info;
if_data->multicast = IF_ZEBRA_MULTICAST_OFF;