Revision a9872828

b/hooks/network-connect-post.d/snf-network
17 17

  
18 18
RT_TABLES=/etc/iproute2/rt_tables
19 19

  
20

  
21
if [ -e $NODEMAPFILE ]; then
22
  exit 0
23
fi
24

  
25

  
20 26
cat > $NODEMAPFILE <<EOF
21 27
MODE=$MODE
22 28
LINK=$LINK
......
39 45
    ID=$(wc -l < $RT_TABLES)
40 46
    echo $((ID+1)) $TABLE >> $RT_TABLES
41 47

  
42
    ip rule add iif $VLAN table $TABLE
48
    if [ -n "$SUBNET" ]; then
49
      ip rule add iif $VLAN table $TABLE
43 50

  
44
    ip route add $SUBNET dev $VLAN table main 
51
      ip route add $SUBNET dev $VLAN table main 
45 52

  
46
    ip route add $SUBNET dev $VLAN table $TABLE
47
    ip route add default via $GATEWAY dev $VLAN table $TABLE
48
    
49
    echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
53
      ip route add $SUBNET dev $VLAN table $TABLE
54
      if [ -n "$GATEWAY" ]; then
55
        ip route add default via $GATEWAY dev $VLAN table $TABLE
56
      fi
57
      echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
58

  
59
      arptables -A OUTPUT -o $VLAN --opcode request -j mangle --mangle-ip-s  $ARP_IP 
60
    fi
50 61

  
51
    arptables -A OUTPUT -o $VLAN --opcode request -j mangle --mangle-ip-s  $ARP_IP 
62
    if [ -n "$SUBNET6" ]; then
63
      ip -6 rule add iif $VLAN table $TABLE
64
      ip -6 route add $SUBNET6 dev $VLAN table main
65
      ip -6 route add $SUBNET6 dev $VLAN table $TABLE
66
      if [ -n "$GATEWAY6" ]; then
67
        ip -6 route add default via $GATEWAY6 dev $VLAN table $TABLE
68
      fi
69
      echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
70
      echo 1 > /proc/sys/net/ipv6/conf/$VLAN/proxy_ndp
71
    fi
52 72
  fi
53 73
fi
54 74

  
b/hooks/network-disconnect-post.d/snf-network
17 17

  
18 18
RT_TABLES=/etc/iproute2/rt_tables
19 19

  
20

  
21
if [ ! -e $NODEMAPFILE ]; then
22
  exit 0
23
fi
24

  
20 25
source $NODEINFRAFILE
21 26
source $CLUSTERINFRAFILE
22 27
source $NETFILE
......
28 33
    VLAN=$PUBLIC_VLAN
29 34
    ARP_IP=$(ipcalc $SUBNET | grep HostMax | awk '{print $2}')
30 35
  
31
    arptables -D OUTPUT -o $VLAN --opcode request -j mangle --mangle-ip-s  $ARP_IP 
36
    if [ -n "$SUBNET" ]; then
37
      arptables -D OUTPUT -o $VLAN --opcode request -j mangle --mangle-ip-s  $ARP_IP 
38
      if [ -n "$GATEWAY" ]; then  
39
        ip route del default via $GATEWAY dev $VLAN table $TABLE
40
      fi
32 41

  
33
    ip route del default via $GATEWAY dev $VLAN table $TABLE
34
    ip route del $SUBNET dev $VLAN table $TABLE
42
      ip route del $SUBNET dev $VLAN table $TABLE
35 43

  
36
    ip route del $SUBNET dev $VLAN table main 
44
      ip route del $SUBNET dev $VLAN table main 
37 45

  
38
    ip rule del iif $VLAN table $TABLE
39
    
46
      ip rule del iif $VLAN table $TABLE
47
    fi
48
    if [ -n "$SUBNET6" ]; then
49
      if [ -n "$GATEWAY6" ]; then
50
        ip -6 route del default via $GATEWAY6 dev $VLAN table $TABLE
51
      fi
52
      ip -6 route add $SUBNET6 dev $VLAN table $TABLE
53
      ip -6 route add $SUBNET6 dev $VLAN table main
54
      ip -6 rule add iff $VLAN table $TABLE
55
    fi
40 56
    sed -i 's/.*'"$TABLE"'$//' $RT_TABLES
57
    
41 58
  fi
42 59
fi
43 60

  

Also available in: Unified diff