forked from extern/shorewall_code
Add more error checking to compiled script
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@3285 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
5c89f20784
commit
87ecb8ed7d
@ -1578,7 +1578,11 @@ EOF
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ensure_and_save_command " ip route flush cache"
|
if [ $COMMAND = compile ]; then
|
||||||
|
save_command " run_ip route flush cache"
|
||||||
|
else
|
||||||
|
ensure_and_save_command " ip route flush cache"
|
||||||
|
fi
|
||||||
|
|
||||||
save_command "fi"
|
save_command "fi"
|
||||||
save_command ""
|
save_command ""
|
||||||
@ -2750,16 +2754,36 @@ setup_proxy_arp() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ $COMMAND != check ]; then
|
case $COMMAND in
|
||||||
if [ -z "$haveroute" ]; then
|
compile)
|
||||||
ensure_and_save_command "[ -n \"\$NOROUTES\" ] || ip route replace $address dev $interface"
|
if [ -z "$haveroute" ]; then
|
||||||
[ -n "$persistent" ] && haveroute=yes
|
save_command "[ -n \"\$NOROUTES\" ] || run_ip route replace $address dev $interface"
|
||||||
fi
|
[ -n "$persistent" ] && haveroute=yes
|
||||||
|
fi
|
||||||
|
|
||||||
ensure_and_save_command arp -i $external -Ds $address $external pub
|
cat >> $RESTOREBASE << __EOF__
|
||||||
|
if ! arp -i $external -Ds $address $external pub; then
|
||||||
|
fatal_error "Command \"arp -i $external -Ds $address $external pub\" failed"
|
||||||
|
fi
|
||||||
|
|
||||||
echo $address $interface $external $haveroute >> $STATEDIR/proxyarp
|
progress_message " Host $address connected to $interface added to ARP on $external"
|
||||||
fi
|
|
||||||
|
__EOF__
|
||||||
|
echo $address $interface $external $haveroute >> $STATEDIR/proxyarp
|
||||||
|
;;
|
||||||
|
check)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -z "$haveroute" ]; then
|
||||||
|
ensure_and_save_command "[ -n \"\$NOROUTES\" ] || ip route replace $address dev $interface"
|
||||||
|
[ -n "$persistent" ] && haveroute=yes
|
||||||
|
fi
|
||||||
|
|
||||||
|
ensure_and_save_command arp -i $external -Ds $address $external pub
|
||||||
|
|
||||||
|
echo $address $interface $external $haveroute >> $STATEDIR/proxyarp
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
progress_message " Host $address connected to $interface added to ARP on $external"
|
progress_message " Host $address connected to $interface added to ARP on $external"
|
||||||
}
|
}
|
||||||
@ -9024,7 +9048,7 @@ compile_firewall() # $1 = File Name
|
|||||||
#
|
#
|
||||||
ensure_and_save_command()
|
ensure_and_save_command()
|
||||||
{
|
{
|
||||||
echo "$@" >> $RESTOREBASE
|
echo $@ >> $RESTOREBASE
|
||||||
}
|
}
|
||||||
|
|
||||||
run_and_save_command()
|
run_and_save_command()
|
||||||
@ -9138,12 +9162,8 @@ else
|
|||||||
|
|
||||||
. /usr/share/shorewall/functions
|
. /usr/share/shorewall/functions
|
||||||
|
|
||||||
if [ ! -f /usr/share/shorewall/version ] || [ \$(cat /usr/share/shorewall/version) != $VERSION ]; then
|
|
||||||
error_message "This script requires Shorewall version $VERSION"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
__EOF__
|
__EOF__
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat >> $RESTOREBASE << __EOF__
|
cat >> $RESTOREBASE << __EOF__
|
||||||
@ -9239,6 +9259,18 @@ RESTOREFILE="$RESTOREFILE"
|
|||||||
|
|
||||||
STOPPING=
|
STOPPING=
|
||||||
|
|
||||||
|
__EOF__
|
||||||
|
|
||||||
|
if [ -z "$EXPORT" ]; then
|
||||||
|
cat >> $RESTOREBASE << __EOF__
|
||||||
|
if [ ! -f /usr/share/shorewall/version ] || [ \$(cat /usr/share/shorewall/version) != $VERSION ]; then
|
||||||
|
error_message "This script requires Shorewall version $VERSION"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
__EOF__
|
||||||
|
fi
|
||||||
|
cat >> $RESTOREBASE << __EOF__
|
||||||
|
|
||||||
load_kernel_modules
|
load_kernel_modules
|
||||||
|
|
||||||
__EOF__
|
__EOF__
|
||||||
|
Loading…
Reference in New Issue
Block a user