[ospfd] Fix bug in passive-interface default commands.

2006-11-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* ospf_vty.c: (ospf_passive_interface_default) Take additional
	  'newval' arg so we can update ospf->passive_interface_default inside
	  this function.  More importantly, we now call ospf_if_set_multicast
	  on all ospf_interfaces.
	  (ospf_passive_interface, no_ospf_passive_interface) Fix bug:
	  for 'default' case, argv[0] is undefined, so we must test for
	  (argc == 0) before using argv[0].  And since
	  ospf_passive_interface_default now calls ospf_if_set_multicast as
	  needed, we can just return after calling
	  ospf_passive_interface_default.
This commit is contained in:
Andrew J. Schorr 2006-11-28 16:36:39 +00:00
parent 56395af705
commit 4354088661
2 changed files with 56 additions and 43 deletions

View File

@ -1,3 +1,16 @@
2006-11-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* ospf_vty.c: (ospf_passive_interface_default) Take additional
'newval' arg so we can update ospf->passive_interface_default inside
this function. More importantly, we now call ospf_if_set_multicast
on all ospf_interfaces.
(ospf_passive_interface, no_ospf_passive_interface) Fix bug:
for 'default' case, argv[0] is undefined, so we must test for
(argc == 0) before using argv[0]. And since
ospf_passive_interface_default now calls ospf_if_set_multicast as
needed, we can just return after calling
ospf_passive_interface_default.
2006-10-24 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* ospf_zebra.c: (ospf_redistribute_default_set) Fix bug where

View File

@ -250,12 +250,14 @@ ALIAS (no_ospf_router_id,
"router-id for the OSPF process\n")
static void
ospf_passive_interface_default (struct ospf *ospf)
ospf_passive_interface_default (struct ospf *ospf, u_char newval)
{
struct listnode *ln;
struct interface *ifp;
struct ospf_interface *oi;
ospf->passive_interface_default = newval;
for (ALL_LIST_ELEMENTS_RO (om->iflist, ln, ifp))
{
if (ifp &&
@ -266,6 +268,8 @@ ospf_passive_interface_default (struct ospf *ospf)
{
if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface))
UNSET_IF_PARAM (oi->params, passive_interface);
/* update multicast memberships */
ospf_if_set_multicast(oi);
}
}
@ -314,17 +318,16 @@ DEFUN (ospf_passive_interface,
struct route_node *rn;
struct ospf *ospf = vty->index;
if (argc == 0)
{
ospf_passive_interface_default (ospf, OSPF_IF_PASSIVE);
return CMD_SUCCESS;
}
ifp = if_get_by_name (argv[0]);
params = IF_DEF_PARAMS (ifp);
if (argc == 0)
{
ospf->passive_interface_default = OSPF_IF_PASSIVE;
ospf_passive_interface_default (ospf);
}
else
{
if (argc == 2)
{
ret = inet_aton(argv[1], &addr);
@ -339,7 +342,6 @@ DEFUN (ospf_passive_interface,
ospf_if_update_params (ifp, addr);
}
ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_PASSIVE);
}
/* XXX We should call ospf_if_set_multicast on exactly those
* interfaces for which the passive property changed. It is too much
@ -392,17 +394,16 @@ DEFUN (no_ospf_passive_interface,
struct route_node *rn;
struct ospf *ospf = vty->index;
if (argc == 0)
{
ospf_passive_interface_default (ospf, OSPF_IF_ACTIVE);
return CMD_SUCCESS;
}
ifp = if_get_by_name (argv[0]);
params = IF_DEF_PARAMS (ifp);
if (argc == 0)
{
ospf->passive_interface_default = OSPF_IF_ACTIVE;
ospf_passive_interface_default (ospf);
}
else
{
if (argc == 2)
{
ret = inet_aton(argv[1], &addr);
@ -418,7 +419,6 @@ DEFUN (no_ospf_passive_interface,
return CMD_SUCCESS;
}
ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_ACTIVE);
}
/* XXX We should call ospf_if_set_multicast on exactly those
* interfaces for which the passive property changed. It is too much