@@ -223,25 +223,25 @@ _exec_in_netns("ip link set", _vecId, "up")
223223_exec_in_netns (" ip route add default via" , _vehIp )
224224
225225if not _safe_exec (" iptables -C FORWARD -s" , _vecIp .. " /30" , " -j ACCEPT" ) then
226- _exec (" iptables -A FORWARD -s" , _vecIp .. " /30" , " -j ACCEPT" )
226+ _exec (" iptables -I FORWARD -s" , _vecIp .. " /30" , " -j ACCEPT" )
227227end
228228if not _safe_exec (" iptables -C FORWARD -d" , _vecIp .. " /30" , " -j ACCEPT" ) then
229- _exec (" iptables -A FORWARD -d" , _vecIp .. " /30" , " -j ACCEPT" )
229+ _exec (" iptables -I FORWARD -d" , _vecIp .. " /30" , " -j ACCEPT" )
230230end
231231
232232if _options .masquerade then
233233 if not _safe_exec (" iptables -t nat -C POSTROUTING -s" , _vecIp .. " /30" , " -j MASQUERADE" ) then
234- _exec (" iptables -t nat -A POSTROUTING -s" , _vecIp .. " /30" , " -j MASQUERADE" )
234+ _exec (" iptables -t nat -I POSTROUTING -s" , _vecIp .. " /30" , " -j MASQUERADE" )
235235 end
236236else
237237 if not _safe_exec (" iptables -t nat -C POSTROUTING -s" , _vecIp .. " /30" , " -j SNAT --to-source" , _options .outboundAddr ) then
238- _exec (" iptables -t nat -A POSTROUTING -s" , _vecIp .. " /30" , " -j SNAT --to-source" , _options .outboundAddr )
238+ _exec (" iptables -t nat -I POSTROUTING -s" , _vecIp .. " /30" , " -j SNAT --to-source" , _options .outboundAddr )
239239 end
240240end
241241
242242for _ , v in ipairs (_options .publish ) do
243243 if not _safe_exec (" iptables -t nat -C PREROUTING -p" , v .proto , " -d" , v .hAddr , " --dport" , v .hport , " -j DNAT --to-destination" , _vecIp .. " :" .. v .cport ) then
244- _exec (" iptables -t nat -A PREROUTING -p" , v .proto , " -d" , v .hAddr , " --dport" , v .hport , " -j DNAT --to-destination" , _vecIp .. " :" .. v .cport )
244+ _exec (" iptables -t nat -I PREROUTING -p" , v .proto , " -d" , v .hAddr , " --dport" , v .hport , " -j DNAT --to-destination" , _vecIp .. " :" .. v .cport )
245245 end
246246end
247247
0 commit comments