Subject: bin/26265: ipmon fails to start with ioctl(FIONREAD) Operation not ..., when there is no dns available
To: None <gnats-bugs@gnats.netbsd.org>
From: None <danielfdickinson@yahoo.ca>
List: netbsd-bugs
Date: 07/12/2004 09:58:21
>Number:         26265
>Category:       bin
>Synopsis:       ipmon fails to start with ioctl(FIONREAD) Operation not supported, when started before dns is available
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 12 16:48:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 1.6.2
>Organization:
	
>Environment:
	
	
System: NetBSD hardknottpass.estiria.net 1.6.2 NetBSD 1.6.2 (GENERIC) #0: Tue Feb 10 21:53:10 UTC 2004 autobuild@tgm.netbsd.org:/autobuild/netbsd-1-6-PATCH002/i386/OBJ/autobuild/netbsd-1-6-PATCH002/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
	ipmon fails to log packets, giving error message ioctl(FIONREAD) Operation not supported by devices when started before dns is available and the -n switch is used.

	
>How-To-Repeat:
	1) configure named to serve the local network (and host machine) 
	2) configure resolv.conf so that only this dns server is queried
	3) enable ipmon in rc.conf
	4) set up a simple ipf ruleset that passes and logs everything
	5) enable ipfilter in rc.conf
	6) reboot: ipmon will appear to start, but later in the boot the error message mentioned above will appear, and no packets will be logged
	
>Fix:
	
         replace the /etc/rc.d/ipmon with /etc/rc.d/ipmon-nodns and /etc/rc.d/ipmon-dns (see below for samples)

#!/bin/sh
#
# SAMPLE /etc/rc.d/ipmon-nodns
#

# PROVIDE: ipmon-nodns
# REQUIRE: syslogd
# BEFORE:  SERVERS

. /etc/rc.subr

name="ipmon"
rcvar=$name
command="/usr/sbin/${name}"
ipmon_flags_named=$ipmon_flags
ipmon_flags="-Ds"
command_args=""

load_rc_config $name
run_rc_command "$1"

ipmon_flags=$ipmon_flags_named

#
# End of sample /etc/rc.d/ipmon-nodns
#


#!/bin/sh
#
# SAMPLE /etc/rc.d/ipmon-dns
#

# PROVIDE: ipmon-name
# REQUIRE: syslogd named
# BEFORE:  LOGIN

. /etc/rc.subr

name="ipmon"
rcvar=$name
command="/usr/sbin/${name}"
command_args=""

load_rc_config $name
run_rc_command "$1"
#
# END OF SAMPLE /etc/rc.d/ipmon-dns

Obviously a more general solution is needed (replace named with dns? and ipmon_flags with ipmon_dns_flags and ipmon_nodns_flags?)

HTH

Daniel
>Release-Note:
>Audit-Trail:
>Unformatted: