author | Florian Pose <fp@igh-essen.com> |
Wed, 29 Apr 2009 09:43:04 +0000 | |
changeset 1421 | 043a518831b2 |
parent 1363 | 11c0b2caa253 |
child 1804 | 742607c464c4 |
permissions | -rwxr-xr-x |
703 | 1 |
#!/bin/bash |
2 |
||
3 |
#------------------------------------------------------------------------------ |
|
4 |
# |
|
5 |
# $Id$ |
|
6 |
# |
|
1326
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
703
diff
changeset
|
7 |
# Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH |
703 | 8 |
# |
9 |
# This file is part of the IgH EtherCAT Master. |
|
10 |
# |
|
1326
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
703
diff
changeset
|
11 |
# The IgH EtherCAT Master is free software; you can redistribute it and/or |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
703
diff
changeset
|
12 |
# modify it under the terms of the GNU General Public License version 2, as |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
703
diff
changeset
|
13 |
# published by the Free Software Foundation. |
703 | 14 |
# |
1326
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
703
diff
changeset
|
15 |
# The IgH EtherCAT Master is distributed in the hope that it will be useful, |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
703
diff
changeset
|
16 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
703
diff
changeset
|
17 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
703
diff
changeset
|
18 |
# Public License for more details. |
703 | 19 |
# |
1326
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
703
diff
changeset
|
20 |
# You should have received a copy of the GNU General Public License along |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
703
diff
changeset
|
21 |
# with the IgH EtherCAT Master; if not, write to the Free Software |
703 | 22 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
23 |
# |
|
1363
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
24 |
# --- |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
25 |
# |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
26 |
# The license mentioned above concerns the source code only. Using the EtherCAT |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
27 |
# technology and brand is only permitted in compliance with the industrial |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
28 |
# property and similar rights of Beckhoff Automation GmbH. |
703 | 29 |
# |
30 |
#------------------------------------------------------------------------------ |
|
31 |
||
32 |
# this ifup.d script adds special network interfaces to a network bridge |
|
33 |
||
34 |
CFGNAME=${1} |
|
35 |
IFNAME=${2} |
|
36 |
||
37 |
# customize here |
|
38 |
BRNAME="eoebr0" |
|
39 |
INTERFACES="" |
|
40 |
BRCTL="/sbin/brctl" |
|
41 |
LOGGER="logger -t ifup-eoe" |
|
42 |
||
43 |
# if the current interface in the list of interfaces to bridge? |
|
44 |
if ! echo ${INTERFACES} | grep -qw ${IFNAME}; then |
|
45 |
exit 0; |
|
46 |
fi |
|
47 |
||
48 |
# does the EoE bridge already exist? |
|
49 |
if ! ${BRCTL} show | grep -q "^${BRNAME}"; then |
|
50 |
${LOGGER} Creating ${BRNAME} |
|
51 |
${BRCTL} addbr ${BRNAME} # create it |
|
52 |
fi |
|
53 |
||
54 |
${LOGGER} Adding ${IFNAME} to ${BRNAME} |
|
55 |
ip link set ${IFNAME} down |
|
56 |
ip addr flush dev ${IFNAME} |
|
57 |
${BRCTL} addif ${BRNAME} ${IFNAME} |
|
58 |
ip link set ${IFNAME} up |
|
59 |
||
60 |
#------------------------------------------------------------------------------ |