#!/bin/sh
#
# Expire entries in PF tables
#

# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]; then
    . /etc/defaults/periodic.conf
    source_periodic_confs
fi

case "$expire_pf_tables_enable" in
    [Yy][Ee][Ss])
	if [ -z "$expire_pf_list" ]; then
	    echo "expire_pf_list is empty or doesn't exist"
	    rc=2
	else
	    rc=1
	    expire_pf_time_default=${expire_pf_time_default-86400}

	    echo ""
	    echo "Expiring PF tables"
	    for table in $expire_pf_list; do
		eval expire=\${expire_pf_time_${table}-"\${expire_pf_time_default}"}
		/usr/sbin/expire-table $table $expire || rc=2
	    done
	    echo "done"
	    
	fi;;

    *)  rc=0;;
esac

exit $rc

