equal
deleted
inserted
replaced
64 |
64 |
65 case "$1" in |
65 case "$1" in |
66 start) |
66 start) |
67 echo -n "Starting EtherCAT master " |
67 echo -n "Starting EtherCAT master " |
68 |
68 |
69 if [ ! $DEVICE_INDEX ]; then |
69 if [ -z "$DEVICE_INDEX" ]; then |
70 echo "ERROR: DEVICE_INDEX not set!" |
70 echo "ERROR: DEVICE_INDEX not set!" |
71 /bin/false |
71 /bin/false |
72 rc_status -v |
72 rc_status -v |
73 rc_exit |
73 rc_exit |
74 fi |
74 fi |
75 |
75 |
76 if [ ! $EOE_DEVICES ]; then |
76 if [ -z "$EOE_DEVICES" ]; then |
77 EOE_DEVICES=0 |
77 EOE_DEVICES=0 |
78 fi |
78 fi |
79 |
79 |
80 for mod in 8139too 8139cp; do |
80 for mod in 8139too 8139cp; do |
81 if lsmod | grep "^$mod " > /dev/null; then |
81 if lsmod | grep "^$mod " > /dev/null; then |
95 |
95 |
96 if ! modprobe ec_8139too ec_device_index=$DEVICE_INDEX; then |
96 if ! modprobe ec_8139too ec_device_index=$DEVICE_INDEX; then |
97 /bin/false |
97 /bin/false |
98 rc_status -v |
98 rc_status -v |
99 rc_exit |
99 rc_exit |
|
100 fi |
|
101 |
|
102 # Build EoE bridge |
|
103 if [ -n "$EOE_BRIDGE" ]; then |
|
104 |
|
105 EOE_INTERFACES=`/sbin/ifconfig -a | grep -o -E "^eoe[0-9]+ "` |
|
106 |
|
107 # add bridge, if it does not already exist |
|
108 if ! /sbin/brctl show | grep -E -q "^$EOE_BRIDGE"; then |
|
109 if ! /sbin/brctl addbr $EOE_BRIDGE; then |
|
110 /bin/false |
|
111 rc_status -v |
|
112 rc_exit |
|
113 fi |
|
114 fi |
|
115 |
|
116 # free all interfaces of their addresses and add them to the bridge |
|
117 for interface in $EOE_INTERFACES $EOE_EXTRA_INTERFACES; do |
|
118 if ! /sbin/ifconfig $interface 0.0.0.0 up; then |
|
119 /bin/false |
|
120 rc_status -v |
|
121 rc_exit |
|
122 fi |
|
123 if ! /sbin/brctl show | grep -E -q "^$EOE_BRIDGE.*$interface"; then |
|
124 if ! /sbin/brctl addif $EOE_BRIDGE $interface; then |
|
125 /bin/false |
|
126 rc_status -v |
|
127 rc_exit |
|
128 fi |
|
129 fi |
|
130 done |
|
131 if [ -n "$EOE_IP_ADDRESS" -a -n "$EOE_IP_NETMASK" ]; then |
|
132 if ! /sbin/ifconfig $EOE_BRIDGE $EOE_IP_ADDRESS \ |
|
133 netmask $EOE_IP_NETMASK; then |
|
134 /bin/false |
|
135 rc_status -v |
|
136 rc_exit |
|
137 fi |
|
138 fi |
|
139 if ! /sbin/ifconfig $EOE_BRIDGE up; then |
|
140 /bin/false |
|
141 rc_status -v |
|
142 rc_exit |
|
143 fi |
100 fi |
144 fi |
101 |
145 |
102 rc_status -v |
146 rc_status -v |
103 ;; |
147 ;; |
104 |
148 |