Skip to content

Commit

Permalink
VPC VR: fix empty iptables if there is no vpc tier (apache#8787)
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhouapache authored Mar 19, 2024
1 parent 720407b commit 8c62365
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions systemvm/debian/opt/cloud/bin/setup/postinit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ log_it() {
# Restart journald for setting changes to apply
systemctl restart systemd-journald

# Restore the persistent iptables nat, rules and filters for IPv4 and IPv6 if they exist
ipv4="/etc/iptables/rules.v4"
if [ -e $ipv4 ]
then
iptables-restore < $ipv4
fi

ipv6="/etc/iptables/rules.v6"
if [ -e $ipv6 ]
then
ip6tables-restore < $ipv6
fi

CMDLINE=/var/cache/cloud/cmdline
TYPE=$(grep -Po 'type=\K[a-zA-Z]*' $CMDLINE)
if [ "$TYPE" == "router" ] || [ "$TYPE" == "vpcrouter" ] || [ "$TYPE" == "dhcpsrvr" ]
Expand All @@ -52,17 +65,4 @@ do
systemctl disable --now --no-block $svc
done

# Restore the persistent iptables nat, rules and filters for IPv4 and IPv6 if they exist
ipv4="/etc/iptables/rules.v4"
if [ -e $ipv4 ]
then
iptables-restore < $ipv4
fi

ipv6="/etc/iptables/rules.v6"
if [ -e $ipv6 ]
then
ip6tables-restore < $ipv6
fi

date > /var/cache/cloud/boot_up_done

0 comments on commit 8c62365

Please sign in to comment.