/etc/init.d/ntop fails to detect missing network interface
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ntop (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: ntop
Ubuntu 8.04, ntop 3:3.2-10.1.
/etc/init.d/ntop has check_interfaces() which includes
{ echo $INTERFACES | awk -F , '{ for(i=1;i<=NF;i++) print $i }' |
while read iface ; do
if ! ifconfig "$iface" | grep -w UP >/dev/null; then
echo "ERR: interface $iface is DOWN..."
return 1
fi
done
return 0
}
return $?
It's called thus.
echo -n "Starting $DESC: "
if ! sanity_check || ! check_log_dir || ! check_interfaces; then
echo " will not start $DESC!"
exit 1
fi
start-
Running the script with `bash -x' shows it isn't working as intended.
+ ifconfig eth0
+ grep -w UP
eth0: error fetching interface information: Device not found
+ echo 'ERR: interface eth0 is DOWN...'
ERR: interface eth0 is DOWN...
+ return 1
+ return 0
+ start-stop-daemon --start --quiet --name ntop --exec /usr/sbin/ntop -- -d -L -u ntop -P /var/lib/ntop --skip-
There's a `return 1' followed by a `return 0' so the error is getting
cleared with the result that the start-stop-daemon gets to try and start
the ill-configured daemon. It's probably due to using return inside an
if-statement inside a while-statement and bash subshells.
"eth0: error fetching interface information: Device not found"
This error is from ifconfig not from ntop, the problem is that eth0 doesn't exist.
You can change the interface ntop works for in /var/lib/ ntop/init. cfg