summaryrefslogtreecommitdiffstats
path: root/eigrpd/eigrp_network.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-09-22 18:43:32 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-09-22 18:43:32 +0200
commit952248db6080fb3bff9ef1ee2f84af84e7c078b5 (patch)
tree78aa5fbc156434b5015bfe458cb0e6019206c4f5 /eigrpd/eigrp_network.c
parentMerge pull request #3056 from pacovn/Coverity_1473285_Explicit_null_dereferenced (diff)
downloadfrr-952248db6080fb3bff9ef1ee2f84af84e7c078b5.tar.xz
frr-952248db6080fb3bff9ef1ee2f84af84e7c078b5.zip
eigrpd: Fix eigrp crash on shut of a interface
The eigrp interface structure was storing a pointer to the connected interface structure and on shutdown of an interface this would cause zebra to call eigrp back with a shutdown of that interface, as part of that operation the connected interface structure is being deleted, but eigrp was keeping a pointer to the connected structure. At the same time we were keeping the address of the connected structure and this is all we need, so keep a copy of that data and use that instead. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'eigrpd/eigrp_network.c')
-rw-r--r--eigrpd/eigrp_network.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/eigrpd/eigrp_network.c b/eigrpd/eigrp_network.c
index 8eaf1e82a..35b45288b 100644
--- a/eigrpd/eigrp_network.c
+++ b/eigrpd/eigrp_network.c
@@ -48,8 +48,8 @@
#include "eigrpd/eigrp_vty.h"
#include "eigrpd/eigrp_network.h"
-static int eigrp_network_match_iface(const struct connected *,
- const struct prefix *);
+static int eigrp_network_match_iface(const struct prefix *connected_prefix,
+ const struct prefix *prefix);
static void eigrp_network_run_interface(struct eigrp *, struct prefix *,
struct interface *);
@@ -241,11 +241,11 @@ int eigrp_network_set(struct eigrp *eigrp, struct prefix *p)
/* Check whether interface matches given network
* returns: 1, true. 0, false
*/
-static int eigrp_network_match_iface(const struct connected *co,
+static int eigrp_network_match_iface(const struct prefix *co_prefix,
const struct prefix *net)
{
/* new approach: more elegant and conceptually clean */
- return prefix_match_network_statement(net, CONNECTED_PREFIX(co));
+ return prefix_match_network_statement(net, co_prefix);
}
static void eigrp_network_run_interface(struct eigrp *eigrp, struct prefix *p,
@@ -263,10 +263,9 @@ static void eigrp_network_run_interface(struct eigrp *eigrp, struct prefix *p,
continue;
if (p->family == co->address->family && !ifp->info
- && eigrp_network_match_iface(co, p)) {
+ && eigrp_network_match_iface(co->address, p)) {
ei = eigrp_if_new(eigrp, ifp, co->address);
- ei->connected = co;
/* Relate eigrp interface to eigrp instance. */
ei->eigrp = eigrp;
@@ -328,21 +327,20 @@ int eigrp_network_unset(struct eigrp *eigrp, struct prefix *p)
/* Find interfaces that not configured already. */
for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode, ei)) {
- int found = 0;
- struct connected *co = ei->connected;
+ bool found = false;
for (rn = route_top(eigrp->networks); rn; rn = route_next(rn)) {
if (rn->info == NULL)
continue;
- if (eigrp_network_match_iface(co, &rn->p)) {
- found = 1;
+ if (eigrp_network_match_iface(ei->address, &rn->p)) {
+ found = true;
route_unlock_node(rn);
break;
}
}
- if (found == 0) {
+ if (!found) {
eigrp_if_free(ei, INTERFACE_DOWN_BY_VTY);
}
}