fp@1745: #!/bin/bash fp@1745: fp@1745: #------------------------------------------------------------------------------ fp@1745: # fp@1745: # $Id$ fp@1745: # fp@1745: # Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH fp@1745: # fp@1745: # This file is part of the IgH EtherCAT Master. fp@1745: # fp@1745: # The IgH EtherCAT Master is free software; you can redistribute it fp@1745: # and/or modify it under the terms of the GNU General Public License fp@1745: # as published by the Free Software Foundation; either version 2 of the fp@1745: # License, or (at your option) any later version. fp@1745: # fp@1745: # The IgH EtherCAT Master is distributed in the hope that it will be fp@1745: # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of fp@1745: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fp@1745: # GNU General Public License for more details. fp@1745: # fp@1745: # You should have received a copy of the GNU General Public License fp@1745: # along with the IgH EtherCAT Master; if not, write to the Free Software fp@1745: # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@1745: # fp@1745: # The right to use EtherCAT Technology is granted and comes free of fp@1745: # charge under condition of compatibility of product made by fp@1745: # Licensee. People intending to distribute/sell products based on the fp@1745: # code, have to sign an agreement to guarantee that products using fp@1745: # software based on IgH EtherCAT master stay compatible with the actual fp@1745: # EtherCAT specification (which are released themselves as an open fp@1745: # standard) as the (only) precondition to have the right to use EtherCAT fp@1745: # Technology, IP and trade marks. fp@1745: # fp@1745: #------------------------------------------------------------------------------ fp@1745: fp@1745: # this ifup.d script adds special network interfaces to a network bridge fp@1745: fp@1745: CFGNAME=${1} fp@1745: IFNAME=${2} fp@1745: fp@1745: # customize here fp@1745: BRNAME="eoebr0" fp@1745: INTERFACES="" fp@1745: BRCTL="/sbin/brctl" fp@1745: LOGGER="logger -t ifup-eoe" fp@1745: fp@1745: # if the current interface in the list of interfaces to bridge? fp@1745: if ! echo ${INTERFACES} | grep -qw ${IFNAME}; then fp@1745: exit 0; fp@1745: fi fp@1745: fp@1745: # does the EoE bridge already exist? fp@1745: if ! ${BRCTL} show | grep -q "^${BRNAME}"; then fp@1745: ${LOGGER} Creating ${BRNAME} fp@1745: ${BRCTL} addbr ${BRNAME} # create it fp@1745: fi fp@1745: fp@1745: ${LOGGER} Adding ${IFNAME} to ${BRNAME} fp@1745: ip link set ${IFNAME} down fp@1745: ip addr flush dev ${IFNAME} fp@1745: ${BRCTL} addif ${BRNAME} ${IFNAME} fp@1745: ip link set ${IFNAME} up fp@1745: fp@1745: #------------------------------------------------------------------------------