#! /bin/sh
#
# Copyright (C) 2001 NetLabs SRL (ejbs@netlabs.com.uy)
#
# This file is part of wccpd.
#
# wccpd is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# wccpd is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with wccpd; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#
# Enable WCCP engine.  This script is called before any enable-cache.
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin

if [ ! -r /etc/sysconfig/wccpd ]; then
	logger "$0: No configuration file"
	exit 2
fi
. /etc/sysconfig/wccpd

DEC=`dc -e "16i${FWMARK}p"`

ipvsadm -A --fwmark-service $DEC $SERVICE_OPTS
ip rule add prio $RULEPRIO fwmark $FWMARK table $TABLE
ip route add local 0/0 dev lo table $TABLE
ip route flush table cache
