Commit 71bec28
committed
hm2_eth: print iptables commands when running unprivileged
Previously when iptables was unavailable (rootless via 'make setcap',
or no_iptables=1), the driver logged a single line saying isolation
was disabled and nothing else. The user had no way to recover the
exact rules they would need to install manually, and hm2_eth(9) does
not document them.
Refactor install_iptables_rule() to a print-or-exec dual mode: build
the command unconditionally, then either shell it (when iptables is
available) or LL_PRINT it as advice (when not). Drop the outer
use_iptables() gates on the setup paths in start_board() and
rtapi_app_main() so the print branch is reached. Cleanup paths keep
their gate since there is nothing to print on teardown.
The probe in use_iptables() now also emits the chain-setup commands
(iptables -N <CHAIN>; iptables -I OUTPUT 1 -j <CHAIN>) at the time
it discovers iptables is unreachable, so the user gets a complete
recipe: chain setup once, plus per-board / per-interface rules
logged inline as boards come up.
Reported by @hdiethelm in PR #3964 review while testing 7I96S under
'make setcap'.1 parent 5118840 commit 71bec28
1 file changed
Lines changed: 27 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
492 | | - | |
493 | | - | |
494 | | - | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
495 | 499 | | |
496 | 500 | | |
497 | 501 | | |
| |||
585 | 589 | | |
586 | 590 | | |
587 | 591 | | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
588 | 599 | | |
589 | 600 | | |
590 | 601 | | |
| |||
629 | 640 | | |
630 | 641 | | |
631 | 642 | | |
632 | | - | |
633 | | - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
634 | 649 | | |
635 | 650 | | |
636 | 651 | | |
| |||
734 | 749 | | |
735 | 750 | | |
736 | 751 | | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
742 | 757 | | |
743 | 758 | | |
744 | 759 | | |
| |||
1620 | 1635 | | |
1621 | 1636 | | |
1622 | 1637 | | |
1623 | | - | |
1624 | | - | |
| 1638 | + | |
| 1639 | + | |
1625 | 1640 | | |
1626 | 1641 | | |
1627 | 1642 | | |
| |||
0 commit comments