}
static struct isis_vertex *isis_vertex_new(struct isis_spftree *spftree,
- union isis_N *n,
+ void *id,
enum vertextype vtype)
{
struct isis_vertex *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->parents = list_new();
#ifdef EXTREME_DEBUG
char buff[VID2STR_BUFFER];
#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);
if (lsp == NULL)
zlog_warn("ISIS-Spf: could not find own l%d LSP!",
spftree->level);
- vertex = isis_vertex_new(spftree, &n,
+ vertex = isis_vertex_new(spftree, sysid,
spftree->area->oldmetric
? VTYPE_NONPSEUDO_IS
: VTYPE_NONPSEUDO_TE_IS);
/*
* Triple <N, d(N), {Adj(N)}>
*/
-union isis_N {
- uint8_t id[ISIS_SYS_ID_LEN + 1];
- struct prefix_pair ip;
-};
struct isis_vertex {
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 */
uint16_t depth; /* The depth in the imaginary tree */
struct list *Adj_N; /* {Adj(N)} next hop or neighbor list */
};
__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)
{
vertex->type = 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)) {
- memcpy(&vertex->N.ip, &n->ip, sizeof(n->ip));
+ memcpy(&vertex->N.ip, id, sizeof(vertex->N.ip));
} else {
flog_err(LIB_ERR_DEVELOPMENT, "Unknown Vertex Type");
}
__attribute__((__unused__))
static struct isis_vertex *isis_find_vertex(struct isis_vertex_queue *queue,
- union isis_N *n,
+ const void *id,
enum vertextype vtype)
{
struct isis_vertex querier;
- isis_vertex_id_init(&querier, n, vtype);
+ isis_vertex_id_init(&querier, id, vtype);
return hash_lookup(queue->hash, &querier);
}
{
struct isis_spftree t = {
};
- union isis_N nid, nip = {
- .ip.dest.family = AF_UNSPEC
+ struct prefix_pair p = {
};
+ uint8_t node_id[7];
vertices = XMALLOC(MTYPE_TMP, sizeof(*vertices) * 16);
- nip.ip.dest.family = AF_INET;
- nip.ip.dest.prefixlen = 24;
- inet_pton(AF_INET, "192.168.1.0", &nip.ip.dest.u.prefix4);
- vertices[vertex_count] = isis_vertex_new(&t, &nip, VTYPE_IPREACH_TE);
+ p.dest.family = AF_INET;
+ p.dest.prefixlen = 24;
+ inet_pton(AF_INET, "192.168.1.0", &p.dest.u.prefix4);
+ vertices[vertex_count] = isis_vertex_new(&t, &p, VTYPE_IPREACH_TE);
vertices[vertex_count]->d_N = 20;
vertex_count++;
- nip.ip.dest.family = AF_INET;
- nip.ip.dest.prefixlen = 24;
- inet_pton(AF_INET, "192.168.2.0", &nip.ip.dest.u.prefix4);
- vertices[vertex_count] = isis_vertex_new(&t, &nip, VTYPE_IPREACH_TE);
+ p.dest.family = AF_INET;
+ p.dest.prefixlen = 24;
+ inet_pton(AF_INET, "192.168.2.0", &p.dest.u.prefix4);
+ vertices[vertex_count] = isis_vertex_new(&t, &p, VTYPE_IPREACH_TE);
vertices[vertex_count]->d_N = 20;
vertex_count++;
- memset(nid.id, 0, sizeof(nid.id));
- nid.id[6] = 1;
- vertices[vertex_count] = isis_vertex_new(&t, &nid,
+ memset(node_id, 0, sizeof(node_id));
+ node_id[6] = 1;
+ vertices[vertex_count] = isis_vertex_new(&t, node_id,
VTYPE_PSEUDO_TE_IS);
vertices[vertex_count]->d_N = 15;
vertex_count++;
- memset(nid.id, 0, sizeof(nid.id));
- nid.id[5] = 2;
- vertices[vertex_count] = isis_vertex_new(&t, &nid,
+ memset(node_id, 0, sizeof(node_id));
+ node_id[5] = 2;
+ vertices[vertex_count] = isis_vertex_new(&t, node_id,
VTYPE_NONPSEUDO_TE_IS);
vertices[vertex_count]->d_N = 15;
vertex_count++;
- nip.ip.dest.family = AF_INET;
- nip.ip.dest.prefixlen = 24;
- inet_pton(AF_INET, "192.168.3.0", &nip.ip.dest.u.prefix4);
- vertices[vertex_count] = isis_vertex_new(&t, &nip, VTYPE_IPREACH_TE);
+ p.dest.family = AF_INET;
+ p.dest.prefixlen = 24;
+ inet_pton(AF_INET, "192.168.3.0", &p.dest.u.prefix4);
+ vertices[vertex_count] = isis_vertex_new(&t, &p, VTYPE_IPREACH_TE);
vertices[vertex_count]->d_N = 20;
vertex_count++;
};