#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
#
if [ -f $PIDFILE ] ; then
else
fi
logmsg()
{
logger -p daemon.warning -t ipfilter "$1"
echo "$1" >&2
}
bad=0
for file in $IPFILOVRCONF $CONF_FILES $IPFILCONF; do
if [ -r ${file} ]; then
if [ $? != 0 ]; then
echo "$0: load of ${file} into alternate" \
"set failed"
bad=1
fi
fi
done
for file in $IP6FILOVRCONF $CONF6_FILES $IP6FILCONF; do
if [ -r ${file} ]; then
if [ $? != 0 ]; then
echo "$0: load of ${file} into alternate set failed"
bad=1
fi
fi
done
ipf -s -y
return 0
else
echo "Not switching config due to load error."
return 1
fi
}
for nfile in $NAT_FILES $IPNATCONF; do
if [ -r ${nfile} ]; then
if [ $? != 0 ]; then
echo "$0: load of ${nfile} failed"
return 1
else
ipf -y
fi
fi
done
}
if [ -r ${IPPOOLCONF} ]; then
ippool -F
ippool -f ${IPPOOLCONF}
if [ $? != 0 ]; then
echo "$0: load of ${IPPOOLCONF} failed"
return 1
else
return 0
fi
else
return 0
fi
}
#
# Get current configuration version, fails if property doesn't exist.
#
{
echo "$ver"
}
#
# Version 1 configuration migration - if there's an existing ipf.conf file, set
# the default system-wide policy to "custom" and set the custom file value to
# to the current version value.
#
{
if [ -f ${old_ipfconf} ]; then
if [ $? -eq 0 ]; then
fi
fi
}
{
ipf -E
load_ippool || exit $SMF_EXIT_ERR_CONFIG
load_ipf || exit $SMF_EXIT_ERR_CONFIG
load_ipnat || exit $SMF_EXIT_ERR_CONFIG
}
#
# We handle configuration migration as well as a model change (transient to
# contract based service) in the start, stop, and refresh methods.
#
# Configuration migration is straightforward, the start method will do the
# upgrade if the repository version value is not the same as the version
# defined in ipf_include.sh However, there are two problems. First, ipfilter
# can start in parallel with manifest-import, thus the new configuration
# properties and service definition may not be available to the start method
# on the first reboot after an upgrade. Second, a transient to contract based
# model change isn't well supported for an online service.
#
# - If the start method finds the property missing (manifest-import hasn't
# 'online' and wait for manifest-import. Once manifest-import completes, the
# refresh method will run svcadm restart if the version value is not
# up-to-date and the subsequent start method will perform the upgrade.
#
# - Since the start method allows the service to stay online as a transient
# service (no contract), the svcadm restart invoked by refresh (described
# above) will result in a call to the stop method with no existing contract
# its stop method definition since startd will fail to expand that token and
# place the service in maintenance. Thus, the stop method has to explicitly
# get the contract id before calling smf_kill_contract.
#
case "$1" in
if [ $? -eq 1 ]; then
echo "Warning: firewall properties are not available"
exit $SMF_EXIT_OK
fi
;;
stop)
if [ -n "$ctid" ]; then
fi
ipf -D
;;
ipfs -l
ipf -D
if [ -f $PIDFILE ] ; then
if kill -0 $pid; then
else
fi
fi
;;
ipf -E
ipfs -R
fi
;;
if [ $? -eq 1 ]; then
echo "Warning: firewall properties are not available"
exit $SMF_EXIT_ERR_CONFIG
fi
exit $SMF_EXIT_OK
fi
;;
;;
;;
#
# The second argument is the fmri of the service to be updated.
# configuration for the entire system.
#
if [ "$2" = "$SMF_FMRI" ]; then
else
fi
;;
*)
echo "Usage: $0 \c" >&2
echo "(start|stop|reload|reipf|reipnat|pause|resume)" >&2
exit 1
;;
esac
exit $SMF_EXIT_OK