fp@703: #!/bin/bash
fp@703: 
fp@703: #------------------------------------------------------------------------------
fp@703: #
fp@703: #  $Id$
fp@703: #
fp@1326: #  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
fp@703: #
fp@703: #  This file is part of the IgH EtherCAT Master.
fp@703: #
fp@1326: #  The IgH EtherCAT Master is free software; you can redistribute it and/or
fp@1326: #  modify it under the terms of the GNU General Public License version 2, as
fp@1326: #  published by the Free Software Foundation.
fp@703: #
fp@1326: #  The IgH EtherCAT Master is distributed in the hope that it will be useful,
fp@1326: #  but WITHOUT ANY WARRANTY; without even the implied warranty of
fp@1326: #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
fp@1326: #  Public License for more details.
fp@703: #
fp@1326: #  You should have received a copy of the GNU General Public License along
fp@1326: #  with the IgH EtherCAT Master; if not, write to the Free Software
fp@703: #  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
fp@703: #
fp@1363: #  ---
fp@2421: #
fp@1363: #  The license mentioned above concerns the source code only. Using the EtherCAT
fp@1363: #  technology and brand is only permitted in compliance with the industrial
fp@1363: #  property and similar rights of Beckhoff Automation GmbH.
fp@703: #
fp@1804: #  vim: expandtab
fp@1804: #
fp@703: #------------------------------------------------------------------------------
fp@703: 
fp@703: # this ifup.d script adds special network interfaces to a network bridge
fp@703: 
fp@703: CFGNAME=${1}
fp@703: IFNAME=${2}
fp@703: 
fp@703: # customize here
fp@703: BRNAME="eoebr0"
fp@703: INTERFACES=""
fp@703: BRCTL="/sbin/brctl"
fp@703: LOGGER="logger -t ifup-eoe"
fp@703: 
fp@703: # if the current interface in the list of interfaces to bridge?
fp@703: if ! echo ${INTERFACES} | grep -qw ${IFNAME}; then
fp@703:     exit 0;
fp@703: fi
fp@703: 
fp@703: # does the EoE bridge already exist?
fp@703: if ! ${BRCTL} show | grep -q "^${BRNAME}"; then
fp@1804:     ${LOGGER} Creating ${BRNAME}
fp@1804:     ${BRCTL} addbr ${BRNAME} # create it
fp@703: fi
fp@703: 
fp@703: ${LOGGER} Adding ${IFNAME} to ${BRNAME}
fp@703: ip link set ${IFNAME} down
fp@703: ip addr flush dev ${IFNAME}
fp@703: ${BRCTL} addif ${BRNAME} ${IFNAME}
fp@703: ip link set ${IFNAME} up
fp@703: 
fp@703: #------------------------------------------------------------------------------