incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yas...@apache.org
Subject [3/28] git commit: refs/heads/master - IPv6: Enable IPv6 address for router
Date Thu, 31 Jan 2013 23:08:03 GMT
IPv6: Enable IPv6 address for router


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/6169c1d7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6169c1d7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6169c1d7

Branch: refs/heads/master
Commit: 6169c1d724b5e0d94dfa7dbe68555cdc3ea043ff
Parents: bd4bc02
Author: Sheng Yang <sheng.yang@citrix.com>
Authored: Thu Jan 24 20:09:37 2013 -0800
Committer: Sheng Yang <sheng.yang@citrix.com>
Committed: Sat Jan 26 23:14:21 2013 -0800

----------------------------------------------------------------------
 .../debian/config/etc/init.d/cloud-early-config    |   35 ++++++++++++++-
 patches/systemvm/debian/config/etc/sysctl.conf     |    6 +-
 .../router/VirtualNetworkApplianceManagerImpl.java |   20 +++++++-
 3 files changed, 54 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6169c1d7/patches/systemvm/debian/config/etc/init.d/cloud-early-config
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
index 285a92f..74b963b 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
@@ -229,6 +229,23 @@ setup_interface() {
   fi
 }
 
+setup_interface_ipv6() {
+  sysctl net.ipv6.conf.all.disable_ipv6=0
+  sysctl net.ipv6.conf.all.accept_ra=1
+  
+  local intfnum=$1
+  local ipv6="$2"
+  local prelen="$3"
+  local intf=eth${intfnum}
+  
+  echo "iface $intf inet6 static" >> /etc/network/interfaces
+  echo "  address $ipv6 " >> /etc/network/interfaces
+  echo "  netmask $prelen" >> /etc/network/interfaces
+  echo "  accept_ra 1" >> /etc/network/interfaces
+  ifdown $intf
+  ifup $intf
+}
+
 enable_fwding() {
   local enabled=$1
   log_it "cloud: enable_fwding = $1"
@@ -303,7 +320,14 @@ disable_hvc() {
 
 setup_common() {
   init_interfaces $1 $2 $3
-  setup_interface "0" $ETH0_IP $ETH0_MASK $GW
+  if [ -n "$ETH0_IP" ]
+  then
+    setup_interface "0" $ETH0_IP $ETH0_MASK $GW
+  fi
+  if [ -n "$ETH0_IP6" ]
+  then
+	  setup_interface_ipv6 "0" $ETH0_IP6 $ETH0_IP6_PRELEN
+  fi
   setup_interface "1" $ETH1_IP $ETH1_MASK $GW
   if [ -n "$ETH2_IP" ]
   then
@@ -903,6 +927,9 @@ for i in $CMDLINE
       gateway)
           GW=$VALUE
           ;;
+      ip6gateway)
+          IP6GW=$VALUE
+          ;;
       eth0mask)
           ETH0_MASK=$VALUE
           ;;
@@ -912,6 +939,12 @@ for i in $CMDLINE
       eth2mask)
           ETH2_MASK=$VALUE
           ;;
+      eth0ip6)
+          ETH0_IP6=$VALUE
+          ;;
+      eth0ip6prelen)
+          ETH0_IP6_PRELEN=$VALUE
+          ;;
       internaldns1)
           internalNS1=$VALUE
           ;;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6169c1d7/patches/systemvm/debian/config/etc/sysctl.conf
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/etc/sysctl.conf b/patches/systemvm/debian/config/etc/sysctl.conf
index 961d471..586d5bd 100644
--- a/patches/systemvm/debian/config/etc/sysctl.conf
+++ b/patches/systemvm/debian/config/etc/sysctl.conf
@@ -42,8 +42,8 @@ net.ipv4.tcp_max_tw_buckets=1000000
 net.core.somaxconn=1000000
 
 # Disable IPv6
-net.ipv6.conf.all.disable_ipv6 = 1
-net.ipv6.conf.all.forwarding = 0
-net.ipv6.conf.all.accept_ra = 0
+net.ipv6.conf.all.disable_ipv6 = 0
+net.ipv6.conf.all.forwarding = 1
+net.ipv6.conf.all.accept_ra = 1
 net.ipv6.conf.all.accept_redirects = 0
 net.ipv6.conf.all.autoconf = 0

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6169c1d7/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index c0e7888..679ca24 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1886,11 +1886,25 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
         String defaultDns2 = null;
         for (NicProfile nic : profile.getNics()) {
             int deviceId = nic.getDeviceId();
-            buf.append(" eth").append(deviceId).append("ip=").append(nic.getIp4Address());
-            buf.append(" eth").append(deviceId).append("mask=").append(nic.getNetmask());
+            boolean ipv4 = false, ipv6 = false;
+            if (nic.getIp4Address() != null) {
+            	ipv4 = true;
+            	buf.append(" eth").append(deviceId).append("ip=").append(nic.getIp4Address());
+            	buf.append(" eth").append(deviceId).append("mask=").append(nic.getNetmask());
+            }
+            if (nic.getIp6Address() != null) {
+            	ipv6 = true;
+            	buf.append(" eth").append(deviceId).append("ip6=").append(nic.getIp6Address());
+            	buf.append(" eth").append(deviceId).append("ip6prelen=").append(NetUtils.getIp6CidrSize(nic.getIp6Cidr()));
+            }
             
             if (nic.isDefaultNic()) {
-                buf.append(" gateway=").append(nic.getGateway());
+            	if (ipv4) {
+            		buf.append(" gateway=").append(nic.getGateway());
+            	}
+            	if (ipv6) {
+            		buf.append(" ip6gateway=").append(nic.getIp6Gateway());
+            	}
                 defaultDns1 = nic.getDns1();
                 defaultDns2 = nic.getDns2();
             }


Mime
View raw message