netroot: Check argument
authorPhilippe Seewer <philippe.seewer@bfh.ch>
Tue, 16 Jun 2009 09:08:40 +0000 (11:08 +0200)
committerPhilippe Seewer <philippe.seewer@bfh.ch>
Wed, 17 Jun 2009 06:37:39 +0000 (08:37 +0200)
There's no sense in running netroot without a valid first argument
and further running netroot with no interface config present isn't
good as well.

modules.d/40network/netroot

index 75313ba..a2ef22f 100755 (executable)
@@ -8,6 +8,12 @@ getarg rdnetdebug && {
     set -x
 }
 
+# Huh? Empty $1?
+[ -z "$1" ] && exit 1
+
+# Huh? No interface config?
+[ ! -e /tmp/net.$1.up ] && exit 1
+
 # Only try to configure from one network interface at a time
 #
 [ "$NETROOT_LOCKED" ] || {