Statistics
| Branch: | Tag: | Revision:

root / kvm-ifdown @ fc443c7a

History | View | Annotate | Download (1.3 kB)

1
#!/bin/bash
2

    
3
# This is an example of a Ganeti kvm ifup script that configures network
4
# interfaces based on the initial deployment of the Okeanos project
5

    
6
source /etc/default/snf-network
7
source /usr/lib/snf-network/common.sh
8

    
9
GANETI_INSTANCE_NAME=$INSTANCE
10
ONLY_LOCAL=$2
11

    
12
if ! $ONLY_LOCAL; then
13
  GLOBAL=globaly
14
fi
15

    
16
if [ "x$INTERFACE" = "x" ]; then
17
  $SNF_NETWORK_LOG $0 "INTERFACE not set. Aborting"
18
  exit 0
19
else
20
  $SNF_NETWORK_LOG $0 "Unconfiguring $INTERFACE of $GANETI_INSTANCE_NAME $GLOBAL"
21
fi
22

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

    
26

    
27
if [ "$MODE" = "routed" ]; then
28
  TABLE=$LINK
29
  DROPDHCPREQCMD="iptables -A FORWARD -D $INTERFACE -p udp --dport 67 -j DROP"
30
elif [ "$MODE" = "bridged" ]; then
31
  DROPDHCPREQCMD="runlocked $RUNLOCKED_OPTS ebtables -D $FROM -p ipv4 --ip-protocol udp --ip-destination-port 67 -j DROP"
32
fi
33

    
34

    
35
get_info
36

    
37
for tag in $NETWORK_TAGS; do
38
  case $tag in
39
  $IP_LESS_ROUTED_TAG)
40
    try clear_routed_setup_ipv4
41
    try clear_routed_setup_ipv6
42
    try clear_routed_setup_firewall
43
    try delete_neighbor_proxy
44
  ;;
45
  $NFDHCPD_TAG)
46
    # Drop unicast BOOTP/DHCP packets
47
    $DROPDHCPREQCMD
48
    try clear_nfdhcpd
49
  ;;
50
  $MAC_FILTERED_TAG)
51
    try clear_ebtables
52
  ;;
53
  $DNS_TAG)
54
    if ! $ONLY_LOCAL; then
55
      update_all delete
56
    fi
57
  ;;
58
  esac
59
done
60

    
61
exit 0