Commit 1e7e87f
committed
fix: rework NFT rules for KubeSpan
Don't attach nft rules to the IPv6 KubeSpan addresses, as Linux can
route these packets natively, they are directly assigned to the
`kubespan` interface.
Also fix the way MSS clamping is applied: previous implementation
incorrectly triggered clamping to all addresses if the list of IPv4 or
IPv6 addresses is empty.
Previous rules:
```
table inet talos {
chain kubespan_outgoing {
type route hook output priority filter; policy accept;
meta mark & 0x00000060 == 0x00000020 accept
oifname "lo" accept
ip daddr { 172.20.0.2, 172.20.0.4-172.20.0.6 } tcp flags & (syn | rst) == syn tcp option maxseg size > 1368 tcp option maxseg size set 1368
ip6 daddr { fd4e:cae:686b:1902:87f:e8ff:fe1e:b4e3, fd4e:cae:686b:1902:a44b:28ff:febf:e664, fd4e:cae:686b:1902:c049:f2ff:fe84:1785, fd4e:cae:686b:1902:c8c9:75ff:fe4c:5ba8 } tcp flags & (syn | rst) == syn tcp option maxseg size > 1348 tcp option maxseg size set 1348
ip daddr { 172.20.0.2, 172.20.0.4-172.20.0.6 } meta mark set meta mark & 0xffffffdf | 0x00000040 accept
ip6 daddr { fd4e:cae:686b:1902:87f:e8ff:fe1e:b4e3, fd4e:cae:686b:1902:a44b:28ff:febf:e664, fd4e:cae:686b:1902:c049:f2ff:fe84:1785, fd4e:cae:686b:1902:c8c9:75ff:fe4c:5ba8 } meta mark set meta mark & 0xffffffdf | 0x00000040 accept
}
chain kubespan_prerouting {
type filter hook prerouting priority filter; policy accept;
meta mark & 0x00000060 == 0x00000020 accept
ip daddr { 172.20.0.2, 172.20.0.4-172.20.0.6 } meta mark set meta mark & 0xffffffdf | 0x00000040 accept
ip6 daddr { fd4e:cae:686b:1902:87f:e8ff:fe1e:b4e3, fd4e:cae:686b:1902:a44b:28ff:febf:e664, fd4e:cae:686b:1902:c049:f2ff:fe84:1785, fd4e:cae:686b:1902:c8c9:75ff:fe4c:5ba8 } meta mark set meta mark & 0xffffffdf | 0x00000040 accept
}
}
```
New rules:
```
table inet talos {
chain kubespan_outgoing {
type route hook output priority filter; policy accept;
meta mark & 0x00000060 == 0x00000020 accept
oifname "lo" accept
ip daddr { 172.20.0.2, 172.20.0.4-172.20.0.6 } tcp flags & (syn | rst) == syn tcp option maxseg size > 1368 tcp option maxseg size set 1368
ip daddr { 172.20.0.2, 172.20.0.4-172.20.0.6 } meta mark set meta mark & 0xffffffdf | 0x00000040 accept
}
chain kubespan_prerouting {
type filter hook prerouting priority filter; policy accept;
meta mark & 0x00000060 == 0x00000020 accept
ip daddr { 172.20.0.2, 172.20.0.4-172.20.0.6 } meta mark set meta mark & 0xffffffdf | 0x00000040 accept
}
}
```
Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>1 parent 51bcfb5 commit 1e7e87f
File tree
4 files changed
+44
-13
lines changed- internal/app/machined/pkg
- adapters/network
- controllers
- kubespan
- network
4 files changed
+44
-13
lines changedLines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
655 | 655 | | |
656 | 656 | | |
657 | 657 | | |
658 | | - | |
659 | | - | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
660 | 665 | | |
661 | 666 | | |
662 | 667 | | |
| |||
Lines changed: 24 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
378 | | - | |
379 | | - | |
| 378 | + | |
| 379 | + | |
380 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
381 | 386 | | |
382 | 387 | | |
383 | 388 | | |
384 | 389 | | |
385 | 390 | | |
386 | | - | |
| 391 | + | |
387 | 392 | | |
388 | 393 | | |
389 | 394 | | |
| |||
441 | 446 | | |
442 | 447 | | |
443 | 448 | | |
444 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
445 | 465 | | |
446 | 466 | | |
447 | 467 | | |
| |||
Lines changed: 10 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
319 | | - | |
320 | | - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
321 | 322 | | |
322 | 323 | | |
323 | 324 | | |
| |||
327 | 328 | | |
328 | 329 | | |
329 | 330 | | |
330 | | - | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
331 | 334 | | |
332 | 335 | | |
333 | 336 | | |
334 | 337 | | |
335 | | - | |
| 338 | + | |
336 | 339 | | |
337 | 340 | | |
338 | 341 | | |
| |||
380 | 383 | | |
381 | 384 | | |
382 | 385 | | |
383 | | - | |
| 386 | + | |
384 | 387 | | |
385 | 388 | | |
386 | 389 | | |
| |||
425 | 428 | | |
426 | 429 | | |
427 | 430 | | |
428 | | - | |
| 431 | + | |
429 | 432 | | |
430 | 433 | | |
431 | 434 | | |
432 | 435 | | |
433 | 436 | | |
434 | 437 | | |
435 | 438 | | |
436 | | - | |
| 439 | + | |
437 | 440 | | |
438 | 441 | | |
439 | 442 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
356 | 359 | | |
357 | 360 | | |
358 | 361 | | |
| |||
0 commit comments