Jeff A. Earickson <jaearick () colby ! edu> wrote:
> Installed pfil 2.0 and 4.0beta3 on a netra t1, solaris 9 +
> current patches. At boot or "ipfboot start" time I get the
> syslog message "pfil not configured for firewall/NAT operation".
> I tracked this down to the ipfboot script.
Procedure checkpfil() in ipfboot necessarily fails. It contains two bugs:
(1) qiflist=`/usr/sbin/ndd /dev/pfil qif_status 2>&1` replaces newlines
by spaces, thus "grep -v ifname" removes everything, and even if it
didn't, "while read ..." would see a single line only.
(2) The realnic values set within the "while read" loop are local to this
loop; after "done" realnic is 0 again. (I had not known this before;
seems to happen iff such a loop reads from a pipe or redirected file.)
Below, there are two suggestions how to make checkpfil() work.
Question to Darren: Shouldn't the second logmsg ("pfil not configured...")
also be followed by an "exit 1" (in the first version, preceded by
"rm -f /tmp/ckpf$$")? Or is this a tolerable, non-exit situation?
Please check!
checkpfil()
{
if [ $PFILCHECKED = yes ] ; then
return
fi
/usr/sbin/ndd /dev/pfil qif_status >/tmp/ckpf$$ # !! no 2>&1 !!
if [ $? -ne 0 ] ; then
logmsg "pfil not available to support ipfilter"
rm -f /tmp/ckpf$$
exit 1
fi
if [ `egrep -vc '^(ifname|QIF)' /tmp/ckpf$$` -eq 0 ] ; then
logmsg "pfil not configured for firewall/NAT operation"
fi
rm -f /tmp/ckpf$$
PFILCHECKED=yes
}
checkpfil()
{
if [ $PFILCHECKED = yes ] ; then
return
fi
realnic=`/usr/sbin/ndd /dev/pfil qif_status |\
awk 'BEGIN {r=9} /^ifname/ {r=0;next} /^QIF/ {next} \
{r=1;next} END {print r}'`
if [ $realnic -eq 9 ] ; then
logmsg "pfil not available to support ipfilter"
exit 1
fi
if [ $realnic -eq 0 ] ; then
logmsg "pfil not configured for firewall/NAT operation"
fi
PFILCHECKED=yes
}