Allow only MAC addresses as device identifiers; replaced master list by

master array; hand ober MAC addresses with array module parameters.
This commit is contained in:
Florian Pose
2007-03-08 18:15:25 +00:00
parent 8c9abc407c
commit 8ac6516b4e
19 changed files with 244 additions and 512 deletions
+14 -10
View File
@@ -68,16 +68,14 @@ fi
#------------------------------------------------------------------------------
function make_device_id()
function parse_mac_address()
{
if [ -z "${1}" ]; then
DEVICE_ID=";"
MAC=""
elif echo ${1} | grep -qE '^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$'; then
DEVICE_ID="M${1};"
elif echo ${1} | grep -qE '^[^:]+:[0-9]+$'; then
DEVICE_ID="D${1};"
MAC=${1}
else
echo Invalid device ID syntax in ${ETHERCAT_CONFIG}
echo Invalid MAC address \"${1}\" in ${ETHERCAT_CONFIG}
/bin/false
rc_status -v
rc_exit
@@ -103,10 +101,16 @@ start)
BACKUP=$(eval echo "\${MASTER${MASTER_INDEX}_BACKUP}")
if [ -z "${DEVICE}" ]; then break; fi
make_device_id ${DEVICE}
DEVICES=${DEVICES}${DEVICE_ID}
make_device_id ${BACKUP}
BACKUPS=${BACKUPS}${DEVICE_ID}
if [ ${MASTER_INDEX} -gt 0 ]; then
DEVICES=${DEVICES},
BACKUPS=${BACKUPS},
fi
parse_mac_address ${DEVICE}
DEVICES=${DEVICES}${MAC}
parse_mac_address ${BACKUP}
BACKUPS=${BACKUPS}${MAC}
MASTER_INDEX=$(expr ${MASTER_INDEX} + 1)
done
+5 -11
View File
@@ -9,20 +9,14 @@
#
# Master device and backup-device settings.
#
# The MASTERX_DEVICE variable specifies the ethernet device for master 'X',
# while the MASTERX_BACKUP variable specifies the backup ethernet device for
# The MASTER<X>_DEVICE variable specifies the ethernet device for master 'X',
# while the MASTER<X>_BACKUP variable specifies the backup ethernet device for
# redundancy purposes.
#
# There are three formats for specifying ethernet devices:
# 1) MAC address (example: "00:00:08:44:ab:66"). Specify the MAC address of
# the ethernet card to use.
# 2) PCI bus address (example: "01:1c.0"). Specify the PCU bis address of the
# ethernet card to use.
# 3) Driver and device index (example: "8139too:0"). Currently there are two
# drivers available: "8139too" and "e100". The device index is the index
# into driver-supported PCI cards.
# Specify the MAC address (hexadecimal with colons) of the Ethernet device to
# use. Example: 00:00:08:44:ab:66
#
# The MASTERX_DEVICE variables also determine, how many masters will be
# The MASTER<X>_DEVICE variables also determine, how many masters will be
# created: A non-empty variable MASTER0_DEVICE will create one master, adding
# a non-empty variable MASTER1_DEVICE will create a second master, and so on.
#