1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
|
/*
* IS-IS Rout(e)ing protocol - Multi Topology Support
*
* Copyright (C) 2017 Christian Franke
*
* This file is part of FreeRangeRouting (FRR)
*
* FRR is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* FRR is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; see the file COPYING; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
#include "isisd/isisd.h"
#include "isisd/isis_memory.h"
#include "isisd/isis_circuit.h"
#include "isisd/isis_adjacency.h"
#include "isisd/isis_tlv.h"
#include "isisd/isis_misc.h"
#include "isisd/isis_lsp.h"
#include "isisd/isis_mt.h"
DEFINE_MTYPE_STATIC(ISISD, MT_AREA_SETTING, "ISIS MT Area Setting")
DEFINE_MTYPE_STATIC(ISISD, MT_CIRCUIT_SETTING, "ISIS MT Circuit Setting")
DEFINE_MTYPE_STATIC(ISISD, MT_ADJ_INFO, "ISIS MT Adjacency Info")
DEFINE_MTYPE_STATIC(ISISD, MT_NEIGHBORS, "ISIS MT Neighbors for TLV")
DEFINE_MTYPE_STATIC(ISISD, MT_IPV4_REACHS, "ISIS MT IPv4 Reachabilities for TLV")
DEFINE_MTYPE_STATIC(ISISD, MT_IPV6_REACHS, "ISIS MT IPv6 Reachabilities for TLV")
uint16_t isis_area_ipv6_topology(struct isis_area *area)
{
struct isis_area_mt_setting *area_mt_setting;
area_mt_setting = area_lookup_mt_setting(area, ISIS_MT_IPV6_UNICAST);
if (area_mt_setting && area_mt_setting->enabled)
return ISIS_MT_IPV6_UNICAST;
return ISIS_MT_IPV4_UNICAST;
}
/* MT naming api */
const char *isis_mtid2str(uint16_t mtid)
{
static char buf[sizeof("65535")];
switch(mtid)
{
case ISIS_MT_IPV4_UNICAST:
return "ipv4-unicast";
case ISIS_MT_IPV4_MGMT:
return "ipv4-mgmt";
case ISIS_MT_IPV6_UNICAST:
return "ipv6-unicast";
case ISIS_MT_IPV4_MULTICAST:
return "ipv4-multicast";
case ISIS_MT_IPV6_MULTICAST:
return "ipv6-multicast";
case ISIS_MT_IPV6_MGMT:
return "ipv6-mgmt";
default:
snprintf(buf, sizeof(buf), "%" PRIu16, mtid);
return buf;
}
}
uint16_t isis_str2mtid(const char *name)
{
if (!strcmp(name,"ipv4-unicast"))
return ISIS_MT_IPV4_UNICAST;
if (!strcmp(name,"ipv4-mgmt"))
return ISIS_MT_IPV4_MGMT;
if (!strcmp(name,"ipv6-unicast"))
return ISIS_MT_IPV6_UNICAST;
if (!strcmp(name,"ipv4-multicast"))
return ISIS_MT_IPV4_MULTICAST;
if (!strcmp(name,"ipv6-multicast"))
return ISIS_MT_IPV6_MULTICAST;
if (!strcmp(name,"ipv6-mgmt"))
return ISIS_MT_IPV6_MGMT;
return -1;
}
/* General MT settings api */
struct mt_setting {
ISIS_MT_INFO_FIELDS;
};
static void *
lookup_mt_setting(struct list *mt_list, uint16_t mtid)
{
struct listnode *node;
struct mt_setting *setting;
for (ALL_LIST_ELEMENTS_RO(mt_list, node, setting))
{
if (setting->mtid == mtid)
return setting;
}
return NULL;
}
static void
add_mt_setting(struct list **mt_list, void *setting)
{
if (!*mt_list)
*mt_list = list_new();
listnode_add(*mt_list, setting);
}
/* Area specific MT settings api */
struct isis_area_mt_setting*
area_lookup_mt_setting(struct isis_area *area, uint16_t mtid)
{
return lookup_mt_setting(area->mt_settings, mtid);
}
struct isis_area_mt_setting*
area_new_mt_setting(struct isis_area *area, uint16_t mtid)
{
struct isis_area_mt_setting *setting;
setting = XCALLOC(MTYPE_MT_AREA_SETTING, sizeof(*setting));
setting->mtid = mtid;
return setting;
}
static void
area_free_mt_setting(void *setting)
{
XFREE(MTYPE_MT_AREA_SETTING, setting);
}
void
area_add_mt_setting(struct isis_area *area, struct isis_area_mt_setting *setting)
{
add_mt_setting(&area->mt_settings, setting);
}
void
area_mt_init(struct isis_area *area)
{
struct isis_area_mt_setting *v4_unicast_setting;
/* MTID 0 is always enabled */
v4_unicast_setting = area_new_mt_setting(area, ISIS_MT_IPV4_UNICAST);
v4_unicast_setting->enabled = true;
add_mt_setting(&area->mt_settings, v4_unicast_setting);
area->mt_settings->del = area_free_mt_setting;
}
void
area_mt_finish(struct isis_area *area)
{
list_delete(area->mt_settings);
area->mt_settings = NULL;
}
struct isis_area_mt_setting *
area_get_mt_setting(struct isis_area *area, uint16_t mtid)
{
struct isis_area_mt_setting *setting;
setting = area_lookup_mt_setting(area, mtid);
if (!setting)
{
setting = area_new_mt_setting(area, mtid);
area_add_mt_setting(area, setting);
}
return setting;
}
int
area_write_mt_settings(struct isis_area *area, struct vty *vty)
{
int written = 0;
struct listnode *node;
struct isis_area_mt_setting *setting;
for (ALL_LIST_ELEMENTS_RO(area->mt_settings, node, setting))
{
const char *name = isis_mtid2str(setting->mtid);
if (name && setting->enabled)
{
if (setting->mtid == ISIS_MT_IPV4_UNICAST)
continue; /* always enabled, no need to write out config */
vty_out (vty, " topology %s%s%s", name,
setting->overload ? " overload" : "",
VTY_NEWLINE);
written++;
}
}
return written;
}
bool area_is_mt(struct isis_area *area)
{
struct listnode *node, *node2;
struct isis_area_mt_setting *setting;
struct isis_circuit *circuit;
struct isis_circuit_mt_setting *csetting;
for (ALL_LIST_ELEMENTS_RO(area->mt_settings, node, setting))
{
if (setting->enabled && setting->mtid != ISIS_MT_IPV4_UNICAST)
return true;
}
for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit))
{
for (ALL_LIST_ELEMENTS_RO(circuit->mt_settings, node2, csetting))
{
if (!csetting->enabled && csetting->mtid == ISIS_MT_IPV4_UNICAST)
return true;
}
}
return false;
}
struct isis_area_mt_setting**
area_mt_settings(struct isis_area *area, unsigned int *mt_count)
{
static unsigned int size = 0;
static struct isis_area_mt_setting **rv = NULL;
unsigned int count = 0;
struct listnode *node;
struct isis_area_mt_setting *setting;
for (ALL_LIST_ELEMENTS_RO(area->mt_settings, node, setting))
{
if (!setting->enabled)
continue;
count++;
if (count > size)
{
rv = XREALLOC(MTYPE_TMP, rv, count * sizeof(*rv));
size = count;
}
rv[count-1] = setting;
}
*mt_count = count;
return rv;
}
/* Circuit specific MT settings api */
struct isis_circuit_mt_setting*
circuit_lookup_mt_setting(struct isis_circuit *circuit, uint16_t mtid)
{
return lookup_mt_setting(circuit->mt_settings, mtid);
}
struct isis_circuit_mt_setting*
circuit_new_mt_setting(struct isis_circuit *circuit, uint16_t mtid)
{
struct isis_circuit_mt_setting *setting;
setting = XCALLOC(MTYPE_MT_CIRCUIT_SETTING, sizeof(*setting));
setting->mtid = mtid;
setting->enabled = true; /* Enabled is default for circuit */
return setting;
}
static void
circuit_free_mt_setting(void *setting)
{
XFREE(MTYPE_MT_CIRCUIT_SETTING, setting);
}
void
circuit_add_mt_setting(struct isis_circuit *circuit,
struct isis_circuit_mt_setting *setting)
{
add_mt_setting(&circuit->mt_settings, setting);
}
void
circuit_mt_init(struct isis_circuit *circuit)
{
circuit->mt_settings = list_new();
circuit->mt_settings->del = circuit_free_mt_setting;
}
void
circuit_mt_finish(struct isis_circuit *circuit)
{
list_delete(circuit->mt_settings);
circuit->mt_settings = NULL;
}
struct isis_circuit_mt_setting*
circuit_get_mt_setting(struct isis_circuit *circuit, uint16_t mtid)
{
struct isis_circuit_mt_setting *setting;
setting = circuit_lookup_mt_setting(circuit, mtid);
if (!setting)
{
setting = circuit_new_mt_setting(circuit, mtid);
circuit_add_mt_setting(circuit, setting);
}
return setting;
}
int
circuit_write_mt_settings(struct isis_circuit *circuit, struct vty *vty)
{
int written = 0;
struct listnode *node;
struct isis_circuit_mt_setting *setting;
for (ALL_LIST_ELEMENTS_RO (circuit->mt_settings, node, setting))
{
const char *name = isis_mtid2str(setting->mtid);
if (name && !setting->enabled)
{
vty_out (vty, " no isis topology %s%s", name, VTY_NEWLINE);
written++;
}
}
return written;
}
struct isis_circuit_mt_setting**
circuit_mt_settings(struct isis_circuit *circuit, unsigned int *mt_count)
{
static unsigned int size = 0;
static struct isis_circuit_mt_setting **rv = NULL;
struct isis_area_mt_setting **area_settings;
unsigned int area_count;
unsigned int count = 0;
struct listnode *node;
struct isis_circuit_mt_setting *setting;
area_settings = area_mt_settings(circuit->area, &area_count);
for (unsigned int i = 0; i < area_count; i++)
{
for (ALL_LIST_ELEMENTS_RO(circuit->mt_settings, node, setting))
{
if (setting->mtid != area_settings[i]->mtid)
continue;
break;
}
if (!setting)
setting = circuit_get_mt_setting(circuit, area_settings[i]->mtid);
if (!setting->enabled)
continue;
count++;
if (count > size)
{
rv = XREALLOC(MTYPE_TMP, rv, count * sizeof(*rv));
size = count;
}
rv[count-1] = setting;
}
*mt_count = count;
return rv;
}
/* ADJ specific MT API */
static void adj_mt_set(struct isis_adjacency *adj, unsigned int index,
uint16_t mtid)
{
if (adj->mt_count < index + 1)
{
adj->mt_set = XREALLOC(MTYPE_MT_ADJ_INFO, adj->mt_set,
(index + 1) * sizeof(*adj->mt_set));
adj->mt_count = index + 1;
}
adj->mt_set[index] = mtid;
}
bool
tlvs_to_adj_mt_set(struct tlvs *tlvs, bool v4_usable, bool v6_usable,
struct isis_adjacency *adj)
{
struct isis_circuit_mt_setting **mt_settings;
unsigned int circuit_mt_count;
unsigned int intersect_count = 0;
uint16_t *old_mt_set = NULL;
unsigned int old_mt_count;
old_mt_count = adj->mt_count;
if (old_mt_count)
{
old_mt_set = XCALLOC(MTYPE_TMP, old_mt_count * sizeof(*old_mt_set));
memcpy(old_mt_set, adj->mt_set, old_mt_count * sizeof(*old_mt_set));
}
mt_settings = circuit_mt_settings(adj->circuit, &circuit_mt_count);
for (unsigned int i = 0; i < circuit_mt_count; i++)
{
if (!tlvs->mt_router_info)
{
/* Other end does not have MT enabled */
if (mt_settings[i]->mtid == ISIS_MT_IPV4_UNICAST && v4_usable)
adj_mt_set(adj, intersect_count++, ISIS_MT_IPV4_UNICAST);
}
else
{
struct listnode *node;
struct mt_router_info *info;
for (ALL_LIST_ELEMENTS_RO(tlvs->mt_router_info, node, info))
{
if (mt_settings[i]->mtid == info->mtid)
{
bool usable;
switch (info->mtid)
{
case ISIS_MT_IPV4_UNICAST:
case ISIS_MT_IPV4_MGMT:
case ISIS_MT_IPV4_MULTICAST:
usable = v4_usable;
break;
case ISIS_MT_IPV6_UNICAST:
case ISIS_MT_IPV6_MGMT:
case ISIS_MT_IPV6_MULTICAST:
usable = v6_usable;
break;
default:
usable = true;
break;
}
if (usable)
adj_mt_set(adj, intersect_count++, info->mtid);
}
}
}
}
adj->mt_count = intersect_count;
bool changed = false;
if (adj->mt_count != old_mt_count)
changed = true;
if (!changed && old_mt_count
&& memcmp(adj->mt_set, old_mt_set,
old_mt_count * sizeof(*old_mt_set)))
changed = true;
if (old_mt_count)
XFREE(MTYPE_TMP, old_mt_set);
return changed;
}
bool
adj_has_mt(struct isis_adjacency *adj, uint16_t mtid)
{
for (unsigned int i = 0; i < adj->mt_count; i++)
if (adj->mt_set[i] == mtid)
return true;
return false;
}
void
adj_mt_finish(struct isis_adjacency *adj)
{
XFREE(MTYPE_MT_ADJ_INFO, adj->mt_set);
adj->mt_count = 0;
}
/* TLV Router info api */
struct mt_router_info*
tlvs_lookup_mt_router_info(struct tlvs *tlvs, uint16_t mtid)
{
return lookup_mt_setting(tlvs->mt_router_info, mtid);
}
/* TLV MT Neighbors api */
struct tlv_mt_neighbors*
tlvs_lookup_mt_neighbors(struct tlvs *tlvs, uint16_t mtid)
{
return lookup_mt_setting(tlvs->mt_is_neighs, mtid);
}
static struct tlv_mt_neighbors*
tlvs_new_mt_neighbors(uint16_t mtid)
{
struct tlv_mt_neighbors *rv;
rv = XCALLOC(MTYPE_MT_NEIGHBORS, sizeof(*rv));
rv->mtid = mtid;
rv->list = list_new();
return rv;
};
static void
tlvs_free_mt_neighbors(void *arg)
{
struct tlv_mt_neighbors *neighbors = arg;
if (neighbors && neighbors->list)
list_delete(neighbors->list);
XFREE(MTYPE_MT_NEIGHBORS, neighbors);
}
static void
tlvs_add_mt_neighbors(struct tlvs *tlvs, struct tlv_mt_neighbors *neighbors)
{
add_mt_setting(&tlvs->mt_is_neighs, neighbors);
tlvs->mt_is_neighs->del = tlvs_free_mt_neighbors;
}
struct tlv_mt_neighbors*
tlvs_get_mt_neighbors(struct tlvs *tlvs, uint16_t mtid)
{
struct tlv_mt_neighbors *neighbors;
neighbors = tlvs_lookup_mt_neighbors(tlvs, mtid);
if (!neighbors)
{
neighbors = tlvs_new_mt_neighbors(mtid);
tlvs_add_mt_neighbors(tlvs, neighbors);
}
return neighbors;
}
/* TLV MT IPv4 reach api */
struct tlv_mt_ipv4_reachs*
tlvs_lookup_mt_ipv4_reachs(struct tlvs *tlvs, uint16_t mtid)
{
return lookup_mt_setting(tlvs->mt_ipv4_reachs, mtid);
}
static struct tlv_mt_ipv4_reachs*
tlvs_new_mt_ipv4_reachs(uint16_t mtid)
{
struct tlv_mt_ipv4_reachs *rv;
rv = XCALLOC(MTYPE_MT_IPV4_REACHS, sizeof(*rv));
rv->mtid = mtid;
rv->list = list_new();
return rv;
};
static void
tlvs_free_mt_ipv4_reachs(void *arg)
{
struct tlv_mt_ipv4_reachs *reachs = arg;
if (reachs && reachs->list)
list_delete(reachs->list);
XFREE(MTYPE_MT_IPV4_REACHS, reachs);
}
static void
tlvs_add_mt_ipv4_reachs(struct tlvs *tlvs, struct tlv_mt_ipv4_reachs *reachs)
{
add_mt_setting(&tlvs->mt_ipv4_reachs, reachs);
tlvs->mt_ipv4_reachs->del = tlvs_free_mt_ipv4_reachs;
}
struct tlv_mt_ipv4_reachs*
tlvs_get_mt_ipv4_reachs(struct tlvs *tlvs, uint16_t mtid)
{
struct tlv_mt_ipv4_reachs *reachs;
reachs = tlvs_lookup_mt_ipv4_reachs(tlvs, mtid);
if (!reachs)
{
reachs = tlvs_new_mt_ipv4_reachs(mtid);
tlvs_add_mt_ipv4_reachs(tlvs, reachs);
}
return reachs;
}
/* TLV MT IPv6 reach api */
struct tlv_mt_ipv6_reachs*
tlvs_lookup_mt_ipv6_reachs(struct tlvs *tlvs, uint16_t mtid)
{
return lookup_mt_setting(tlvs->mt_ipv6_reachs, mtid);
}
static struct tlv_mt_ipv6_reachs*
tlvs_new_mt_ipv6_reachs(uint16_t mtid)
{
struct tlv_mt_ipv6_reachs *rv;
rv = XCALLOC(MTYPE_MT_IPV6_REACHS, sizeof(*rv));
rv->mtid = mtid;
rv->list = list_new();
return rv;
};
static void
tlvs_free_mt_ipv6_reachs(void *arg)
{
struct tlv_mt_ipv6_reachs *reachs = arg;
if (reachs && reachs->list)
list_delete(reachs->list);
XFREE(MTYPE_MT_IPV6_REACHS, reachs);
}
static void
tlvs_add_mt_ipv6_reachs(struct tlvs *tlvs, struct tlv_mt_ipv6_reachs *reachs)
{
add_mt_setting(&tlvs->mt_ipv6_reachs, reachs);
tlvs->mt_ipv6_reachs->del = tlvs_free_mt_ipv6_reachs;
}
struct tlv_mt_ipv6_reachs*
tlvs_get_mt_ipv6_reachs(struct tlvs *tlvs, uint16_t mtid)
{
struct tlv_mt_ipv6_reachs *reachs;
reachs = tlvs_lookup_mt_ipv6_reachs(tlvs, mtid);
if (!reachs)
{
reachs = tlvs_new_mt_ipv6_reachs(mtid);
tlvs_add_mt_ipv6_reachs(tlvs, reachs);
}
return reachs;
}
static void
mt_set_add(uint16_t **mt_set, unsigned int *size,
unsigned int *index, uint16_t mtid)
{
for (unsigned int i = 0; i < *index; i++)
{
if ((*mt_set)[i] == mtid)
return;
}
if (*index >= *size)
{
*mt_set = XREALLOC(MTYPE_TMP, *mt_set, sizeof(**mt_set) * ((*index) + 1));
*size = (*index) + 1;
}
(*mt_set)[*index] = mtid;
*index = (*index) + 1;
}
static uint16_t *
circuit_bcast_mt_set(struct isis_circuit *circuit, int level,
unsigned int *mt_count)
{
static uint16_t *rv;
static unsigned int size;
struct listnode *node;
struct isis_adjacency *adj;
unsigned int count = 0;
if (circuit->circ_type != CIRCUIT_T_BROADCAST)
{
*mt_count = 0;
return NULL;
}
for (ALL_LIST_ELEMENTS_RO(circuit->u.bc.adjdb[level - 1], node, adj))
{
if (adj->adj_state != ISIS_ADJ_UP)
continue;
for (unsigned int i = 0; i < adj->mt_count; i++)
mt_set_add(&rv, &size, &count, adj->mt_set[i]);
}
*mt_count = count;
return rv;
}
static void
tlvs_add_mt_set(struct isis_area *area,
struct tlvs *tlvs, unsigned int mt_count,
uint16_t *mt_set, struct te_is_neigh *neigh)
{
for (unsigned int i = 0; i < mt_count; i++)
{
uint16_t mtid = mt_set[i];
struct te_is_neigh *ne_copy;
ne_copy = XCALLOC(MTYPE_ISIS_TLV, sizeof(*ne_copy));
memcpy(ne_copy, neigh, sizeof(*ne_copy));
if (mt_set[i] == ISIS_MT_IPV4_UNICAST)
{
listnode_add(tlvs->te_is_neighs, ne_copy);
lsp_debug("ISIS (%s): Adding %s.%02x as te-style neighbor",
area->area_tag, sysid_print(ne_copy->neigh_id),
LSP_PSEUDO_ID(ne_copy->neigh_id));
}
else
{
struct tlv_mt_neighbors *neighbors;
neighbors = tlvs_get_mt_neighbors(tlvs, mtid);
neighbors->list->del = free_tlv;
listnode_add(neighbors->list, ne_copy);
lsp_debug("ISIS (%s): Adding %s.%02x as mt-style neighbor for %s",
area->area_tag, sysid_print(ne_copy->neigh_id),
LSP_PSEUDO_ID(ne_copy->neigh_id), isis_mtid2str(mtid));
}
}
}
void
tlvs_add_mt_bcast(struct tlvs *tlvs, struct isis_circuit *circuit,
int level, struct te_is_neigh *neigh)
{
unsigned int mt_count;
uint16_t *mt_set = circuit_bcast_mt_set(circuit, level,
&mt_count);
tlvs_add_mt_set(circuit->area, tlvs, mt_count, mt_set, neigh);
}
void
tlvs_add_mt_p2p(struct tlvs *tlvs, struct isis_circuit *circuit,
struct te_is_neigh *neigh)
{
struct isis_adjacency *adj = circuit->u.p2p.neighbor;
tlvs_add_mt_set(circuit->area, tlvs, adj->mt_count, adj->mt_set, neigh);
}
|