@@ -144,14 +144,14 @@ func (cfg *IptablesConfigurator) executeDeleteCommands() error {
144
144
deleteCmds := [][]string {
145
145
{"-t" , iptablesconstants .MANGLE , "-D" , iptablesconstants .PREROUTING , "-j" , ChainInpodPrerouting },
146
146
{"-t" , iptablesconstants .MANGLE , "-D" , iptablesconstants .OUTPUT , "-j" , ChainInpodOutput },
147
- {"-t" , iptablesconstants .NAT , "-D" , iptablesconstants .PREROUTING , "-j" , ChainInpodPrerouting },
148
147
{"-t" , iptablesconstants .NAT , "-D" , iptablesconstants .OUTPUT , "-j" , ChainInpodOutput },
149
- {"-t" , iptablesconstants .RAW , "-D" , iptablesconstants .PREROUTING , "-j" , ChainInpodPrerouting },
150
- {"-t" , iptablesconstants .RAW , "-D" , iptablesconstants .OUTPUT , "-j" , ChainInpodOutput },
151
148
}
152
149
153
- // these sometimes fail due to "Device or resource busy"
150
+ // these sometimes fail due to "Device or resource busy" or because they are optional given the iptables cfg
154
151
optionalDeleteCmds := [][]string {
152
+ {"-t" , iptablesconstants .RAW , "-D" , iptablesconstants .PREROUTING , "-j" , ChainInpodPrerouting },
153
+ {"-t" , iptablesconstants .RAW , "-D" , iptablesconstants .OUTPUT , "-j" , ChainInpodOutput },
154
+ {"-t" , iptablesconstants .NAT , "-D" , iptablesconstants .PREROUTING , "-j" , ChainInpodPrerouting },
155
155
// flush-then-delete our created chains
156
156
{"-t" , iptablesconstants .MANGLE , "-F" , ChainInpodPrerouting },
157
157
{"-t" , iptablesconstants .MANGLE , "-F" , ChainInpodOutput },
@@ -182,10 +182,7 @@ func (cfg *IptablesConfigurator) executeDeleteCommands() error {
182
182
}
183
183
184
184
for _ , cmd := range optionalDeleteCmds {
185
- err := cfg .ext .Run (iptablesconstants .IPTables , & iptVer , nil , cmd ... )
186
- if err != nil {
187
- log .Debugf ("ignoring error deleting optional iptables rule: %v" , err )
188
- }
185
+ cfg .ext .RunQuietlyAndIgnore (iptablesconstants .IPTables , & iptVer , nil , cmd ... )
189
186
}
190
187
}
191
188
return errors .Join (delErrs ... )
0 commit comments