Statistics
| Branch: | Tag: | Revision:

root / kvm-ifdown @ 838c1835

History | View | Annotate | Download (1.4 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

    
11
if [ "x$INTERFACE" = "x" ]; then
12
  $SNF_NETWORK_LOG $0 "INTERFACE not set. Aborting"
13
else
14
  $SNF_NETWORK_LOG $0 "Unconfiguring interface $INTERFACE of $GANETI_INSTANCE_NAME"
15
fi
16

    
17
FROM=FROM${INTERFACE^^}
18
TO=TO${INTERFACE^^}
19

    
20
ONLY_LOCAL=$2
21

    
22
if [ "$MODE" = "routed" ]; then
23
  TABLE=$LINK
24
  DROPDHCPREQCMD="iptables -A FORWARD -D $INTERFACE -p udp --dport 67 -j DROP"
25
elif [ "$MODE" = "bridged" ]; then
26
  DROPDHCPREQCMD="runlocked $RUNLOCKED_OPTS ebtables -D $FROM -p ipv4 --ip-protocol udp --ip-destination-port 67 -j DROP"
27
fi
28

    
29

    
30
for tag in $NETWORK_TAGS; do
31
  case $tag in
32
  $IP_LESS_ROUTED_TAG)
33
    try clear_routed_setup_ipv4
34
    try clear_routed_setup_ipv6
35
    try clear_routed_setup_firewall
36
    try delete_neighbor_proxy
37
  ;;
38
  $NFDHCPD_TAG)
39
    # Drop unicast BOOTP/DHCP packets
40
    $DROPDHCPREQCMD
41
    try clear_nfdhcpd
42
  ;;
43
  $MAC_FILTERED_TAG)
44
    try clear_ebtables
45
  ;;
46
  $DNS_TAG)
47
    if ! $ONLY_LOCAL; then
48
      get_rev4_info "$IP"
49
      get_eui64 "$MAC" "$SUBNET6"
50
      get_rev6_info "$EUI64"
51
      $SNF_NETWORK_LOG $0 "delete dns entry for $GANETI_INSTANCE_NAME $IP $EUI64"
52
      update_all delete
53
    fi
54
  ;;
55
  esac
56
done
57

    
58
exit 0