Repository navigation
Commit c8e5a62
nftables phase 2: router-shaped matches and a staged atomic apply
Close the seven UI gaps the phase-1 lab run surfaced, and add the
connectivity-safe batch apply.
Filter rules gain interface (iifname/oifname), connection-state
(ct state established,related) and ICMP (ip protocol icmp / ip6 nexthdr
ipv6-icmp, with an optional type) matches, each built for the table's
family. Masquerade takes an optional source network. A rule that matches
an alias reads its family off the set's element type instead of demanding
the Family field. The actions menu can delete a chain of the tool's own
table and drop the whole table, guarded so it never removes someone
else's. Pressing a in the NAT and alias views opens the actions those
views add through instead of a refusal.
Staging (internal/nftables/staging) collects mutations into a pending
set, applies them as one `nft -f` transaction — all-or-nothing — after a
single preview and confirm, snapshots the ruleset first, and rolls it
back on its own if the operator does not confirm they still have access
within a keep window (default 60s). Driven from the TUI with s/S/k, and
reported by --check and --report.
Covered by table-driven tests, staging unit tests with a hand-driven
timer, two new fuzz targets plus ct-state/icmp parser seeds (which caught
a whitespace-only ct state), and a real-nft run in a `unshare -rn`
namespace that applies a forward policy drop with its accept atomically
and restores the snapshot on a missed keep.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MCypLQF5AD8JD831Ea9S9q1 parent 62d3084 commit c8e5a62
23 files changed
Lines changed: 2624 additions & 56 deletions
File tree
- cmd/tui-firewall
- internal
- firewall
- nftables
- staging
- testdata/fuzz/FuzzDecodeExprs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
79 | 101 | | |
80 | 102 | | |
81 | 103 | | |
| |||
125 | 147 | | |
126 | 148 | | |
127 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
128 | 157 | | |
129 | 158 | | |
130 | 159 | | |
| |||
188 | 217 | | |
189 | 218 | | |
190 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
191 | 230 | | |
192 | 231 | | |
193 | 232 | | |
194 | 233 | | |
| 234 | + | |
| 235 | + | |
195 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
196 | 245 | | |
197 | 246 | | |
198 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
199 | 251 | | |
200 | 252 | | |
201 | 253 | | |
| |||
204 | 256 | | |
205 | 257 | | |
206 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
207 | 270 | | |
208 | 271 | | |
209 | 272 | | |
| |||
260 | 323 | | |
261 | 324 | | |
262 | 325 | | |
| 326 | + | |
| 327 | + | |
263 | 328 | | |
264 | 329 | | |
265 | 330 | | |
| |||
358 | 423 | | |
359 | 424 | | |
360 | 425 | | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
361 | 433 | | |
362 | 434 | | |
363 | 435 | | |
| |||
413 | 485 | | |
414 | 486 | | |
415 | 487 | | |
416 | | - | |
| 488 | + | |
417 | 489 | | |
418 | 490 | | |
419 | 491 | | |
| |||
427 | 499 | | |
428 | 500 | | |
429 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
430 | 507 | | |
431 | 508 | | |
432 | 509 | | |
| |||
445 | 522 | | |
446 | 523 | | |
447 | 524 | | |
448 | | - | |
449 | | - | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
450 | 530 | | |
451 | 531 | | |
452 | 532 | | |
| |||
469 | 549 | | |
470 | 550 | | |
471 | 551 | | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
472 | 568 | | |
473 | 569 | | |
474 | 570 | | |
| |||
478 | 574 | | |
479 | 575 | | |
480 | 576 | | |
481 | | - | |
| 577 | + | |
482 | 578 | | |
483 | 579 | | |
484 | 580 | | |
| |||
512 | 608 | | |
513 | 609 | | |
514 | 610 | | |
515 | | - | |
| 611 | + | |
516 | 612 | | |
517 | 613 | | |
518 | 614 | | |
| |||
695 | 791 | | |
696 | 792 | | |
697 | 793 | | |
698 | | - | |
| 794 | + | |
699 | 795 | | |
700 | 796 | | |
701 | 797 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
87 | 105 | | |
88 | 106 | | |
89 | 107 | | |
| |||
129 | 147 | | |
130 | 148 | | |
131 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
132 | 158 | | |
133 | 159 | | |
134 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
18 | 32 | | |
19 | 33 | | |
20 | 34 | | |
| |||
79 | 93 | | |
80 | 94 | | |
81 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
82 | 99 | | |
83 | 100 | | |
84 | 101 | | |
| |||
102 | 119 | | |
103 | 120 | | |
104 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
105 | 145 | | |
106 | 146 | | |
107 | 147 | | |
| |||
222 | 262 | | |
223 | 263 | | |
224 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
225 | 268 | | |
226 | 269 | | |
227 | 270 | | |
228 | 271 | | |
229 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
230 | 276 | | |
231 | 277 | | |
232 | 278 | | |
| |||
0 commit comments