X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=sbin%2Fgrml-sniff;h=d854f5d14e095c99449a06a8118ce8e175b30050;hb=af7e79258099000fb08013a77e1e83680ca4a59f;hp=3722c6a9b65e627bb1e0a31ecc2f7b19fd019f24;hpb=5ccffd6ee849bb7c004e464f3972bcce22beac7c;p=grml-network.git diff --git a/sbin/grml-sniff b/sbin/grml-sniff index 3722c6a..d854f5d 100755 --- a/sbin/grml-sniff +++ b/sbin/grml-sniff @@ -16,22 +16,28 @@ usage_info() einfo "Configure via $CONFIG_FILE - see man 8 grml-sniff" ; eend 0 } -if ! [ -r "$CONFIG_FILE" ] ; then - eerror "$CONFIG_FILE could not be read." - exit 1 -fi - -. "$CONFIG_FILE" - -if [ -z "$BRIDGE_DEVICES" ] ; then - eerror "Bridge devices (\$BRIDGE_DEVICES) not set in $CONFIG_FILE" - exit 1 +if [ -r "$CONFIG_FILE" ] ; then + . "$CONFIG_FILE" +else + ewarn "Could not read $CONFIG_FILE" fi +# defaults if unconfigured [ -n "$BRCTL" ] || BRCTL='brctl' [ -n "$BRIDGE_NAME" ] || BRIDGE_NAME='br0' [ -n "$BRIDGE_DEVICES" ] || BRIDGE_DEVICES='eth0 eth1' +check_devs() { + for dev in $BRIDGE_DEVICES ; do + ip link show dev "$dev" >/dev/null 2>&1 || return 1 + done +} + +if ! check_devs ; then + eerror "BRIDGE_DEVICES $BRIDGE_DEVICES do not seem to exist." >&2 + exit 1 +fi + check4progs $BRCTL || exit 1 case "$1" in