OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [brend.sh] - Blame information for rev 448

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 440 jeremybenn
#!/bin/bash
2
 
3
# Copyright (C) 2010 ORSoC AB
4
# Copyright (C) 2010 Embecosm Limited
5
 
6
# Contributor Julius Baxter <julius.baxter@orsoc.se>
7
# Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
8
 
9
# This file is a superuser script to close down an Ethernet bridge and restore
10
# the simple Ethernet interface.
11
 
12
# This program is free software; you can redistribute it and/or modify it
13
# under the terms of the GNU General Public License as published by the Free
14
# Software Foundation; either version 3 of the License, or (at your option)
15
# any later version.
16
 
17
# This program is distributed in the hope that it will be useful, but WITHOUT
18
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
20
# more details.
21
 
22
# You should have received a copy of the GNU General Public License along
23
# with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 
25
# ------------------------------------------------------------------------------
26
 
27
# Pre-requisites: bridge-utils must be installed.
28
 
29
# Usage: ./brset.sh <bridge> <eth> <mac> <tap> [<tap> <tap> ...]
30
 
31
# - <bridge> is the bridge interface to use, e.g. br0
32
# - <eth> is the hardware ethernet interface to use, e.g. eth0
33
 
34
# The tap interface can subsequently be deleted (so long as no one else is
35
# using it) with
36
 
37
# openvpn --rmtun --dev tap<n>
38
 
39
# Define Bridge Interface
40
br=$1
41
shift
42
 
43
# Host ethernet interface to use
44
eth=$1
45
shift
46
 
47
# Determine the IP address, netmask and broadcast of the bridge.
48
eth_ip=`ifconfig $br | \
49
        grep "inet addr" | \
50
        head -1 | \
51
        sed -e 's/^.*inet addr:\([^ \t]*\).*$/\1/'`
52
eth_netmask=`ifconfig $br | \
53
        grep "Mask" | \
54
        head -1 | \
55
        sed -e 's/^.*Mask:\([^ \t]*\).*$/\1/'`
56
eth_broadcast=`ifconfig $br | \
57
        grep "Bcast" | \
58
        head -1 | \
59
        sed -e 's/^.*Bcast:\([^ \t]*\).*$/\1/'`
60
 
61
# Define list of TAP interfaces to be bridged,
62
tap=$*
63
 
64
echo "Deleting bridge $br"
65
echo "  Host Ethernet device: $eth"
66
echo "  Host IP address:      $eth_ip"
67
echo "  Host netmask:         $eth_netmask"
68
echo "  Host broadcast:       $eth_broadcast"
69
 
70
# Delete the bridge
71
ifconfig $br down
72
brctl delbr $br
73
 
74
# Restore the Ethernet interface
75
ifconfig $eth $eth_ip netmask $eth_netmask broadcast $eth_broadcast

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.