diff options
author | Joakim Tjernlund <Joakim.Tjernlund@transmode.se> | 2008-09-02 19:06:31 +0100 |
---|---|---|
committer | Paul Jakma <paul@quagga.net> | 2008-09-02 21:38:00 +0100 |
commit | a49eb30a178547189147c8a35bf9e35f429abb66 (patch) | |
tree | 5d660dead08f4a98498240fefb86202000210932 /ospfd/ospf_zebra.c | |
parent | 5d7bdd0ed9595f515bdfaa8af76fcfd41be7a6a6 (diff) |
[ospfd] Restructure opsf_if_update() and ospf_network_run()
Add an struct interface paramenter and adjust the affected
code accordingly.
The old code was a mess looping over all interfaces several times
when one interface was added/changed.
* ospfd/ospfd.h: Add struct interface parameter to ospf_if_update()
* ospfd/ospf_zebra.c: Add ifp arg to ospf_if_update() calls.
(ospf_interface_address_delete) delete ospf_if_update() call,
redundant as function calls ospf_if_free() itself.
* ospfd/ospfd.c: (ospf_network_unset) handle deconfiguration here,
rather than ospf_if_update.
(ospf_network_run_interface) ospf_network_run, for
any given interface.
(ospf_network_run) move guts to previous, and use it.
(ospf_if_update) Adjust to take struct interface as argument, as
all callers have a specific ifp in mind.
Iterate over ifp's connected list and call ospf_network_run_interface
instead of ospf_network_run, turning this path into O(nm) rather
than O(n^2).
Adjust all code dealing with opsf_if_update and ospf_network_run to
pass the new struct interface * arg.
(some minor modifications and bug-additions by Paul Jakma).
Signed-off-by: Paul Jakma <paul@quagga.net>
Diffstat (limited to 'ospfd/ospf_zebra.c')
-rw-r--r-- | ospfd/ospf_zebra.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index f302d28d..e27f1394 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -87,7 +87,6 @@ static int ospf_interface_add (int command, struct zclient *zclient, zebra_size_t length) { struct interface *ifp; - struct ospf *ospf; ifp = zebra_interface_add_read (zclient->ibuf); @@ -103,9 +102,7 @@ ospf_interface_add (int command, struct zclient *zclient, zebra_size_t length) IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp); } - ospf = ospf_lookup (); - if (ospf != NULL) - ospf_if_update (ospf); + ospf_if_update (NULL, ifp); #ifdef HAVE_SNMP ospf_snmp_if_update (ifp); @@ -255,7 +252,6 @@ static int ospf_interface_address_add (int command, struct zclient *zclient, zebra_size_t length) { - struct ospf *ospf; struct connected *c; c = zebra_interface_address_read (command, zclient->ibuf); @@ -270,9 +266,7 @@ ospf_interface_address_add (int command, struct zclient *zclient, zlog_debug("Zebra: interface %s address add %s", c->ifp->name, buf); } - ospf = ospf_lookup (); - if (ospf != NULL) - ospf_if_update (ospf); + ospf_if_update (NULL, c->ifp); #ifdef HAVE_SNMP ospf_snmp_if_update (c->ifp); @@ -285,7 +279,6 @@ static int ospf_interface_address_delete (int command, struct zclient *zclient, zebra_size_t length) { - struct ospf *ospf; struct connected *c; struct interface *ifp; struct ospf_interface *oi; @@ -327,10 +320,6 @@ ospf_interface_address_delete (int command, struct zclient *zclient, connected_free (c); - ospf = ospf_lookup (); - if (ospf != NULL) - ospf_if_update (ospf); - return 0; } |