Habe es jetzt mal mit der Version über den KDE Desktop ausgeführt und bekam folgende Ausgabe:
#!/bin/bash
#
# Copyright (C) 2006,2009 <framp@linux-tips-and-tricks.de>
#
# $Id: collectNWData.sh,v 1.186 2009/12/13 18:42:45 framp Exp $
#
# Summary:
# Short script which analyzes network problems and collects network information on Linux systems.
#
# For more details and the latest version go to http://www.linux-tips-and-tricks.de/collectNWData
#
# History:
# 04/08/06 - Initial version
# 06/07/06 - Added iptables -L -vn
# 06/23/06 - Comments and empty lines removed from resolv.conf
# 06/23/06 - cat /proc/sys/net/ipv4/ip_forward added
# 07/12/06 - added -n to route and iptables -t nat -L
# 07/18/06 - added lspci, lsusb and iwconfig, pingMyLocalIPs and ping www.sue.de via name and IP
# 07/21/06 - added uname -a and query of suse version
# 07/29/06 - Introduced flags in order to control the amount of output and reduced numer of output lines
# 09/02/06 - removed bug in pingLocalIPs on German systems
# detail level can now be controlled with options
# /etc/sysconfig/network/ifcfg-* files will be included (wireless credentials are filtered)
# 09/22/06 - added masquerading of WLAN keys with test support from Rain_Maker
# 10/08/06 - added masquerading of WLAN encryption key in iwconfig with test support from Rain_Maker
# 11/03/06 V0.3.4 - added output of invocation parameters in log
# 02/03/07 V0.3.5 - added additional ouput of config files (ssh, dhcp, proxy, ...) and some usability enhancements
# 02/04/07 V0.3.6 - combined all pings and some usability enhancements
# 03/04/07 V0.4.0 - first experimental NWEliza function added, localization for German and English added
# - check for missing or invalid default gateway
# - check for missing or invalid DNS entry
# 03/11/07 V0.4.1 - check for existance of any nics and whether they miss an IP
# - check whether two different nics go into the same subnet
# 04/04/07 V0.4.2 - use lspci to check whether there is a network card available on the system
# 04/06/07 V0.4.3 - use lsmod and arp to get further info
# 04/13/07 V0.4.3.1 - minor enhancements
# 04/13/07 V0.4.3.2 - minor enhancements (progress messages)
# 05/14/07 V0.4.4 - removed restriction to SuSE distri
# 05/20/07 V0.4.4.1 - some typos removed
# 05/20/07 V0.4.4.2 - mod check corrected
# 05/25/07 V0.4.4.3 - reduced number of messages and changed progress message
# 05/29/07 V0.4.4.4 - fixed bug in checkForValidNic (no result for message returned)
# 06/01/07 V0.4.5 - NWeliza now executes all tests and doesn't terminate when the first problem was found
# Added comments and question for execution host
# 11/05/07 V0.5 - Added error message numbers. Detailed instructions how to fix the problem can be
# found on www.wiki.framp.de.
# Added self test code
# 11/18/07 V0.5.0.1 - Added automatic switch to root if script is invoked by normal user
# Added additional useful commands to get info about installed firmware (thx to Rain_Maker)
# 11/22/07 V0.5.1 - Added checks for missing firmware for WLAN cards (thx to Rain_Maker)
# 11/24/07 V0.5.1.1 - Added check for MTU
# 12/19/07 V0.5.1.2 - Added WLAN cards in check for checkForValidNic
# 01/06/08 V0.5.1.3 - MTU check done only for direct connected clients or routers, cleanup
# 01/07/08 V0.5.2 - Check for APIPA IP adresses (169.254.0.0/16) assigned to nics
# 02/04/08 V0.5.2.1 - Added pointer to nopaste phpfi.com
# 02/21/08 V0.5.2.2 - Added support for Arch Linux (thx to Rain_Maker) [messages*]
# 03/14/08 V0.5.2.3 - Added check for interface errors
# 03/14/08 V0.5.2.4 - Added check for ipv6 usage (thx to Grothesk)
# and fixed bug in checkForNicErrors (IPV6 ignored)
# and fixed bug in checkForNicsInSameSubnet (== instead of eq used in comparison)
# 03/28/08 V0.5.2.5 - Dropped www.wiki.framp.de now pointing to www.linux.framp.de
# 03/29/08 V0.5.2.6 - Added two additional useful greps (thx to Rain_Maker) and fixed bug with passed parameters to su
# 03/30/08 V0.5.2.7 - Corrected deletion of comment lines and detectFirmwareMessages now produces an message if nothing was found
# 04/02/08 V0.5.2.8 - Script now located on www.linux-tips-and-tricks.de
# 04/12/08 V0.5.2.9 - Corrected tr bug for modules and result file is now created in directory the script resides
# 04/14/08 V0.5.2.10 - Output file collectNWData.out will be written in the same directory the script was downloaded and will get ownership of the script invoker
# 04/18/08 V0.5.2.11 - Fixed division by zero in checkForNicErrors
# 04/19/08 V0.5.2.12 - Added -nn to lspci (thx to Grothesk)
# 04/20/08 V0.5.2.13 - Appended sort after lsmod (thx to Grothesk)
# 04/30/08 V0.5.2.14 - Minor fixes
# 05/27/08 V0.5.3 - Added additional wireless accesspoint topology thus WLAN info is now collected for WLAN topology only
# and shortens output for wired topologies
# and NWEliza now executes WLAN checks only for WLN topology
# and WLAN if checks and wired if checks are now separated
# and added NWEliza check checkKnetWorkManager in case of WLAN toplology (thx to Grothesk)
# and output file has now extension .txt for ease of use
# and various misc updates/minor fixes
#
# 05/29/08 V0.5.3.1 - Introduced connection type (wired/wireless) to control NWEliza
# 06/29/08 V0.6 - Refactored NWEliza into common-, wired- and wireless sections, restructure NWEliza logic and a lot of other enhancements
# 08/10/08 V0.6.1 - Added various ndiswrapper checks (thx Grothesk and rain_maker), knetworkmanager checks, dhcp error checks and NIC config checks
# 08/20/08 V0.6.1.1 - Added check for WLAN kill switch
# 08/26/08 V0.6.1.2 - Added check for ESSID
# 09/02/08 V0.6.1.3 - Added check for DHCP
# 09/06/08 V0.6.1.4 - Check for active wired connection if wireless connection should be tested and create error message
# 09/27/08 V0.6.1.5 - Public IPs and all mac addresses are masqueraded
# 09/28/08 V0.6.1.6 - Script now can be started with just one mouse click from the desktop
# 11/11/08 V0.6.1.7 - Added additional info from SuSE hwinfo command provided if hwinfo is available
# 12/04/08 V0.6.1.8 - Using dhcpcd-test to gather dhcp info
# 03/20/09 V0.6.1.9 - NWEliza uses iwlist for WLAN problem detection (thx to lwfinger)
# 05/19/09 V0.6.1.10 - Check hwinfo results for non loaded modules and inactive modules
#
# For more details and the latest version go to http://www.linux-tips-and-tricks.de/collectNWData
#################################################################################
# Make sure script runs in a console
#################################################################################
tty -s;
if [ $? -ne 0 ]; then
# konsole --noclose -T "collectNWData.sh" --vt_sz 132x25 -e "$0";
konsole -e "$0"
exit;
fi
#################################################################################
# --- various constants
#################################################################################
CVS_VERSION="V0.6.1.26"
CVS_REVISION="$Revision: 1.186 $"
CVS_DATE="$Date: 2009/12/13 18:42:45 $"
CVS_DATE_ONLY=${CVS_DATE/: /}
CVS_DATE_ONLY=${CVS_DATE_ONLY/ \$/}
CVS_REVISION_ONLY=${CVS_REVISION/: /}
CVS_REVISION_ONLY=${CVS_REVISION_ONLY/ \$}
VERSION="$CVS_VERSION (Rev: ${CVS_REVISION_ONLY}, Build: ${CVS_DATE_ONLY} UTC)"
BASEURL="www.linux-tips-and-tricks.de"
AUTHOR="framp"
CONTACT="framp@linux-tips-and-tricks.de"
HTTP_ROOT_ACCESS="http://$BASEURL/CND_rootAccess"
HTTP_UPLOAD_URL="http://$BASEURL/CND_UPL"
HELP_URL="http://$BASEURL/CND"
case $LANG in
de_*)
;;
*)
HELP_URL="${HELP_URL}#English"
HTTP_ROOT_ACCESS="${HTTP_ROOT_ACCESS}#English"
HTTP_UPLOAD_URL="${HTTP_UPLOAD_URL}#English"
;;
esac;
COPYRIGHT="Copyright (C) 2006,2009 by ${AUTHOR}"
MYSELF="${0##*/}"
CODE_BEGIN="
"
DEBUG="off"
SEPARATOR="=================================================================================================================="
MINOR_SEPARATOR="------------------------------------------------------------------------------------------------------------------"
VERSION_STRING="$MYSELF $VERSION"
LOG="/tmp/${MYSELF}$$"
HELP_WIKI="http://www.linux-tips-and-tricks.de"
NUMBER_OF_LINES_TO_CHECK_IN_VAR_LOG_MESSAGES=300
MAX_ERROR_PERCENT=30 # acceptable error rate on interfaces (xmit and rcv)
# --- get the absolute path of script such that the output file can be written in the same directory
PRG_DIR=`dirname $0`
OLD_PWD=`pwd`
cd $PRG_DIR
export CND_DIR=`pwd`
cd $OLD_PWD
if [ $UID -eq 0 ]; then
FINAL_RESULT="${CND_DIR}/${MYSELF/.sh/}.txt"
FINAL_RESULT_SHORT_NAME="${MYSELF/.sh/}.txt"
STATE="/tmp/${MYSELF}_S.$$"
ELIZA_RESULT="/tmp/${MYSELF}_E.$$"
CND_USER=$USER
else
export CND_USER=$USER # for chown at the end of script
fi
#################################################################################
# --- tools needed by the script
#
# LSUSB checked at runtime - not beforehand - because it's not installed all the time
#################################################################################
MODS="EGREP AWK SED IFCONFIG IWCONFIG IWLIST IPTABLES LSPCI GREP PERL ARP ROUTE LSMOD SORT PING TAIL"
#################################################################################
# --- cleanup files in case of failure
#################################################################################
function cleanupTempFiles {
rm -f $LOG 2>/dev/null
rm -f $ELIZA_RESULT 2>/dev/null
rm -f $STATE 2>/dev/null
}
function cleanupFiles {
rm -f $FINAL_RESULT 2>/dev/null
cleanupTempFiles
exit
}
trap 'cleanupFiles' SIGHUP SIGINT SIGPIPE SIGTERM
#################################################################################
#
# --- Messages in English and German
#
# (volunteers to translate the messages into other languages are welcome)
#
#################################################################################
MSG_UNDEFINED=0
MSG_E[$MSG_UNDEFIND]="Undefined message. Pls inform the author $CONTACT"
MSG_G[$MSG_UNDEFINED]="Unbekannte Meldung. Bitte den Author $CONTACT informieren"
MSG_ELIZA_WELCOME=1
MSG_E[$MSG_INTERNAL_ERROR]="Internal error %1 occured. Pls inform the author $CONTACT"
MSG_G[$MSG_INTERNAL_ERROR]="Interner Fehler %1 aufgetreten. Bitte den Author $CONTACT informieren"
MSG_ELIZA_START_ANALYZE=2
MSG_E[$MSG_ELIZA_START_ANALYZE]="--- NWEliza is analyzing the system for common network configuration errors ..."
MSG_G[$MSG_ELIZA_START_ANALYZE]="--- NWEliza untersucht das System nach haeufigen Netzwerkkonfigurationsfehlern untersucht ..."
MSG_START_COLLECTING=3
MSG_E[$MSG_START_COLLECTING]="--- NWCollect is collecting networkconfiguration information into file %1 ..."
MSG_G[$MSG_START_COLLECTING]="--- NWCollect sammelt Netzwerkkonfigurationsinformationen in Datei %1 ..."
MSG_CON_WRL=4
MSG_E[$MSG_CON_WRL]="--- (2) Wireless connection (WLAN)"
MSG_G[$MSG_CON_WRL]="--- (2) Kabellose Verbindung (WLAN)"
MSG_EMPTY_LINE=5
MSG_E[$MSG_EMPTY_LINE]=""
MSG_G[$MSG_EMPTY_LINE]=""
MSG_MAIN_SUSE_ONLY=6
MSG_E[$MSG_MAIN_SUSE_ONLY]="!!! Script tested on SuSE systems only. Data collection and analysis steps may fail and is ignored!"
MSG_G[$MSG_MAIN_SUSE_ONLY]="!!! Das Script wurde nur auf SuSE Installationen getestet. Datensammlungs- und Analyseschritte können abbrechen und werden uebersprungen!"
MSG_MAIN_PROG_REQUIRED=7
MSG_E[$MSG_MAIN_PROG_REQUIRED]="!!! Program %1 not found. Install program and invoke script again"
MSG_G[$MSG_MAIN_PROG_REQUIRED]="!!! Das Programm %1 ist nicht verfuegbar. Das Programm nachinstallieren und das Script danach noch einmal ausfuehren"
MSG_MAIN_NO_ERROR_DETECTED=8
MSG_E[$MSG_MAIN_NO_ERROR_DETECTED]="--- No obvious errors/warnings detected. Post contents of file %1 in your favorite Linux forum and read $HTTP_UPLOAD_URL"
MSG_G[$MSG_MAIN_NO_ERROR_DETECTED]="--- Keine offensichtlichen Konfigurationsfehler/-warnungen gefunden. Die Datei %1 im bevorzugten Linux Forum posten und $HTTP_UPLOAD_URL lesen."
MSG_MAIN_ERROR_DETECTED=9
#MSG_E[$MSG_MAIN_ERROR_DETECTED]="--- %1 errors detected"
#MSG_G[$MSG_MAIN_ERROR_DETECTED]="--- %1 Fehler gefunden"
MSG_MAIN_VERSION=10
MSG_E[$MSG_MAIN_VERSION]="%1 %2 %3 %4 %5 %6 %7 %8 %9 %10"
MSG_G[$MSG_MAIN_VERSION]="%1 %2 %3 %4 %5 %6 %7 %8 %9 %10"
MSG_GET_TOPLOLOGY=11
MSG_E[$MSG_GET_TOPOLOGY]="--- What's the type of networktopology?"
MSG_G[$MSG_GET_TOPOLOGY]="--- Welche Netzwerktopologie liegt vor?"
MSG_UNSUPPORTED_TOPOLOGY=12
MSG_E[$MSG_UNSUPPORTED_TOPOLOGY]="--- Unknown topology"
MSG_G[$MSG_UNSUPPORTED_TOPOLOGY]="--- Netzwerktopology unbekannt"
MSG_STRING=13
MSG_E[$MSG_STRING]="%1."
MSG_G[$MSG_STRING]="%1."
MSG_PLEASE_CORRECT_ANSWER=14
MSG_E[$MSG_PLEASE_CORRECT_ANSWER]="--- Please answer with 1-%1: "
MSG_G[$MSG_PLEASE_CORRECT_ANSWER]="--- Bitte mit 1-%1 anworten: "
MSG_TOPO_DM_LC=15
MSG_E[$MSG_TOPO_DM_LC]="--- (1) DSL modem <---> LinuxClient"
MSG_G[$MSG_TOPO_DM_LC]="--- (1) DSL modem <---> LinuxClient"
MSG_TOPO_DR_LC=16
MSG_E[$MSG_TOPO_DR_LC]="--- (2) DSL HW router <---> LinuxClient"
MSG_G[$MSG_TOPO_DR_LC]="--- (2) DSL HW router <---> LinuxClient"
MSG_TOPO_DM_LR_LC=17
MSG_E[$MSG_TOPO_DM_LR_LC]="--- (3) DSL modem <---> LinuxRouter <---> LinuxClient"
MSG_G[$MSG_TOPO_DM_LR_LC]="--- (3) DSL modem <---> LinuxRouter <---> LinuxClient"
MSG_TOPO_DR_LR_LC=18
MSG_E[$MSG_TOPO_DR_LR_LC]="--- (4) DSL HW router <---> LinuxRouter <---> LinuxClient"
MSG_G[$MSG_TOPO_DR_LR_LC]="--- (4) DSL HW router <---> LinuxRouter <---> LinuxClient"
MSG_MAIN_POST_FILE=27
MSG_E[$MSG_MAIN_POST_FILE]="--- If you still don't have success then post the contents of file %1 in the net (see $HTTP_UPLOAD_URL for links) and then the nopaste link on your favorite Linux forum. "
MSG_D[$MSG_MAIN_POST_FILE]="--- Wenn das nicht zum Erfolg führt sollte der Inhalt der Datei %1 im Netz gepostet werden (Links siehe $HTTP_UPLOAD_URL) und dann der nopaste Link im bevorzugten Linux Forum."
MSG_GET_HOST=29
MSG_E[$MSG_GET_HOST]="--- On which host is the script executed?"
MSG_G[$MSG_GET_HOST]="--- Auf welchem Rechner wird das Script ausgefuehrt?"
MSG_UNSUPPORTED_HOST=30
MSG_E[$MSG_UNSUPPORTED_HOST]="--- Invalid host"
MSG_G[$MSG_UNSUPPORTED_HOST]="--- Ungültiger Rechner"
MSG_HOST_RT=31
MSG_E[$MSG_HOST_RT]="--- (2) LinuxRouter"
MSG_G[$MSG_HOST_RT]="--- (2) LinuxRouter"
MSG_HOST_CL=32
MSG_E[$MSG_HOST_CL]="--- (1) LinuxClient"
MSG_G[$MSG_HOST_CL]="--- (1) LinuxClient"
MSG_MAIN_BECOME_ROOT=33
MSG_E[$MSG_MAIN_BECOME_ROOT]="--- Script has to be executed as root. Please enter the root password. If you have any concerns to execute the script as root please read $HTTP_ROOT_ACCESS"
MSG_G[$MSG_MAIN_BECOME_ROOT]="--- Das Script muss als root ausgefuehrt werden. Bitte jetzt das root Kennwort eingeben. Falls Bedenken existieren das Script als root auszufuehren bitte $HTTP_ROOT_ACCESS lesen."
MSG_CON_WRD=40
MSG_E[$MSG_CON_WRD]="--- (1) Wired connection"
MSG_G[$MSG_CON_WRD]="--- (1) Kabelgebundene Verbindung"
MSG_GET_CONNECTION=41
MSG_E[$MSG_GET_CONNECTION]="--- Which type of your network connection should be tested?"
MSG_G[$MSG_GET_CONNECTION]="--- Welcher Netzwerkverbindungtyp soll getestet werden?"
MSG_UNSUPPORTED_CONNECTION=42
MSG_E[$MSG_UNSUPPORTED_CONNECTION]="--- Unknown network connection type"
MSG_G[$MSG_UNSUPPORTED_CONNECTION]="--- Netzwerkverbindungstyp unbekannt"
MSG_MAIN_WARNING_DETECTED=43
#MSG_E[$MSG_MAIN_WARNING_DETECTED]="--- %1 warnings detected"
#MSG_G[$MSG_MAIN_WARNING_DETECTED]="--- %1 Warnungen gefunden"
MSG_MAIN_GOTO_LINK=44
MSG_E[$MSG_MAIN_GOTO_LINK]="--- Go to ${HELP_URL} to get more detailed instructions about the error/warning messages and how to fix the problems on your own"
MSG_G[$MSG_MAIN_GOTO_LINK]="--- Gehe zu ${HELP_URL} um detailiertere Hinweise zu den Fehlermeldungen/Warnungen zu bekommen und wie die Fehler selbst beseitigt werden koennen"
MSG_TOPO_AP_LC=46
MSG_E[$MSG_TOPO_AP_LC]="--- (1) WLAN access point <---> LinuxClient"
MSG_G[$MSG_TOPO_AP_LC]="--- (1) WLAN access point <---> LinuxClient"
MSG_TOPO_WR_LC=47
MSG_E[$MSG_TOPO_WR_LC]="--- (2) WLAN HW router <---> LinuxClient"
MSG_G[$MSG_TOPO_WR_LC]="--- (2) WLAN HW router <---> LinuxClient"
MSG_TOPO_AP_LR_LC=48
MSG_E[$MSG_TOPO_AP_LR_LC]="--- (3) WLAN access point <---> LinuxRouter <---> LinuxClient"
MSG_G[$MSG_TOPO_AP_LR_LC]="--- (3) WLAN access point <---> LinuxRouter <---> LinuxClient"
MSG_TOPO_WR_LR_LC=49
MSG_E[$MSG_TOPO_WR_LR_LC]="--- (4) WLAN HW router <---> LinuxRouter <---> LinuxClient"
MSG_G[$MSG_TOPO_WR_LR_LC]="--- (4) WLAN HW router <---> LinuxRouter <---> LinuxClient"
MSG_WLAN_CON_NOESSID=59
#
# empty
#
MSG_START_WRITING=62
#MSG_E[$MSG_START_WRITING]="--- Writing networkconfiguration information into file %1 ..."
#MSG_G[$MSG_START_WRITING]="--- Netzwerkkonfigurationsinformationen werden in Datei %1 geschrieben ..."
MSG_MASQ_IP=63
#MSG_E[$MSG_MASQ_IP]="--- Masqueraded %1 IP addresses"
#MSG_G[$MSG_MASQ_IP]="--- %1 öffentliche IPs maskiert"
MSG_MASQ_MAC=64
#MSG_E[$MSG_MASQ_MAC]="--- Masqueraded %1 MAC addresses"
#MSG_G[$MSG_MASQ_MAC]="--- %1 MAC Addressen maskiert"
MSG_MASQ_ESSID=65
#MSG_E[$MSG_MASQ_ESSID]="--- Masqueraded %1 ESSIDs"
#MSG_G[$MSG_MASQ_ESSID]="--- %1 ESSIDs maskiert"
#
#
#
MSG_NO_NIC_FOUND=300
MSG_E[$MSG_NO_NIC_FOUND]="!!! CND0100E: No network card for the selected connection type was found on the system"
MSG_D[$MSG_NO_NIC_FOUND]="!!! CND0100E: Keine Netzwerkkarte für den gewählten Verbindungstyp kann auf dem System gefunden werden"
MSG_NO_VALID_NI_FOUND=301
MSG_E[$MSG_NO_VALID_NI_FOUND]="!!! CND0110E: For the selected connection type there was no active network interface found on your system"
MSG_D[$MSG_NO_VALID_NI_FOUND]="!!! CND0110E: Es wurde keine aktives Netzwerkinterface auf dem System für der gewaehlten Verbindungstyp gefunden"
MSG_NO_IP_ASSIGNED_TO_NIC=302
MSG_E[$MSG_NO_IP_ASSIGNED_TO_NIC]="!!! CND0120E: Network card %1 has no IP address"
MSG_D[$MSG_NO_IP_ASSIGNED_TO_NIC]="!!! CND0120E: Die Netzwerkkarte %1 hat keine IP Adresse"
MSG_DUPLICATE_NETWORKS=303
MSG_E[$MSG_DUPLICATE_NETWORKS]="!!! CND0130E: There is more than one network card defined in the same subnet: %1"
MSG_D[$MSG_DUPLICATE_NETWORKS]="!!! CND0130E: Es ist mehr als eine Netzwerkkarte im selben Subnetz definiert: %1"
MSG_NO_DEFAULT_GATEWAY_SET=304
MSG_E[$MSG_NO_DEFAULT_GATEWAY_SET]="!!! CND0140E: No default gateway set on your system"
MSG_G[$MSG_NO_DEFAULT_GATEWAY_SET]="!!! CND0140E: Kein default gateway auf dem System definiert"
MSG_CHECK_DEFAULT_GATEWAY_SETTING=305
MSG_E[$MSG_CHECK_DEFAULT_GATEWAY_SETTING]="!!! CND0150E: There might be problems with the default gateway definition %1 on interface %2"
MSG_G[$MSG_CHECK_DEFAULT_GATEWAY_SETTING]="!!! CND0150E: Es kann ein Problem mit der default gateway definition %1 am Interface %2 vorliegen"
MSG_NAMESERVER_NOT_ACCESSIBLE=306
MSG_E[$MSG_NAMESERVER_NOT_ACCESSIBLE]="!!! CND0160E: Unable to access nameserver with IP %1 defined in /etc/resolv.conf"
MSG_G[$MSG_NAMESERVER_NOT_ACCESSIBLE]="!!! CND0160E: Auf den definierter Nameserver mit der IP %1 in /etc/resolv.conf kann nicht zugegriffen werden"
MSG_NO_NAMESERVER_DEFINED=307
MSG_E[$MSG_NO_NAMESERVER_DEFINED]="!!! CND0170E: No nameserver defined in /etc/resolv.conf"
MSG_G[$MSG_NO_NAMESERVER_DEFINED]="!!! CND0170E: Kein Nameserver in /etc/resolv.conf definiert"
MSG_CANT_PING_EXTERNAL_IP=308
MSG_E[$MSG_CANT_PING_EXTERNAL_IP]="!!! CND0180I: The system can't ping external IP address %1"
MSG_G[$MSG_CANT_PING_EXTERNAL_IP]="!!! CND0180I: Das System kann die externe IP %1 nicht pingen"
MSG_POSSIBLE_WLAN_FIRMWARE_PROBLEMS=309
MSG_E[$MSG_POSSIBLE_WLAN_FIRMWARE_PROBLEMS]="!!! CND0190E: WLAN firmware is missing or cannot be loaded"
MSG_G[$MSG_POSSIBLE_WLAN_FIRMWARE_PROBLEMS]="!!! CND0190E: WLAN Firmware fehlt oder kann nicht geladen werden"
MSG_POSSIBLE_MTU_PROBLEMS=310
MSG_E[$MSG_POSSIBLE_MTU_PROBLEMS]="!!! CND0200W: Maximum possible MTU is %1, but actual MTU on nic %2 is %3"
MSG_G[$MSG_POSSIBLE_MTU_PROBLEMS]="!!! CND0200W: Die maximal ermittelte MTU ist %1, aber die aktuelle MTU an der Netzwerkkarte %2 ist %3"
MSG_APIPA_DETECTED=311
MSG_E[$MSG_APIPA_DETECTED]="!!! CND0210W: APIPA IP address %1 detected on network card %2"
MSG_G[$MSG_APIPA_DETECTED]="!!! CND0210W: APIPA IP Adresse %1 wurde an Netzwerkkarte %2 entdeckt"
MSG_NIC_ERRORS=312
MSG_E[$MSG_NIC_ERRORS]="!!! CND0220W: Serious transmissionerrors on network interface %1 detected"
MSG_G[$MSG_NIC_ERRORS]="!!! CND0220W: Ungewoehnlich viele Uebertragungsfehler am Interface %1 entdeckt"
MSG_IPV6_DETECTED=313
MSG_E[$MSG_IPV6_DETECTED]="!!! CND0230W: IPV6 enabled"
MSG_G[$MSG_IPV6_DETECTED]="!!! CND0230W: IPV6 ist eingeschaltet"
MSG_KNETWORKMANAGER_ERROR=314
MSG_E[$MSG_KNETWORKMANAGER_ERROR]="!!! CND0240E: knetworkmanager for network configuration enabled but a YAST network card configuration for %1 exist"
MSG_G[$MSG_KNETWORKMANAGER_ERROR]="!!! CND0240E: Knetworkmanager wird fuer die Netzwerkkonfiguration benutzt aber eine YAST Netzwerkkartenkonfiguration für %1 existiert"
MSG_CANT_LOOKUP_EXTERNAL_DNS=315
MSG_E[$MSG_CANT_LOOKUP_EXTERNAL_DNS]="!!! CND0250E: The system can't lookup external DNS name %1"
MSG_G[$MSG_CANT_LOOKUP_EXTERNAL_DNS]="!!! CND0250E: Das System kann den externen Namen %1 nicht aufloesen"
MSG_NDISWRAPPER_PROB=316
MSG_E[$MSG_NDISWRAPPER_PROB]="!!! CND0260E: ndiswrapper for %1 can't be used in parallel with linux native driver %2"
MSG_G[$MSG_NDISWRAPPER_PROB]="!!! CND0260E: ndiswrapper für %1 kann nicht gemeinsam mit dem linux Treiber %2 benutzt werden"
MSG_NDISWRAPPER_FW_PROB=317
MSG_E[$MSG_NDISWRAPPER_FW_PROB]="!!! CND0270E: Used windows driver %1 was either not installed completely (e.g. sys files are missing) or is from a wrong windows version (e.g. Win 98 instead of XP)"
MSG_G[$MSG_NDISWRAPPER_FW_PROB]="!!! CND0270E: Der verwendete Windowstreiber %1 wurde entweder nicht vollständig installiert (Treiberbestandteile fehlen z.B. sys Dateien) oder ist von der falschen Windows-Version (z.B. Win 98 statt XP)"
MSG_NDISWRAPPER_ARCH_PROB=318
MSG_E[$MSG_NDISWRAPPER_ARCH_PROB]="!!! CND0280E: Inkompatible windows driver architecture of %1 and Linux architecture (32 bit and 64 bit architecture mixed)"
MSG_G[$MSG_NDISWRAPPER_ARCH_PROB]="!!! CND0280E: Inkompatible Windowstreiber Architektur von %1 und Linux Architektur (32 Bit und 64 Bit Architektur gemischt)"
MSG_NO_NIC_CONFIG_FOUND=319
MSG_E[$MSG_NO_NIC_CONFIG_FOUND]="!!! CND0290E: No network configuration found for interface %1"
MSG_G[$MSG_NO_NIC_CONFIG_FOUND]="!!! CND0290E: Keine Netzwerkkonfiguration für Interface %1 gefunden"
MSG_NO_DHCP_FOUND=320
MSG_E[$MSG_NO_DHCP_FOUND]="!!! CND0300E: No dhcp server found on interface %1"
MSG_G[$MSG_NO_DHCP_FOUND]="!!! CND0300E: Keinen dhcp Server am Interface %1 gefunden"
MSG_IFUP_CONFIGURED=321
MSG_E[$MSG_IFUP_CONFIGURED]="!!! CND0310W: Classic network configuration with ifup was detected. Configuration with knetworkmanager is much easier"
MSG_G[$MSG_IFUP_CONFIGURED]="!!! CND0310W: Klassische Netzwerkkonfiguration mit ifup wurde entdeckt. Die Konfiguration mit knetworkmanager ist wesentlich einfacher"
MSG_WLAN_KILL_SWITCH_ON=322
MSG_E[$MSG_WLAN_KILL_SWITCH_ON]="!!! CND0320E: WLAN turned off by hardware or software switch"
MSG_G[$MSG_WLAN_KILL_SWITCH_ON]="!!! CND0320E: WLAN ist mit dem Hardware oder Software Switch ausgeschaltet"
MSG_WLAN_AUTH_PROBS=323
MSG_E[$MSG_WLAN_AUTH_PROBS]="!!! CND0330E: WLAN credential problems exist on interface %1"
MSG_G[$MSG_WLAN_AUTH_PROBS]="!!! CND0330E: Es existierern Schluesselprobleme am Interface %1"
MSG_NO_DHCP_DETECTED=324
MSG_E[$MSG_NO_DHCP_DETECTED]="!!! CND0350W: dhcp server may not available on interface %1"
MSG_G[$MSG_NO_DHCP_DETECTED]="!!! CND0350W: Ein dhcp Server scheint nicht am Interface %1 zu existieren"
MSG_WLAN_WIRED_ONLINE=325
MSG_E[$MSG_WLAN_WIRED_ONLINE]="!!! CND0360E: Wireless connection tested with an existing wired connection on interface %1. Unplug the cable and execute the script again"
MSG_G[$MSG_WLAN_WIRED_ONLINE]="!!! CND0360E: Eine drahtlose Verbindung wurde getestet obwohl eine kabelgebundene Verbindung am Interface %1 existiert . Das Netzwerkkabel ausstecken und das Script noch einmal starten"
MSG_CANT_PING_EXTERNAL_DNS=326
MSG_E[$MSG_CANT_PING_EXTERNAL_DNS]="!!! CND0370I: The system can't ping external DNS name %1"
MSG_G[$MSG_CANT_PING_EXTERNAL_DNS]="!!! CND0370I: Das System kann den externen DNS Namen %1 nicht pingen"
MSG_WLAN_NO_SCAN=327
MSG_E[$MSG_WLAN_NO_SCAN]="!!! CND0380E: No WLANs detected on interface %1. Hardware and/or driver not configured properly"
MSG_G[$MSG_WLAN_NO_SCAN]="!!! CND0380E: Es wurden keine WLANs am Interface %1 gefunden. Die Hardware und/oder Treiber ist nicht richtig konfiguriert"
MSG_HW_NO_ACTIVE=328
MSG_E[$MSG_HW_NO_ACTIVE]="!!! CND0390E: No loaded module detected for interface %1"
MSG_G[$MSG_HW_NO_ACTIVE]="!!! CND0390E: Kein Module am Interface %1 geladen"
MSG_HW_SOME_INACTIVE=329
MSG_E[$MSG_HW_SOME_INACTIVE]="!!! CND0400W: Alternate modules %1 detected for interface %2"
MSG_G[$MSG_HW_SOME_INACTIVE]="!!! CND0400W: Es existieren weitere moegliche Module %1 für Interface %2"
MSG_NAMESERVER_NOT_VALID=330
MSG_E[$MSG_NAMESERVER_NOT_VALID]="!!! CND0410E: Configured nameserver with IP %1 is no nameserver"
MSG_G[$MSG_NAMESERVER_NOT_VALID]="!!! CND0410E: Der konfigurierte Nameserver mit der IP %1 ist kein Nameserver"
MSG_NAMESERVER_PROBLEM_UNKNOWN=331
MSG_E[$MSG_NAMESERVER_PROBLEM_UNKNOWN]="!!! CND0420E: There exists a problem with configured nameserver with IP %1"
MSG_G[$MSG_NAMESERVER_PROBLEM_UNKNOWN]="!!! CND0420E: Es gibt ein Problem mit dem konfigurierten Nameserver mit der IP %1"
#################################################################################
# Debug helper
#################################################################################
function debug() { # message
if [[ $DEBUG == "on" ]]; then
echo "@@@ $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10}"
fi
}
function state() { # message
echo "${1}${2}${3}${4}${5}${6}${7}${8}${9}${10}" >> $STATE
}
#################################################################################
# message & console handling
#################################################################################
# --- Writes a message to the console without an NL
function writeToConsoleNoNL() { # messagenumber
local msg
msg=`getMessage $*`
echo -n $msg >> /dev/tty
}
# --- Writes a message to the console
function writeToConsole() { # messagenumber
local msg
msg=`getMessage $*`
echo $msg >> /dev/tty
}
# --- Creates a progress bar on the console
function processingMessage() { #number #maxnumber #activity
local i
local m
local p
local ip
local mx
m=$1
echo -ne "\r \r" >> /dev/tty
if [[ $m != 0 ]]; then
let ip=($m+1)
let p=$ip*100/$2
echo -n "($p%) "
# for ((i=0;$i<=$m;i++)); do
# echo -ne "."
# done
# echo -e " - Executing \" $3 \""
fi
}
# ---Writes a messages to the NWEliza log and console
function writeToEliza() { # messagenumber
local severity
local msg
msg=`getMessage $*`
echo $msg >> $ELIZA_RESULT
echo $msg >> /dev/tty
severity=`echo $msg | cut -d " " -f 2`
if [[ `echo $severity | $EGREP "CND[0-9]+E"` ]]; then
let askEliza_error=$askEliza_error+1
fi
if [[ `echo $severity | $EGREP "CND[0-9]+W"` ]]; then
let askEliza_warning=$askEliza_warning+1
fi
}
# ---Writes a messages to the NWEliza log
function writeToElizaOnly() { # messagenumber
local msg
msg=`getMessage $*`
echo $msg >> $ELIZA_RESULT
}
# --- Helper function to extract the message text in German or English and insert message parameters
function getMessage() { # messagenumber parm1 parm2 ...
local msg
local p
local i
local s
case $LANG in
de_*)
msg=${MSG_G[$1]}; # german
;;
*)
msg=${MSG_E[$1]}; # english
;;
esac;
for (( i=2; $i <= $#; i++ )); do # substitute all message parameters
p="p=\${$i}"
eval $p
let s=$i-1
s="%$s"
msg=`$AWK -v msg="$msg" -v s=$s -v p=$p "BEGIN { sub(s,p,msg); print msg } "`
done
msg=`echo $msg | perl -p -e "s/%[0-9]+//g"` # delete trailing %n definitions
echo $msg
}
#################################################################################
# --- Check whether pings are possible
#
# --- Ping www.suse.de with it's IP address
# --- return 1 if ip ping failed
# --- return 0 otherwise
#
#################################################################################
function checkIPPings() {
debug ">>checkIPPings"
local I
local PING_RES
local C
local rc=0
MY_IPS="195.135.220.3" # www.suse.de
for I in $MY_IPS; do
C=`$PING -c 3 -W 3 $I 2>&1`
PING_RES=`echo $C | grep " 0%"`
pingRC=$?
if [[ $pingRC != 0 ]]; then
writeToEliza $MSG_CANT_PING_EXTERNAL_IP $I
let rc=1
fi
done
state "PNG:$rc"
debug "<<checkIPPings $rc"
return $rc
}
#################################################################################
# --- Execute ping tests
#
# --- Ping www.suse.de with it's IP address and dns name
#################################################################################
function pingTests() {
local I
local PING_RES
local C
MY_IPS="195.135.220.3 www.suse.de"
for I in $MY_IPS; do
C="ping -c 3 -W 3 $I"
PING_RES=`$C | grep " 0%"`
if [[ -z $PING_RES ]]; then
echo "Ping of $I failed"
else
echo "Ping of $I OK"
fi
done
return
}
#################################################################################
# --- Execute dhcp tests
#
# --- execute dhcpcd-test against interfaces
#################################################################################
function dhcpTests() {
local i
local C
local R
i=1
while [[ $i -le $INTERFACE_NO ]]; do
if [[ $CONNECTION == $CONNECTION_WRL && ${INTERFACE_TYPE[$i]} == $CONNECTION_WRL ]] ||
[[ $CONNECTION == $CONNECTION_WRD && ${INTERFACE_TYPE[$i]} == $CONNECTION_WRD ]]; then
C=`dhcpcd-test -t 3 ${INTERFACE_NAME[$i]} 2>/dev/null`
R=`echo $C | grep 'offered'`
if [[ $? == 0 ]]; then
echo "${INTERFACE_NAME[$i]}: DHCP server available"
else
echo "${INTERFACE_NAME[$i]}: No DHCP server detected"
fi
fi
let i=i+1
done
return
}
#################################################################################
# check whether dhcp is configured either with a config file or by using knetworkmanager if there is no IP address
#
# return 0 if no dhcp was configured
# return 1 if dhcp was configured for wired connection
# return 2 if dhcp was configured for wireless connection
#################################################################################
function checkDHCP() {
local rc=0
local conf=0
local C
local R
debug ">>checkDHCP"
C=`$EGREP -i 'NETWORKMANAGER.*=.*yes' /etc/sysconfig/network/config `
knme=$?
i=1
while [[ $i -le $INTERFACE_NO ]]; do
if [[ $CONNECTION == $CONNECTION_WRL && ${INTERFACE_TYPE[$i]} == $CONNECTION_WRL ]] ||
[[ $CONNECTION == $CONNECTION_WRD && ${INTERFACE_TYPE[$i]} == $CONNECTION_WRD ]]; then
if [[ ${INTERFACE_IP[$i]} == "" ]]; then # no IP address
fileName="/etc/sysconfig/network/ifcfg-${INTERFACE_NAME[$i]}";
conf=0
if [[ -e $fileName ]]; then # exists config file?
C=`$EGREP -i 'BOOTPROTO.*=.*dhcp' $fileName ` # dhcp configured?
if [[ $? == 0 ]]; then # yes
conf=1
fi
fi
if [[ $knme == 0 && $conf == 0 ]] || [[ $knme != 0 && $conf == 1 ]]; then # dhcp configured
C=`dhcpcd-test -t 3 ${INTERFACE_NAME[$i]} 2>/dev/null`
R=`echo $C | grep 'offered'`
if [[ $? == 1 ]]; then
writeToEliza $MSG_NO_DHCP_FOUND ${INTERFACE_NAME[$i]} # no dhcp found
if [[ $CONNECTION == $CONNECTION_WRL ]]; then
rc=2
else
rc=1
fi
fi
fi
fi
fi
let i=i+1
done
state "DHCP:$rc"
debug "<<checkDHCP $rc"
}
#################################################################################
# --- Execute dns tests
#
# --- Ping www.suse.de with it's dns name
# --- return 1 if dns ping didn't get a response
# --- return 2 if dns ping failed because of missing dns
# --- return 0 otherwise
#
#################################################################################
function checkDNS() {
debug ">>checkDNS"
local I
local PING_RES
local C
local rc=0
local name="www.suse.de"
# ping: unknown host www.suse.de
C=`$PING -c 1 -W 3 $name 2>&1`
pingRC=$?
if [[ $pingRC == 2 ]]; then
writeToEliza $MSG_CANT_LOOKUP_EXTERNAL_DNS $name
fi
if [[ $pingRC == 1 ]]; then
writeToEliza $MSG_CANT_PING_EXTERNAL_DNS $name
fi
state "DNS:$pingRC"
debug "<<checkDNS $pingRC"
return $pingRC
}
#################################################################################
#
# detect all interfaces available on system with ifconfig and identify wireless interfaces with iwconfig
#
# result: 1 based array
# INTERFACE_NO: number of interfaces detected
# INTERFACE_NAME: name of interface (ethx, wlany, ...)
# INTERFACE_IP: ipaddress of interface (empty if no IP address found)
# INTERFACE_MAC: mac address of interface
# INTERFACE_WRL_NO: number of wireless interfaces detect
# INTERFACE_RCV_ERROR: receive errors (%)
# INTERFACE_XMT_ERROR: xmit errors (%)
# INTERFACE_TYPE: either $CONNECTION_WRD or $CONNECTION_WRL
# if $INTERFACE_TYPE == $CONNECTION_WRL
# INTERFACE_ESSID: ESSID
# INTERFACE_MODE: mode of interface
# INTERFACE_ACCESS_POINT: access point mac
# INTERFACE_KEY: wireless key
#
# return number of interfaces found for the selected connection type
#
#################################################################################
function detectInterfaces () {
local q
local i
local j
local k
local rc
local interface
local element
INTERFACE_NAME=()
INTERFACE_IP=()
INTERFACE_MAC=()
INTERFACE_RCV_ERROR=()
INTERFACE_XMT_ERROR=()
INTERFACE_ESSID=()
INTERFACE_MODE=()
INTERFACE_AP=()
INTERFACE_KEY=()
INTERFACE_TYPE=()
INTERFACE_WRL_NO=0
INTERFACE_WRD_NO=0
INTERFACE_NO=0
debug ">>detectInterfaces"
#eth0 Link encap:Ethernet HWaddr 00:1E:37:21:38:F8
# inet addr:192.168.0.4 Bcast:192.168.0.255 Mask:255.255.255.0
# inet6 addr: fe80::21e:37ff:fe21:38f8/64 Scope:Link
# UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
# RX packets:223 errors:0 dropped:0 overruns:0 frame:0
# TX packets:208 errors:0 dropped:0 overruns:0 carrier:0
# collisions:0 txqueuelen:100
# RX bytes:126331 (123.3 Kb) TX bytes:22788 (22.2 Kb)
# Base address:0x3000 Memory:ee000000-ee020000
# return a list of tokens
# tokens separated by ?, list separated by %
# return number of interfaces found
q=`$IFCONFIG | $AWK ' BEGIN { numberOfNics=0; result=""; }
/^.*(eth|ath|wlan|ra)[0-9].*:Ethernet/ { name = $1;
mac = $5
numberOfNics++;
getline;
# line with IPV4 infos?
if ($1 == "inet") {
match($2,"[0-9]+.[0-9]+.[0-9]+.[0-9]+")
ip=substr($2,RSTART,RLENGTH);
match($3,"[0-9]+.[0-9]+.[0-9]+.[0-9]+")
bc=substr($3,RSTART,RLENGTH);
match($4,"[0-9]+.[0-9]+.[0-9]+.[0-9]+")
nm=substr($4,RSTART,RLENGTH);
getline;
}
# line with IPV6 infos? - skip IPV6 infos
if (match($0,"inet6")) { # skip inet6 address
getline;
}
getline;
match($2,"[0-9]+")
rcv=substr($2,RSTART,RLENGTH);
rcv_error=0
if (rcv > 0) {
match($3,"[0-9]+")
rcv_err=substr($3,RSTART,RLENGTH);
perc=rcv_err/rcv*100;
rcv_error = perc
}
getline;
match($2,"[0-9]+")
xmt=substr($2,RSTART,RLENGTH);
xmt_error=0
if (xmt > 0) {
match($3,"[0-9]+")
xmt_err=substr($3,RSTART,RLENGTH);
perc=xmt_err/xmt*100;
xmt_error=perc
}
if ( result != "" ) {
result=result "%"
}
result=result name "?" mac "?" ip "?" rcv_error "?" xmt_error
name=""
mac=""
ip=""
rcv_error=""
xmt_error=""
}
END { print result
exit numberOfNics
}
'`
INTERFACE_WRD_NO=$?
INTERFACE_NO=$INTERFACE_WRD_NO
IFS_OLD=$IFS
IFS="%"
i=0
for interface in $q; do
let i=i+1
INTERFACE_TYPE[$i]=$CONNECTION_WRD
IFS="?"
j=0
for element in $interface; do
case $j in
0) INTERFACE_NAME[$i]=$element
debug "Interface $element detected";;
1) INTERFACE_MAC[$i]=$element
debug "Interface ${INTERFACE_NAME[$i]}: Mac $element detected";;
2) INTERFACE_IP[$i]=$element
debug "Interface ${INTERFACE_NAME[$i]}: IP $element detected";;
3) INTERFACE_RCV_ERROR[$i]=$element
debug "Interface ${INTERFACE_NAME[$i]}: RCV $element detected";;
4) INTERFACE_XMT_ERROR[$i]=$element
debug "Interface ${INTERFACE_NAME[$i]}: XMT $element detected";;
*) writeToElizaOnly $MSG_INTERNAL_ERROR;;
esac
let j=j+1
done
done
IFS=$IFS_OLD
# eth0 no wireless extensions.
#wlan0 unassociated ESSID

ff/any
# Mode:Managed Frequency=nan kHz Access Point: Not-Associated
# Bit Rate:0 kb/s Tx-Power:16 dBm
# Retry limit:15 RTS thr

ff Fragment thr

ff
# Encryption key

ff
# Power Management

ff
# Link Quality:0 Signal level:0 Noise level:0
# Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
# Tx excessive retries:0 Invalid misc:220 Missed beacon:0
#wlan0 IEEE 802.11g ESSID:"ESSID"
# Mode:Managed Frequency:2.462 GHz Access Point: 00:14:6C:E5:F7:1F
# Bit Rate:36 Mb/s Tx-Power:15 dBm
# Retry limit:15 RTS thr

ff Fragment thr

ff
# Encryption key:AAAA-BBBB-CCCC-DDDD-EEEE-FFFF-GGGG-HHHH Security mode

pen
# Power Management

ff
# Link Quality=67/100 Signal level=-71 dBm Noise level=-72 dBm
# Rx invalid nwid:0 Rx invalid crypt:1 Rx invalid frag:0
# Tx excessive retries:0 Invalid misc:240 Missed beacon:0
q=`$IWCONFIG 2>&1 | $AWK ' BEGIN { numberOfNics=0; essid=""; result=""; }
/^.*(eth|ath|wlan|ra)[0-9].*no wireless/ { next; } # skip
/^.*(eth|ath|wlan|ra)[0-9].*.*/ {
numberOfNics++;
name=substr($1,1,8) # iwconfig allows IO names > 8 chars, ifconfig allows 8 chars only
sub("ESSID:","",$4)
if ( $4 == "off/any") {
essid=""
}
else {
gsub("\"","",$4)
essid=$4
}
getline
sub("Mode:","",$1)
mode=$1
if ( $6 == "Not-Associated" || $6 == "None" ) {
ap=""
}
else {
ap=$6
}
getline
getline
getline
sub("key:","",$2)
if ( $2 == "off") {
key=""
}
else {
key=$2
}
if ( result != "" ) {
result=result "%"
}
result=result name "?" essid "?" mode "?" ap "?" key
}
END { print result
exit numberOfNics
}
'`
INTERFACE_WRL_NO=$?
IFS_OLD=$IFS
IFS="%"
i=0
for interface in $q; do
let i=i+1
IFS="?"
j=0
for element in $interface; do
case $j in
0) INTERFACE_WRL_NAME=$element;
debug "Interface $element detected"
k=1;
index=0
while [[ $k -le $INTERFACE_NO ]]; do
if [[ ${INTERFACE_NAME[$k]} == $INTERFACE_WRL_NAME ]]; then
debug "Found match for $element"
index=$k
fi
let k=k+1
done
if [[ $index -le 0 ]]; then # HACK: no match to ifconfig
let INTERFACE_NO=$INTERFACE_NO+1
index=$INTERFACE_NO
INTERFACE_NAME[$index]=$INTERFACE_WRL_NAME
INTERFACE_TYPE[$index]=$CONNECTION_WRL
debug "Added unmatched -$element-"
else
INTERFACE_TYPE[$index]=$CONNECTION_WRL
debug "Added matched -$element-"
fi
;;
1) INTERFACE_ESSID[$index]=$element
;;
2) INTERFACE_MODE[$index]=$element
;;
3) INTERFACE_AP[$index]=$element
;;
4) INTERFACE_KEY[$index]=$element
;;
*) writeToElizaOnly $MSG_INTERNAL_ERROR
;;
esac
let j=$j+1
done
done
IFS=$IFS_OLD
if [[ $CONNECTION == $CONNECTION_WRL ]]; then
rc=$INTERFACE_WRL_NO
else
rc=$INTERFACE_WRD_NO
fi
state "DI:$INTERFACE_NO"
debug "<<detectInterfaces $INTERFACE_NO"
return $rc
}
#################################################################################
#
# --- Check whether there is a eth/ath/wlan/ra network interface for the connection type available.
# --- If yes,execute various tests on the interface
#
# --- Returns 2 if no IP was found
# --- Returns 1 if no network interface was found
# --- Returns 0 otherwise
#
#################################################################################
function checkNetworkInterfaces () {
debug ">>checkNetworkInterfaces"
local q
local i
local rc=1 # no IF found
local rcSub
IP_ADDRESS_FOUND=0
i=1
while [[ $i -le $INTERFACE_NO ]]; do
if [[ $CONNECTION == $CONNECTION_WRL && ${INTERFACE_TYPE[$i]} == $CONNECTION_WRL ]] ||
[[ $CONNECTION == $CONNECTION_WRD && ${INTERFACE_TYPE[$i]} == $CONNECTION_WRD ]]; then
checkNetworkInterfaceCommon $i
rcSub=$?
state "cNiC:$i:$rcSub"
if [[ $rcSub == 0 ]]; then # there is an IP address and interface
rc=0
fi
if [[ $rcSub == 1 ]]; then # there is no IP address
rc=2
fi
fi
let i=i+1
done
state "NI:$rc"
debug "<<checkNetworkInterfaces $rc"
return $rc
}
#################################################################################
#
# Do some common checks
#
# return 0 if there is an ip address and return 1 if there is no IP address
#
#################################################################################
function checkNetworkInterfaceCommon () { # intecheckNetworkInterfacesrfaceIndex
debug ">>checkNetworkInterfaceCommon"
local index
local rc=0
local name
local nibble
# check whether there is a ip address on the interface
# if there is an ip address check whether there are rcv and xmit errors
index=$1
name=${INTERFACE_NAME[${index}]}
if [[ -z ${INTERFACE_IP[${index}]} ]]; then # no ip address
writeToEliza $MSG_NO_IP_ASSIGNED_TO_NIC $name
rc=1
else
nibble=`echo ${INTERFACE_IP[${index}]} | cut -d "." -f 1` # check for APIPA address
debug "--checkForAPIPAdress"
if [[ $nibble == 169 ]]; then
writeToEliza $MSG_APIPA_DETECTED ${INTERFACE_IP[${index}]} $name
fi
debug "--checkForRCV-XMTErrors"
if [[ ${INTERFACE_RCV_ERROR[${index}]} > $MAX_ERROR_PERCENT ]]; then # receive errors
writeToEliza $MSG_NIC_ERRORS $name
else
if [[ ${INTERFACE_XMT_ERROR[${index}]} > $MAX_ERROR_PERCENT ]]; then # transmission errors
writeToEliza $MSG_NIC_ERRORS $name
fi
fi
fi
state "NIC:$rc"
debug "<<checkNetworkInterfaceCommon $rc"
return $rc
}
#################################################################################
#
# Do some common teste for wired interfaces
#
# (empty right now)
#
#################################################################################
function checkNetworkInterfaceWrd () {
debug ">>checkNetworkInterfacesWrd"
rc=0
state "NIWD:$rc"
debug "<<checkNetworkInterfacesWrd $rc"
return $rc
}
#################################################################################
#
# Do some common tests for wireless interfaces for HW problems
#
# Return 0 if no errors
# Return 1 if there are errors
#
#################################################################################
function checkNetworkInterfaceWrlHW () {
local rc
local finalrc=0
debug ">>checkNetworkInterfacesWrlHW"
checkForMissingWLANFirmware
rc=$?
if [[ $rc != 0 ]]; then
writeToEliza $MSG_POSSIBLE_WLAN_FIRMWARE_PROBLEMS
finalrc=1
fi
checkForNdisWrapperAndLinuxModule
rc=$?
if [[ $rc != 0 ]]; then
finalrc=1
fi
checkForWLANKillSwitch
rc=$?
if [[ $rc != 0 ]]; then
writeToEliza $MSG_WLAN_KILL_SWITCH_ON
finalrc=1
fi
state "NIWL:$finalrc"
debug "<<checkNetworkInterfacesWrlHW $finalrc"
return $finalrc
}
#################################################################################
#
# Do some common tests for wireless interfaces for auth problems
#
# Return 0 if no errors
# Return 1 if there are errors
#
#################################################################################
function checkNetworkInterfaceWrlAUTH () {
local rc
local finalrc=0
debug ">>checkNetworkInterfacesWrlAUTH"
# check for mode set
# if not WEP or WPA key missing
# check for wpa_supplicant to be active and create a warning message
state "NIWLA:$finalrc"
debug "<<checkNetworkInterfacesWrlAUTH $finalrc"
return $finalrc
}
#################################################################################
#
# --- Check whether there is at least one networkdevice available. Use lspci
#
# -- Return the number of devices found
#
#################################################################################
function checkForAtLeastOneNic () {
debug ">>checkForAtLeastOneNic"
local q
if [[ $CONNECTION == $CONNECTION_WRL ]]; then
q=`$LSPCI | $AWK ' BEGIN { numberOfNics=0; }
/Network.*controller/ { numberOfNics++;
}
END { exit numberOfNics }
'`
rc=$?
else # wired connection
q=`$LSPCI | $AWK ' BEGIN { numberOfNics=0; }
/Ethernet.*controller/ { numberOfNics++;
}
END { exit numberOfNics }
'`
rc=$?
fi
state "FALON:$rc"
debug "<<checkForAtLeastOneNic $rc"
return $rc
}
#################################################################################
#
# --- Check whether there are multiple nics in the same subnet.
#
# --- Return 0 if no nics are in the same subnet
# --- Return 1 if there are nics in the same subnet
#
#################################################################################
function checkForNicsInSameSubnet() {
local rc
local q
debug ">>checkForNicsInSameSubnet"
q=`$IFCONFIG | $PERL -e 'my $nic; my %nicsFound;
# collect all nics with their ip and netmask
while (my $line=<STDIN>) {
# print "$line \n";
if ( $line=~/^([a-z0-9]+).*/) {
$nic=$1;
} else {
# $1 (ip) $2 (bc) $3 (mask)
$line=~/.*

\d+\.\d+\.\d+\.\d+).*

\d+\.\d+\.\d+\.\d+).*

\d+\.\d+\.\d+\.\d+)/;
if ( $1 != "") {
my @ipNibbles=split /\./, $1, 4;
my @maskNibbles=split /\./, $3, 4;
$netNibbles[0]=$ipNibbles[0] + 0 & $maskNibbles[0];
$netNibbles[1]=$ipNibbles[1] + 0 & $maskNibbles[1];
$netNibbles[2]=$ipNibbles[2] + 0 & $maskNibbles[2];
$netNibbles[3]=$ipNibbles[3] + 0 & $maskNibbles[3];
my $maskedIP="$netNibbles[0]\.$netNibbles[1]\.$netNibbles[2]\.$netNibbles[3]";
$nicsFound{$nic} = $maskedIP;
# print ".$nic,$maskedIP.";
}
}
}
# check whether there are identical networks used by the nics
# $nicsFound{"eth1"} = "192.168.0.0";
my @ips=values %nicsFound;
my @nics=keys %nicsFound;
my $size=$#nics;
for (my $i=0; $i<$size; $i++) {
for (my $j=$i+1; $j<=$size; $j++) {
if ($ips[$i] eq $ips[$j]) {
print "$nics[$i]:$nics[$j]"
}
}
}
'`
checkForNicsInSameSubnet_Result=$q
if [[ $q != "" ]]; then
rc=1
else
rc=0;
fi
state "NISS:$rc"
debug "<<checkForNicsInSameSubnet $rc"
return $rc
}
#################################################################################
#
# --- Check whether there are no modules loaded or any inactive modules
#
# --- Return 0 if nothing special
# --- Return 1 if there is no module loaded
# --- Return 2 if there are inactive modules
# --- Return 3 if there is no module loaded and inactive modules
#
#################################################################################
function checkModules() {
debug ">>checkModules"
local ifce
local rc
local result
if [[ $CONNECTION == $CONNECTION_WRL ]]; then
ifce=""
else
ifce="eth"
fi
result=`echo $ifce | perl -e'
my $active=0;
my $inactive=0;
my @inactiveName=();
my $activeName="";
my $nicName="";
my $found=0;
my $nic;
my $nicI=<>;
if ( $nicI =~ /eth/ ) {
$nic="Ether";
}
else {
$nic="(Network|WLAN)";
}
foreach my $line (qx/hwinfo --netcard/) {
# print $line;
if ($line =~ /^\d+:/ && $found) {
last;
}
if ($line =~ /^\d+:.+$nic/) {
$found=1;
next;
}
if ($line =~ /Driver Status: (\w+).*(not|in).*active/) {
$inactive++;
if (scalar @inactiveName == 0) {
push @inactiveName,$1;
}
else {
push @inactiveName,",$1";
}
}
elsif ($line =~ /Driver Status: (\w+).*active/) {
$active++;
$activeName=$1;
}
elsif ($line =~ /Device File: (\w+)$/) {
$nicName = $1;
}
}
if ( $found ) {
print "$nicName | $activeName | @inactiveName\n";
}
if ($activeName eq "" && scalar @inactiveName == 0) {
exit 3
}
if ($activeName eq "") {
exit 1
}
if (scalar @inactiveName > 0) {
exit 2
}
exit 0'`
rc=$?
nicName=`echo $result | cut -d "|" -f 1`
active=`echo $result | cut -d "|" -f 2`
inactive=`echo $result | cut -d "|" -f 3`
if [[ $rc == 1 || $rc == 3 ]]; then
writeToEliza $MSG_HW_NO_ACTIVE $nicName
fi
if [[ $rc == 2 || $rc == 3 ]]; then
writeToEliza $MSG_HW_SOME_INACTIVE $inactive $nicName
fi
state "CM:$rc"
debug "<< checkModules $rc"
return $rc
}
#################################################################################
#
# --- Check MTU
#
#################################################################################
function checkMTU() {
debug ">>checkMTU"
local DFDetected
local testMTU
local dummy
local rc
# detect maximum possible MTU for client or router using pppoe
DFDetected=0
testMTU=1600
while [[ $DFDetected == 0 ]]; do
dummy=`ping -c1 195.135.220.3 -s $testMTU -M do | $GREP "DF set"`
DFDetected=$?
if [[ $DFDetected == 0 ]]; then
let testMTU=$testMTU-100
fi
done
DFDetected=0
let testMTU=$testMTU+100
while [[ $DFDetected == 0 ]]; do
dummy=`ping -c1 195.135.220.3 -s $testMTU -M do | $GREP "DF set"`
DFDetected=$?
if [[ $DFDetected == 0 ]]; then
let testMTU=$testMTU-10
fi
done
DFDetected=0
let testMTU=$testMTU+10
while [[ $DFDetected == 0 ]]; do
dummy=`ping -c1 195.135.220.3 -s $testMTU -M do | $GREP "DF set"`
DFDetected=$?
if [[ $DFDetected == 0 ]]; then
let testMTU=$testMTU-2
fi
done
let mtuRequired=$testMTU+28
# mtuRequired=`ping -c1 195.135.220.3 -s 1600 -M do | perl -e 'my $mtu; while(<>) { if ($_=~/mtu.* (\d+)\)/) { print "$1"};
#}'`
defaultGatewayNic=`$ROUTE -n | $AWK '/^[0]+\.[0]+\.[0]+\.[0]+/ { print $NF; } '`
mtuActive=`$IFCONFIG $defaultGatewayNic | $PERL -e 'my $mtu; while(<>) { if ($_=~/MTU

\d+)/) { print "$1"}; }'`
if [[ $mtuRequired -lt $mtuActive ]]; then
rc=1
else
rc=0
fi
state "MTU:$rc"
debug "<<checkMTU $rc"
}
#################################################################################
#
# --- Check whether there is a default route defined
#
# --- return
# --- 0 if there is no default route set
# --- 1 if there is a default route set
# --- and set global variable checkDefaultRoute_gateway_host to the hostname of the default gateway
# --- and set global variable checkDefaultRoute_gateway_nic to the nic which is used for the default gateway
#
#################################################################################
function checkDefaultRoute () {
debug ">>checkDefaultRoute"
local q
local i
local v
local rc
# 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
q=`$ROUTE -n | $AWK '/^[0]+\.[0]+\.[0]+\.[0]+/ { print$0; } '`
if [[ $q == "" ]]; then
rc=0
else
rc=1
i=1
for v in $q; do
if [[ $i == 2 ]]; then
checkDefaultRoute_gateway_host=$v
fi
if [[ $i == 8 ]]; then
checkDefaultRoute_gateway_nic=$v
fi
let i=i+1
done;
fi
state "DR:$rc"
debug "<<checkDefaultRoute $rc"
CHECK_DEFAULT_ROUTE=$rc
return $rc
}
#################################################################################
#
# --- Cat all config files in /etc/sysconfig/network/ifcfg-*
# --- Masquerade wireless keys and passwords
#
#################################################################################
function catMyConfig() {
local C
# masquerade WLAN credentials
# BOOTPROTO='dhcp'
# BROADCAST=''
# ETHTOOL_OPTIONS=''
# IFPLUGD_PRIORITY='10'
# IPADDR=''
# MTU=''
# NAME='Intel Thinkpad X60s, R60e model 0657'
# NETMASK=''
# NETWORK=''
# REMOTE_IPADDR=''
# STARTMODE='ifplugd'
# USERCONTROL='no'
# WIRELESS_AP=''
# WIRELESS_AUTH_MODE='open'
# WIRELESS_BITRATE='auto'
# WIRELESS_CA_CERT=''
# WIRELESS_CHANNEL=''
# WIRELESS_CLIENT_CERT=''
# WIRELESS_CLIENT_KEY=''
# WIRELESS_CLIENT_KEY_PASSWORD=''
# WIRELESS_DEFAULT_KEY='0'
# WIRELESS_EAP_AUTH=''
# WIRELESS_EAP_MODE=''
# WIRELESS_ESSID='FRAMP'
# WIRELESS_FREQUENCY=''
# WIRELESS_KEY=''
# WIRELESS_KEY_0=''
# WIRELESS_KEY_1=''
# WIRELESS_KEY_2=''
# WIRELESS_KEY_3=''
# WIRELESS_KEY_LENGTH='128'
# WIRELESS_MODE='Managed'
# WIRELESS_NICK=''
# WIRELESS_NWID=''
# WIRELESS_PEAP_VERSION=''
# WIRELESS_POWER='yes'
# WIRELESS_WPA_ANONID=''
# WIRELESS_WPA_IDENTITY=''
# WIRELESS_WPA_PASSWORD=''
# WIRELESS_WPA_PSK=''
for C in `ls /etc/sysconfig/network/ifcfg-[earwd]* 2>/dev/null`; do
echo $SEPARATOR >> $LOG
# processingMessage "Processing configs"
echo "*** cat $C" >> $LOG;
cat $C | grep -v "^#" | grep -v "^$" \
| $AWK "BEGIN { FS=\"=\"} \
/WIRELESS_KEY[ ]*=|WIRELESS_KEY_[0-9][ ]*=|WIRELESS_DEFAULT_KEY[ ]*|WIRELESS_KEY_LENGTH[ ]*=|\
WIRELESS_WPA_IDENTITY[ ]*=|WIRELESS_WPA_PASSWORD[ ]*=|WIRELESS_WPA_PSK[ ]*=/ \
{ cred=\"@@@@@@\"; \
if ( \$2 ~ /['\"].+['\"]/ || \$2 !~ /['\"]/ ) { \
if ( substr(\$2,1,1) ~ /['\"]/ ) {
cred=substr(\$2,1,1) cred substr(\$2,1,1);
}
print \$1 \"=\" cred; next;
}
}
{ print \$0}" | $EGREP -v ".*=''" >> $LOG
done
return 0
}
#################################################################################
#
# --- Check whether ipv6 module is loaded
#
# --- return 1 if module is loaded
# --- return 0 otherwise
#
#################################################################################
function checkForIPV6() {
debug ">>checkForIPV6"
local l
$LSMOD | $GREP -i ipv6 > /dev/null
rc=$?
if [[ $rc == 0 ]]; then
rc=1
else
rc=0
fi
state "IP6:$rc"
debug "<<checkForIPV6 $rc"
return $rc
}