Statistics
| Branch: | Tag: | Revision:

root / vif-custom @ a004c27e

History | View | Annotate | Download (1.6 kB)

1
#!/bin/bash
2

    
3

    
4
dir=$(dirname "$0")
5
. "$dir"/vif-common.sh
6

    
7
# taken from older vif-common.sh
8
dev=$vif
9
dev_=${dev#vif}
10
domid=${dev_%.*}
11
devid=${dev_#*.}
12
domname=$(xm domname $domid)
13

    
14
source /etc/default/snf-network
15
source /usr/lib/snf-network/common.sh
16
source $GANETI_NIC_DIR/$domname/$devid
17

    
18
INTERFACE=$dev
19
INSTANCE=$domname
20
GANETI_INSTANCE_NAME=$INSTANCE
21

    
22
FROM=FROM${INTERFACE^^}
23
TO=TO${INTERFACE^^}
24

    
25

    
26
try clear_routed_setup_ipv4
27
try clear_routed_setup_ipv6
28
try clear_routed_setup_firewall
29
try clear_ebtables
30
try clear_nfdhcpd
31

    
32
if [ "$MODE" = "routed" ]; then
33
  TABLE=$LINK
34
  ip link set $INTERFACE up
35
  success
36
  INDEV=$INTERFACE
37
  DROPDHCPREQCMD="iptables -A FORWARD -i $INTERFACE -p udp --dport 67 -j DROP"
38
elif [ "$MODE" = "bridged" ]; then
39
  ip link set $INTERFACE up
40
  BRIDGE=$(xenstore_read_default "$XENBUS_PATH/bridge" "$LINK")
41
  brctl addif $BRIDGE $INTERFACE
42
  success
43
  INDEV=$BRIDGE
44
  try init_ebtables
45
  DROPDHCPREQCMD="runlocked $RUNLOCKED_OPTS ebtables -A $FROM -p ipv4 --ip-protocol udp --ip-destination-port 67 -j DROP"
46
fi
47

    
48

    
49
for tag in $NETWORK_TAGS; do
50
  case $tag in
51
  $IP_LESS_ROUTED_TAG)
52
    try routed_setup_ipv4
53
    try routed_setup_ipv6
54
    try routed_setup_firewall
55
    try send_garp
56
  ;;
57
  $NFDHCPD_TAG)
58
    # Drop unicast BOOTP/DHCP packets
59
    $DROPDHCPREQCMD
60
    try setup_nfdhcpd
61
  ;;
62
  $MAC_FILTERED_TAG)
63
    try setup_ebtables
64
  ;;
65
  $MASQ_TAG)
66
    try setup_masq
67
  ;;
68
  $DNS_TAG)
69
    get_rev4_info "$IP"
70
    get_eui64 "$MAC" "$NETWORK_SUBNET6"
71
    get_rev6_info "$EUI64"
72
    $SNF_NETWORK_LOG $0 "update dns for $GANETI_INSTANCE_NAME $IP $EUI64"
73
    update_all add
74
  ;;
75
  esac
76
done