Commit bc5a9b8
Florian Westphal
firewall-util-nft: attempt table recreation when add operation fails
When someone runs 'nft flush ruleset' in the same net namespace
this will also tear down the systemd nat table.
Unlike iptables -t nat -F, which will remove all rules added by
the systemd iptables backend, iptables has builtin chains that cannot
be deleted. IOW, the next add operation will 'just work'.
In the nftables case however, the entire table gets removed.
When the systemd nat table is removed by an external entity next
attempt to add a set element will yield -ENOENT.
If this happens, recreate the table, and, if successful, re-do
the add operation.
Note that this doesn't protect against external sabotage such as
a running 'while true; nft flush ruleset;done'. However, there is
nothing that could be done short of extending the kernel to allow
tables to be "frozen" or otherwise tied to a process such as
systemd-networkd.1 parent 715a70e commit bc5a9b8
1 file changed
Lines changed: 55 additions & 0 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
778 | 778 | | |
779 | 779 | | |
780 | 780 | | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
781 | 815 | | |
782 | 816 | | |
783 | 817 | | |
| |||
787 | 821 | | |
788 | 822 | | |
789 | 823 | | |
| 824 | + | |
790 | 825 | | |
791 | 826 | | |
792 | 827 | | |
793 | 828 | | |
794 | 829 | | |
795 | 830 | | |
| 831 | + | |
796 | 832 | | |
797 | 833 | | |
798 | 834 | | |
| |||
817 | 853 | | |
818 | 854 | | |
819 | 855 | | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
820 | 864 | | |
821 | 865 | | |
822 | 866 | | |
| |||
836 | 880 | | |
837 | 881 | | |
838 | 882 | | |
| 883 | + | |
839 | 884 | | |
840 | 885 | | |
841 | 886 | | |
| |||
850 | 895 | | |
851 | 896 | | |
852 | 897 | | |
| 898 | + | |
853 | 899 | | |
854 | 900 | | |
855 | 901 | | |
| |||
896 | 942 | | |
897 | 943 | | |
898 | 944 | | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
899 | 954 | | |
900 | 955 | | |
901 | 956 | | |
| |||
0 commit comments