X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=debian%2Fopenvswitch-ipsec.init;h=a39dd40e686d32886947ceff02cd83aa1ce02f99;hb=ec988646afe6aee6a63d6894a3e9b50f715d5941;hp=125b50f31e7860a110dd786d39351300a143fe12;hpb=bd9e5b0e583e9d9cdcb66557ded207ed65ff379d;p=sliver-openvswitch.git diff --git a/debian/openvswitch-ipsec.init b/debian/openvswitch-ipsec.init index 125b50f31..a39dd40e6 100755 --- a/debian/openvswitch-ipsec.init +++ b/debian/openvswitch-ipsec.init @@ -24,6 +24,8 @@ # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Open vSwitch GRE-over-IPsec daemon +# Description: The ovs-monitor-ipsec script provides support for encrypting GRE +# tunnels with IPsec. ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin @@ -68,11 +70,23 @@ running() { return 0 } +uninstall_mark_rule() { + iptables -D INPUT -t mangle $1 -j MARK --set-mark 1/1 || return 0 +} + +install_mark_rule() { + if ( ! iptables -C INPUT -t mangle $1 -j MARK --set-mark 1/1 2> /dev/null); then + iptables -A INPUT -t mangle $1 -j MARK --set-mark 1/1 + fi +} + start_server() { if [ ! -d /var/run/openvswitch ]; then install -d -m 755 -o root -g root /var/run/openvswitch fi + install_mark_rule "-p esp" + install_mark_rule "-p udp --dport 4500" /usr/share/openvswitch/scripts/ovs-monitor-ipsec \ --pidfile=$PIDFILE --log-file --detach --monitor \ unix:/var/run/openvswitch/db.sock @@ -84,6 +98,8 @@ stop_server() { if [ -e $PIDFILE ]; then kill `cat $PIDFILE` fi + uninstall_mark_rule "-p esp" + uninstall_mark_rule "-p udp --dport 4500" return 0 }