@@ -14,7 +14,7 @@ Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
14
14
staticd/static_srv6.h | 125 ++++
15
15
staticd/static_vrf.c | 2 +
16
16
staticd/static_vty.c | 320 +++++++++
17
- staticd/static_zebra.c | 636 ++++++++++++++++++
17
+ staticd/static_zebra.c | 698 ++++++++++++++++++
18
18
staticd/static_zebra.h | 12 +-
19
19
staticd/subdir.am | 2 +
20
20
tests/topotests/static_srv6_sids/__init__.py | 0
@@ -1136,7 +1136,7 @@ index d76befc131..f86fd3b48a 100644
1136
1136
return 0;
1137
1137
}
1138
1138
1139
- @@ -530 ,10 +537,639 @@ extern void static_zebra_route_add(struct static_path *pn, bool install)
1139
+ @@ -529 ,10 +536,701 @@ extern void static_zebra_route_add(struct static_path *pn, bool install)
1140
1140
zclient, &api);
1141
1141
}
1142
1142
@@ -1218,6 +1218,9 @@ index d76befc131..f86fd3b48a 100644
1218
1218
+ struct seg6local_context ctx = {};
1219
1219
+ struct interface *ifp = NULL;
1220
1220
+ struct vrf *vrf;
1221
+ + struct prefix_ipv6 sid_block = {};
1222
+ + struct prefix_ipv6 locator_block = {};
1223
+ + struct prefix_ipv6 sid_locator = {};
1221
1224
+
1222
1225
+ if (!sid)
1223
1226
+ return;
@@ -1291,10 +1294,38 @@ index d76befc131..f86fd3b48a 100644
1291
1294
+ break;
1292
1295
+ }
1293
1296
+
1294
- + ctx.block_len = sid->locator->block_bits_length;
1295
- + ctx.node_len = sid->locator->node_bits_length;
1296
- + ctx.function_len = sid->locator->function_bits_length;
1297
- + ctx.argument_len = sid->locator->argument_bits_length;
1297
+ + ctx.block_len = 0;
1298
+ + ctx.node_len = 0;
1299
+ + ctx.function_len = 0;
1300
+ + ctx.argument_len = 0;
1301
+ +
1302
+ + sid_block = sid->addr;
1303
+ + sid_block.prefixlen = sid->locator->block_bits_length;
1304
+ + apply_mask(&sid_block);
1305
+ +
1306
+ + locator_block = sid->locator->prefix;
1307
+ + locator_block.prefixlen = sid->locator->block_bits_length;
1308
+ + apply_mask(&locator_block);
1309
+ +
1310
+ + if (prefix_same(&sid_block, &locator_block))
1311
+ + ctx.block_len = sid->locator->block_bits_length;
1312
+ + else {
1313
+ + zlog_warn("SID block %pFX does not match locator block %pFX", &sid_block, &locator_block);
1314
+ + return;
1315
+ + }
1316
+ +
1317
+ + sid_locator = sid->addr;
1318
+ + sid_locator.prefixlen = sid->locator->block_bits_length + sid->locator->node_bits_length;
1319
+ + apply_mask(&sid_locator);
1320
+ +
1321
+ + if (prefix_same(&sid_locator, &sid->locator->prefix))
1322
+ + ctx.node_len = sid->locator->node_bits_length;
1323
+ + else {
1324
+ + zlog_warn("SID locator %pFX does not match the specified locator %pFX", &sid_locator, &sid->locator->prefix);
1325
+ + return;
1326
+ + }
1327
+ +
1328
+ + ctx.function_len = sid->addr.prefixlen - (ctx.block_len + ctx.node_len);
1298
1329
+
1299
1330
+ /* Attach the SID to the SRv6 interface */
1300
1331
+ if (!ifp) {
@@ -1318,6 +1349,9 @@ index d76befc131..f86fd3b48a 100644
1318
1349
+ struct interface *ifp = NULL;
1319
1350
+ struct seg6local_context ctx = {};
1320
1351
+ struct vrf *vrf;
1352
+ + struct prefix_ipv6 sid_block = {};
1353
+ + struct prefix_ipv6 locator_block = {};
1354
+ + struct prefix_ipv6 sid_locator = {};
1321
1355
+
1322
1356
+ if (!sid)
1323
1357
+ return;
@@ -1387,10 +1421,38 @@ index d76befc131..f86fd3b48a 100644
1387
1421
+ }
1388
1422
+ }
1389
1423
+
1390
- + ctx.block_len = sid->locator->block_bits_length;
1391
- + ctx.node_len = sid->locator->node_bits_length;
1392
- + ctx.function_len = sid->locator->function_bits_length;
1393
- + ctx.argument_len = sid->locator->argument_bits_length;
1424
+ + ctx.block_len = 0;
1425
+ + ctx.node_len = 0;
1426
+ + ctx.function_len = 0;
1427
+ + ctx.argument_len = 0;
1428
+ +
1429
+ + sid_block = sid->addr;
1430
+ + sid_block.prefixlen = sid->locator->block_bits_length;
1431
+ + apply_mask(&sid_block);
1432
+ +
1433
+ + locator_block = sid->locator->prefix;
1434
+ + locator_block.prefixlen = sid->locator->block_bits_length;
1435
+ + apply_mask(&locator_block);
1436
+ +
1437
+ + if (prefix_same(&sid_block, &locator_block))
1438
+ + ctx.block_len = sid->locator->block_bits_length;
1439
+ + else {
1440
+ + zlog_warn("SID block %pFX does not match locator block %pFX", &sid_block, &locator_block);
1441
+ + return;
1442
+ + }
1443
+ +
1444
+ + sid_locator = sid->addr;
1445
+ + sid_locator.prefixlen = sid->locator->block_bits_length + sid->locator->node_bits_length;
1446
+ + apply_mask(&sid_locator);
1447
+ +
1448
+ + if (prefix_same(&sid_locator, &sid->locator->prefix))
1449
+ + ctx.node_len = sid->locator->node_bits_length;
1450
+ + else {
1451
+ + zlog_warn("SID locator %pFX does not match the specified locator %pFX", &sid_locator, &sid->locator->prefix);
1452
+ + return;
1453
+ + }
1454
+ +
1455
+ + ctx.function_len = sid->addr.prefixlen - (ctx.block_len + ctx.node_len);
1394
1456
+
1395
1457
+ zlog_info("delete SID %pFX",
1396
1458
+ &sid->addr);
0 commit comments