Statistics
| Branch: | Tag: | Revision:

root / vif-custom @ ae809198

History | View | Annotate | Download (2.5 kB)

1
#!/bin/bash
2
#
3
# Copyright 2012-2014 GRNET S.A. All rights reserved.
4
#
5
# Redistribution and use in source and binary forms, with or
6
# without modification, are permitted provided that the following
7
# conditions are met:
8
#
9
#   1. Redistributions of source code must retain the above
10
#      copyright notice, this list of conditions and the following
11
#      disclaimer.
12
#
13
#   2. Redistributions in binary form must reproduce the above
14
#      copyright notice, this list of conditions and the following
15
#      disclaimer in the documentation and/or other materials
16
#      provided with the distribution.
17
#
18
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
19
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
25
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
# POSSIBILITY OF SUCH DAMAGE.
30
#
31
# The views and conclusions contained in the software and
32
# documentation are those of the authors and should not be
33
# interpreted as representing official policies, either expressed
34
# or implied, of GRNET S.A.
35

    
36
dir=$(dirname "$0")
37
. "$dir"/vif-common.sh
38

    
39
# taken from older vif-common.sh
40
dev=$vif
41
dev_=${dev#vif}
42
domid=${dev_%.*}
43
devid=${dev_#*.}
44
domname=$(xm domname $domid)
45

    
46
source /etc/default/snf-network
47
source /usr/lib/snf-network/common.sh
48
source $GANETI_NIC_DIR/$domname/$devid
49

    
50
INTERFACE=$dev
51
INSTANCE=$domname
52

    
53
get_info
54

    
55
try clear_routed_setup_ipv4
56
try clear_routed_setup_ipv6
57
try clear_routed_setup_firewall
58
try clear_ebtables
59
try clear_nfdhcpd
60

    
61
if [ "$MODE" = "routed" ]; then
62
  ip link set $INTERFACE up
63
  success
64
elif [ "$MODE" = "bridged" ]; then
65
  ip link set $INTERFACE up
66
  BRIDGE=$(xenstore_read_default "$XENBUS_PATH/bridge" "$LINK")
67
  brctl addif $BRIDGE $INTERFACE
68
  success
69
fi
70

    
71
for tag in $NETWORK_TAGS; do
72
  case $tag in
73
  $IP_LESS_ROUTED_TAG)
74
    try routed_setup_ipv4
75
    try routed_setup_ipv6
76
    try routed_setup_firewall
77
    try send_garp
78
  ;;
79
  $NFDHCPD_TAG)
80
    try setup_nfdhcpd
81
  ;;
82
  $MAC_FILTERED_TAG)
83
    try init_ebtables
84
    try setup_ebtables
85
  ;;
86
  $MASQ_TAG)
87
    try setup_masq
88
  ;;
89
  esac
90
done