mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 05:27:47 +00:00
Merge pull request #8539 from donaldsharp/isis_circuit_warning
Isis circuit warning
This commit is contained in:
commit
646c4a38dc
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "isis_constants.h"
|
#include "isis_constants.h"
|
||||||
#include "isis_common.h"
|
#include "isis_common.h"
|
||||||
|
#include "isis_csm.h"
|
||||||
|
|
||||||
DECLARE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp));
|
DECLARE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp));
|
||||||
|
|
||||||
@ -77,7 +78,7 @@ struct isis_circuit_arg {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct isis_circuit {
|
struct isis_circuit {
|
||||||
int state;
|
enum isis_circuit_state state;
|
||||||
uint8_t circuit_id; /* l1/l2 bcast CircuitID */
|
uint8_t circuit_id; /* l1/l2 bcast CircuitID */
|
||||||
time_t last_uptime;
|
time_t last_uptime;
|
||||||
struct isis *isis;
|
struct isis *isis;
|
||||||
|
@ -60,12 +60,14 @@ static const char *const csm_eventstr[] = {
|
|||||||
|
|
||||||
#define EVENT2STR(E) csm_eventstr[E]
|
#define EVENT2STR(E) csm_eventstr[E]
|
||||||
|
|
||||||
struct isis_circuit *
|
struct isis_circuit *isis_csm_state_change(enum isis_circuit_event event,
|
||||||
isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg)
|
struct isis_circuit *circuit,
|
||||||
|
void *arg)
|
||||||
{
|
{
|
||||||
int old_state;
|
enum isis_circuit_state old_state;
|
||||||
struct isis *isis = NULL;
|
struct isis *isis = NULL;
|
||||||
struct isis_area *area = NULL;
|
struct isis_area *area = NULL;
|
||||||
|
struct interface *ifp;
|
||||||
|
|
||||||
old_state = circuit ? circuit->state : C_STATE_NA;
|
old_state = circuit ? circuit->state : C_STATE_NA;
|
||||||
if (IS_DEBUG_EVENTS)
|
if (IS_DEBUG_EVENTS)
|
||||||
@ -85,23 +87,29 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg)
|
|||||||
circuit->state = C_STATE_CONF;
|
circuit->state = C_STATE_CONF;
|
||||||
break;
|
break;
|
||||||
case IF_UP_FROM_Z:
|
case IF_UP_FROM_Z:
|
||||||
isis = isis_lookup_by_vrfid(((struct interface *)arg)->vrf_id);
|
ifp = arg;
|
||||||
|
isis = isis_lookup_by_vrfid(ifp->vrf_id);
|
||||||
if (isis == NULL) {
|
if (isis == NULL) {
|
||||||
zlog_warn(
|
if (IS_DEBUG_EVENTS)
|
||||||
" %s : ISIS routing instance not found",
|
zlog_debug(
|
||||||
__func__);
|
" %s : ISIS routing instance not found when attempting to apply against interface %s",
|
||||||
|
__func__, ifp->name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
circuit = isis_circuit_new(isis);
|
circuit = isis_circuit_new(isis);
|
||||||
isis_circuit_if_add(circuit, (struct interface *)arg);
|
isis_circuit_if_add(circuit, ifp);
|
||||||
listnode_add(isis->init_circ_list, circuit);
|
listnode_add(isis->init_circ_list, circuit);
|
||||||
circuit->state = C_STATE_INIT;
|
circuit->state = C_STATE_INIT;
|
||||||
break;
|
break;
|
||||||
case ISIS_DISABLE:
|
case ISIS_DISABLE:
|
||||||
zlog_warn("circuit already disabled");
|
if (IS_DEBUG_EVENTS)
|
||||||
|
zlog_debug(
|
||||||
|
"circuit disable event passed for a non existent circuit");
|
||||||
break;
|
break;
|
||||||
case IF_DOWN_FROM_Z:
|
case IF_DOWN_FROM_Z:
|
||||||
zlog_warn("circuit already disconnected");
|
if (IS_DEBUG_EVENTS)
|
||||||
|
zlog_debug(
|
||||||
|
"circuit disconnect event passed for a non existent circuit");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -123,11 +131,14 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg)
|
|||||||
circuit);
|
circuit);
|
||||||
break;
|
break;
|
||||||
case IF_UP_FROM_Z:
|
case IF_UP_FROM_Z:
|
||||||
assert(circuit);
|
if (IS_DEBUG_EVENTS)
|
||||||
zlog_warn("circuit already connected");
|
zlog_debug("circuit %s already connected",
|
||||||
|
circuit->interface->name);
|
||||||
break;
|
break;
|
||||||
case ISIS_DISABLE:
|
case ISIS_DISABLE:
|
||||||
zlog_warn("circuit already disabled");
|
if (IS_DEBUG_EVENTS)
|
||||||
|
zlog_debug("circuit %s already disabled",
|
||||||
|
circuit->interface->name);
|
||||||
break;
|
break;
|
||||||
case IF_DOWN_FROM_Z:
|
case IF_DOWN_FROM_Z:
|
||||||
isis_circuit_if_del(circuit, (struct interface *)arg);
|
isis_circuit_if_del(circuit, (struct interface *)arg);
|
||||||
@ -142,7 +153,9 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg)
|
|||||||
assert(circuit);
|
assert(circuit);
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case ISIS_ENABLE:
|
case ISIS_ENABLE:
|
||||||
zlog_warn("circuit already enabled");
|
if (IS_DEBUG_EVENTS)
|
||||||
|
zlog_debug("circuit %p is already enabled",
|
||||||
|
circuit);
|
||||||
break;
|
break;
|
||||||
case IF_UP_FROM_Z:
|
case IF_UP_FROM_Z:
|
||||||
isis_circuit_if_add(circuit, (struct interface *)arg);
|
isis_circuit_if_add(circuit, (struct interface *)arg);
|
||||||
@ -165,7 +178,9 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg)
|
|||||||
circuit = NULL;
|
circuit = NULL;
|
||||||
break;
|
break;
|
||||||
case IF_DOWN_FROM_Z:
|
case IF_DOWN_FROM_Z:
|
||||||
zlog_warn("circuit already disconnected");
|
if (IS_DEBUG_EVENTS)
|
||||||
|
zlog_debug("circuit %p already disconnected",
|
||||||
|
circuit);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -173,10 +188,14 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg)
|
|||||||
assert(circuit);
|
assert(circuit);
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case ISIS_ENABLE:
|
case ISIS_ENABLE:
|
||||||
zlog_warn("circuit already configured");
|
if (IS_DEBUG_EVENTS)
|
||||||
|
zlog_debug("circuit %s already configured",
|
||||||
|
circuit->interface->name);
|
||||||
break;
|
break;
|
||||||
case IF_UP_FROM_Z:
|
case IF_UP_FROM_Z:
|
||||||
zlog_warn("circuit already connected");
|
if (IS_DEBUG_EVENTS)
|
||||||
|
zlog_debug("circuit %s already connected",
|
||||||
|
circuit->interface->name);
|
||||||
break;
|
break;
|
||||||
case ISIS_DISABLE:
|
case ISIS_DISABLE:
|
||||||
isis = circuit->isis;
|
isis = circuit->isis;
|
||||||
@ -197,9 +216,6 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
zlog_warn("Invalid circuit state %d", old_state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_DEBUG_EVENTS)
|
if (IS_DEBUG_EVENTS)
|
||||||
|
@ -27,20 +27,25 @@
|
|||||||
/*
|
/*
|
||||||
* Circuit states
|
* Circuit states
|
||||||
*/
|
*/
|
||||||
#define C_STATE_NA 0
|
enum isis_circuit_state {
|
||||||
#define C_STATE_INIT 1 /* Connected to interface */
|
C_STATE_NA,
|
||||||
#define C_STATE_CONF 2 /* Configured for ISIS */
|
C_STATE_INIT, /* Connected to interface */
|
||||||
#define C_STATE_UP 3 /* CONN | CONF */
|
C_STATE_CONF, /* Configured for ISIS */
|
||||||
|
C_STATE_UP, /* CONN | CONF */
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Circuit events
|
* Circuit events
|
||||||
*/
|
*/
|
||||||
#define ISIS_ENABLE 1
|
enum isis_circuit_event {
|
||||||
#define IF_UP_FROM_Z 2
|
ISIS_ENABLE = 1,
|
||||||
#define ISIS_DISABLE 3
|
IF_UP_FROM_Z,
|
||||||
#define IF_DOWN_FROM_Z 4
|
ISIS_DISABLE,
|
||||||
|
IF_DOWN_FROM_Z,
|
||||||
|
};
|
||||||
|
|
||||||
struct isis_circuit *
|
struct isis_circuit *isis_csm_state_change(enum isis_circuit_event event,
|
||||||
isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg);
|
struct isis_circuit *circuit,
|
||||||
|
void *arg);
|
||||||
|
|
||||||
#endif /* _ZEBRA_ISIS_CSM_H */
|
#endif /* _ZEBRA_ISIS_CSM_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user