Skip to content

Commit

Permalink
eigrp: fix - Configuration failed error type: validation
Browse files Browse the repository at this point in the history
Instatiate interface structure once demon is started.
Otherwise it is not possible to set parameters such as bandwidth
untill a `network` configuration was applied.

Fixes: FRRouting#11301
Signed-off-by: Volodymyr Huti <[email protected]>
  • Loading branch information
Volodymyr Huti committed Mar 20, 2024
1 parent cb570d8 commit 8968b3f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
23 changes: 7 additions & 16 deletions eigrpd/eigrp_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,18 @@

DEFINE_MTYPE_STATIC(EIGRPD, EIGRP_IF, "EIGRP interface");

struct eigrp_interface *eigrp_if_new(struct eigrp *eigrp, struct interface *ifp,
struct prefix *p)
int eigrp_if_new_hook(struct interface *ifp)
{
struct eigrp_interface *ei = ifp->info;
int i;

if (ei)
return ei;

ei = XCALLOC(MTYPE_EIGRP_IF, sizeof(struct eigrp_interface));
ifp->info = ei;

/* Set zebra interface pointer. */
ei->ifp = ifp;
prefix_copy(&ei->address, p);

ifp->info = ei;
listnode_add(eigrp->eiflist, ei);

ei->type = EIGRP_IFTYPE_BROADCAST;
ei->initialized = false;

/* Initialize neighbor list. */
ei->nbrs = list_new();
Expand All @@ -77,8 +70,6 @@ struct eigrp_interface *eigrp_if_new(struct eigrp *eigrp, struct interface *ifp,
ei->routemap[i] = NULL;
}

ei->eigrp = eigrp;

ei->params.v_hello = EIGRP_HELLO_INTERVAL_DEFAULT;
ei->params.v_wait = EIGRP_HOLD_INTERVAL_DEFAULT;
ei->params.bandwidth = EIGRP_BANDWIDTH_DEFAULT;
Expand All @@ -91,7 +82,7 @@ struct eigrp_interface *eigrp_if_new(struct eigrp *eigrp, struct interface *ifp,
ei->curr_bandwidth = ifp->bandwidth;
ei->curr_mtu = ifp->mtu;

return ei;
return 0;
}

int eigrp_if_delete_hook(struct interface *ifp)
Expand Down Expand Up @@ -136,7 +127,7 @@ static int eigrp_ifp_up(struct interface *ifp)
zlog_debug("Zebra: Interface[%s] state change to up.",
ifp->name);

if (!ei)
if (!ei || !ei->eigrp)
return 0;

if (ei->curr_bandwidth != ifp->bandwidth) {
Expand Down Expand Up @@ -207,7 +198,7 @@ void eigrp_if_init(void)
hook_register_prio(if_down, 0, eigrp_ifp_down);
hook_register_prio(if_unreal, 0, eigrp_ifp_destroy);
/* Initialize Zebra interface data structure. */
// hook_register_prio(if_add, 0, eigrp_if_new);
hook_register_prio(if_add, 0, eigrp_if_new_hook);
hook_register_prio(if_del, 0, eigrp_if_delete_hook);
}

Expand Down Expand Up @@ -446,7 +437,7 @@ void eigrp_if_reset(struct interface *ifp)
{
struct eigrp_interface *ei = ifp->info;

if (!ei)
if (!ei || !ei->eigrp)
return;

eigrp_if_down(ei);
Expand Down
2 changes: 0 additions & 2 deletions eigrpd/eigrp_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ extern int eigrp_if_delete_hook(struct interface *);

extern bool eigrp_if_is_passive(struct eigrp_interface *ei);
extern void eigrp_del_if_params(struct eigrp_if_params *);
extern struct eigrp_interface *eigrp_if_new(struct eigrp *, struct interface *,
struct prefix *);
extern int eigrp_if_up(struct eigrp_interface *);
extern void eigrp_if_stream_set(struct eigrp_interface *);
extern void eigrp_if_set_multicast(struct eigrp_interface *);
Expand Down
9 changes: 6 additions & 3 deletions eigrpd/eigrp_network.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,16 @@ static void eigrp_network_run_interface(struct eigrp *eigrp, struct prefix *p,
if (CHECK_FLAG(co->flags, ZEBRA_IFA_SECONDARY))
continue;

if (p->family == co->address->family && !ifp->info
&& eigrp_network_match_iface(co->address, p)) {
ei = ifp->info;
if (p->family == co->address->family && !ei->initialized &&
eigrp_network_match_iface(co->address, p)) {

ei = eigrp_if_new(eigrp, ifp, co->address);
prefix_copy(&ei->address, co->address);
listnode_add(eigrp->eiflist, ei);

/* Relate eigrp interface to eigrp instance. */
ei->eigrp = eigrp;
ei->initialized = true;

/* if router_id is not configured, dont bring up
* interfaces.
Expand Down
1 change: 1 addition & 0 deletions eigrpd/eigrp_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ struct eigrp_interface {

/*multicast group refcnts */
bool member_allrouters;
bool initialized;

/* This interface's parent eigrp instance. */
struct eigrp *eigrp;
Expand Down

0 comments on commit 8968b3f

Please sign in to comment.