mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 16:04:49 +00:00
isisd: fix warnings by removing union isis_N and going to void * instead
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
This commit is contained in:
parent
4141588823
commit
f6ae63ca95
@ -179,14 +179,14 @@ const char *vid2string(struct isis_vertex *vertex, char *buff, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct isis_vertex *isis_vertex_new(struct isis_spftree *spftree,
|
static struct isis_vertex *isis_vertex_new(struct isis_spftree *spftree,
|
||||||
union isis_N *n,
|
void *id,
|
||||||
enum vertextype vtype)
|
enum vertextype vtype)
|
||||||
{
|
{
|
||||||
struct isis_vertex *vertex;
|
struct isis_vertex *vertex;
|
||||||
|
|
||||||
vertex = XCALLOC(MTYPE_ISIS_VERTEX, sizeof(struct isis_vertex));
|
vertex = XCALLOC(MTYPE_ISIS_VERTEX, sizeof(struct isis_vertex));
|
||||||
|
|
||||||
isis_vertex_id_init(vertex, n, vtype);
|
isis_vertex_id_init(vertex, id, vtype);
|
||||||
|
|
||||||
vertex->Adj_N = list_new();
|
vertex->Adj_N = list_new();
|
||||||
vertex->parents = list_new();
|
vertex->parents = list_new();
|
||||||
@ -330,17 +330,13 @@ static struct isis_vertex *isis_spf_add_root(struct isis_spftree *spftree,
|
|||||||
#ifdef EXTREME_DEBUG
|
#ifdef EXTREME_DEBUG
|
||||||
char buff[VID2STR_BUFFER];
|
char buff[VID2STR_BUFFER];
|
||||||
#endif /* EXTREME_DEBUG */
|
#endif /* EXTREME_DEBUG */
|
||||||
union isis_N n;
|
|
||||||
|
|
||||||
memcpy(n.id, sysid, ISIS_SYS_ID_LEN);
|
|
||||||
LSP_PSEUDO_ID(n.id) = 0;
|
|
||||||
|
|
||||||
lsp = isis_root_system_lsp(spftree->area, spftree->level, sysid);
|
lsp = isis_root_system_lsp(spftree->area, spftree->level, sysid);
|
||||||
if (lsp == NULL)
|
if (lsp == NULL)
|
||||||
zlog_warn("ISIS-Spf: could not find own l%d LSP!",
|
zlog_warn("ISIS-Spf: could not find own l%d LSP!",
|
||||||
spftree->level);
|
spftree->level);
|
||||||
|
|
||||||
vertex = isis_vertex_new(spftree, &n,
|
vertex = isis_vertex_new(spftree, sysid,
|
||||||
spftree->area->oldmetric
|
spftree->area->oldmetric
|
||||||
? VTYPE_NONPSEUDO_IS
|
? VTYPE_NONPSEUDO_IS
|
||||||
: VTYPE_NONPSEUDO_TE_IS);
|
: VTYPE_NONPSEUDO_TE_IS);
|
||||||
|
@ -53,13 +53,12 @@ struct prefix_pair {
|
|||||||
/*
|
/*
|
||||||
* Triple <N, d(N), {Adj(N)}>
|
* Triple <N, d(N), {Adj(N)}>
|
||||||
*/
|
*/
|
||||||
union isis_N {
|
|
||||||
uint8_t id[ISIS_SYS_ID_LEN + 1];
|
|
||||||
struct prefix_pair ip;
|
|
||||||
};
|
|
||||||
struct isis_vertex {
|
struct isis_vertex {
|
||||||
enum vertextype type;
|
enum vertextype type;
|
||||||
union isis_N N;
|
union {
|
||||||
|
uint8_t id[ISIS_SYS_ID_LEN + 1];
|
||||||
|
struct prefix_pair ip;
|
||||||
|
} N;
|
||||||
uint32_t d_N; /* d(N) Distance from this IS */
|
uint32_t d_N; /* d(N) Distance from this IS */
|
||||||
uint16_t depth; /* The depth in the imaginary tree */
|
uint16_t depth; /* The depth in the imaginary tree */
|
||||||
struct list *Adj_N; /* {Adj(N)} next hop or neighbor list */
|
struct list *Adj_N; /* {Adj(N)} next hop or neighbor list */
|
||||||
@ -309,15 +308,15 @@ struct isis_spftree {
|
|||||||
};
|
};
|
||||||
|
|
||||||
__attribute__((__unused__))
|
__attribute__((__unused__))
|
||||||
static void isis_vertex_id_init(struct isis_vertex *vertex, const union isis_N *n,
|
static void isis_vertex_id_init(struct isis_vertex *vertex, const void *id,
|
||||||
enum vertextype vtype)
|
enum vertextype vtype)
|
||||||
{
|
{
|
||||||
vertex->type = vtype;
|
vertex->type = vtype;
|
||||||
|
|
||||||
if (VTYPE_IS(vtype) || VTYPE_ES(vtype)) {
|
if (VTYPE_IS(vtype) || VTYPE_ES(vtype)) {
|
||||||
memcpy(vertex->N.id, n->id, ISIS_SYS_ID_LEN + 1);
|
memcpy(vertex->N.id, id, ISIS_SYS_ID_LEN + 1);
|
||||||
} else if (VTYPE_IP(vtype)) {
|
} else if (VTYPE_IP(vtype)) {
|
||||||
memcpy(&vertex->N.ip, &n->ip, sizeof(n->ip));
|
memcpy(&vertex->N.ip, id, sizeof(vertex->N.ip));
|
||||||
} else {
|
} else {
|
||||||
flog_err(LIB_ERR_DEVELOPMENT, "Unknown Vertex Type");
|
flog_err(LIB_ERR_DEVELOPMENT, "Unknown Vertex Type");
|
||||||
}
|
}
|
||||||
@ -325,12 +324,12 @@ static void isis_vertex_id_init(struct isis_vertex *vertex, const union isis_N *
|
|||||||
|
|
||||||
__attribute__((__unused__))
|
__attribute__((__unused__))
|
||||||
static struct isis_vertex *isis_find_vertex(struct isis_vertex_queue *queue,
|
static struct isis_vertex *isis_find_vertex(struct isis_vertex_queue *queue,
|
||||||
union isis_N *n,
|
const void *id,
|
||||||
enum vertextype vtype)
|
enum vertextype vtype)
|
||||||
{
|
{
|
||||||
struct isis_vertex querier;
|
struct isis_vertex querier;
|
||||||
|
|
||||||
isis_vertex_id_init(&querier, n, vtype);
|
isis_vertex_id_init(&querier, id, vtype);
|
||||||
return hash_lookup(queue->hash, &querier);
|
return hash_lookup(queue->hash, &querier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,44 +18,44 @@ static void setup_test_vertices(void)
|
|||||||
{
|
{
|
||||||
struct isis_spftree t = {
|
struct isis_spftree t = {
|
||||||
};
|
};
|
||||||
union isis_N nid, nip = {
|
struct prefix_pair p = {
|
||||||
.ip.dest.family = AF_UNSPEC
|
|
||||||
};
|
};
|
||||||
|
uint8_t node_id[7];
|
||||||
|
|
||||||
vertices = XMALLOC(MTYPE_TMP, sizeof(*vertices) * 16);
|
vertices = XMALLOC(MTYPE_TMP, sizeof(*vertices) * 16);
|
||||||
|
|
||||||
nip.ip.dest.family = AF_INET;
|
p.dest.family = AF_INET;
|
||||||
nip.ip.dest.prefixlen = 24;
|
p.dest.prefixlen = 24;
|
||||||
inet_pton(AF_INET, "192.168.1.0", &nip.ip.dest.u.prefix4);
|
inet_pton(AF_INET, "192.168.1.0", &p.dest.u.prefix4);
|
||||||
vertices[vertex_count] = isis_vertex_new(&t, &nip, VTYPE_IPREACH_TE);
|
vertices[vertex_count] = isis_vertex_new(&t, &p, VTYPE_IPREACH_TE);
|
||||||
vertices[vertex_count]->d_N = 20;
|
vertices[vertex_count]->d_N = 20;
|
||||||
vertex_count++;
|
vertex_count++;
|
||||||
|
|
||||||
nip.ip.dest.family = AF_INET;
|
p.dest.family = AF_INET;
|
||||||
nip.ip.dest.prefixlen = 24;
|
p.dest.prefixlen = 24;
|
||||||
inet_pton(AF_INET, "192.168.2.0", &nip.ip.dest.u.prefix4);
|
inet_pton(AF_INET, "192.168.2.0", &p.dest.u.prefix4);
|
||||||
vertices[vertex_count] = isis_vertex_new(&t, &nip, VTYPE_IPREACH_TE);
|
vertices[vertex_count] = isis_vertex_new(&t, &p, VTYPE_IPREACH_TE);
|
||||||
vertices[vertex_count]->d_N = 20;
|
vertices[vertex_count]->d_N = 20;
|
||||||
vertex_count++;
|
vertex_count++;
|
||||||
|
|
||||||
memset(nid.id, 0, sizeof(nid.id));
|
memset(node_id, 0, sizeof(node_id));
|
||||||
nid.id[6] = 1;
|
node_id[6] = 1;
|
||||||
vertices[vertex_count] = isis_vertex_new(&t, &nid,
|
vertices[vertex_count] = isis_vertex_new(&t, node_id,
|
||||||
VTYPE_PSEUDO_TE_IS);
|
VTYPE_PSEUDO_TE_IS);
|
||||||
vertices[vertex_count]->d_N = 15;
|
vertices[vertex_count]->d_N = 15;
|
||||||
vertex_count++;
|
vertex_count++;
|
||||||
|
|
||||||
memset(nid.id, 0, sizeof(nid.id));
|
memset(node_id, 0, sizeof(node_id));
|
||||||
nid.id[5] = 2;
|
node_id[5] = 2;
|
||||||
vertices[vertex_count] = isis_vertex_new(&t, &nid,
|
vertices[vertex_count] = isis_vertex_new(&t, node_id,
|
||||||
VTYPE_NONPSEUDO_TE_IS);
|
VTYPE_NONPSEUDO_TE_IS);
|
||||||
vertices[vertex_count]->d_N = 15;
|
vertices[vertex_count]->d_N = 15;
|
||||||
vertex_count++;
|
vertex_count++;
|
||||||
|
|
||||||
nip.ip.dest.family = AF_INET;
|
p.dest.family = AF_INET;
|
||||||
nip.ip.dest.prefixlen = 24;
|
p.dest.prefixlen = 24;
|
||||||
inet_pton(AF_INET, "192.168.3.0", &nip.ip.dest.u.prefix4);
|
inet_pton(AF_INET, "192.168.3.0", &p.dest.u.prefix4);
|
||||||
vertices[vertex_count] = isis_vertex_new(&t, &nip, VTYPE_IPREACH_TE);
|
vertices[vertex_count] = isis_vertex_new(&t, &p, VTYPE_IPREACH_TE);
|
||||||
vertices[vertex_count]->d_N = 20;
|
vertices[vertex_count]->d_N = 20;
|
||||||
vertex_count++;
|
vertex_count++;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user