incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthon...@apache.org
Subject git commit: refs/heads/4.1 - CLOUDSTACK-1199: add external DNS to dnsmasq configuration file
Date Sat, 09 Feb 2013 00:34:31 GMT
Updated Branches:
  refs/heads/4.1 4da47c2ff -> 0923bf8f8


CLOUDSTACK-1199:  add external DNS to dnsmasq configuration file


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

Branch: refs/heads/4.1
Commit: 0923bf8f85a53a060119c4045451f786a81b8ae0
Parents: 4da47c2
Author: anthony <anthony@cloud.com>
Authored: Fri Feb 8 16:26:44 2013 -0800
Committer: anthony <anthony@cloud.com>
Committed: Fri Feb 8 16:32:24 2013 -0800

----------------------------------------------------------------------
 .../debian/config/etc/init.d/cloud-early-config    |   58 ++++++---------
 patches/systemvm/debian/config/root/edithosts.sh   |   15 +---
 2 files changed, 28 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/0923bf8f/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 db2fcc2..78231fb 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
@@ -440,12 +440,30 @@ setup_dnsmasq() {
 
   if [ "$RROUTER" == "1" ]
   then
-      sed -i -e "/^[#]*dhcp-option=option:router.*$/d" /etc/dnsmasq.conf
-      echo "dhcp-option=option:router,$GUEST_GW" >> /etc/dnsmasq.conf
-      sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf
-      echo "dhcp-option=6,$GUEST_GW" >> /etc/dnsmasq.conf
+    DEFAULT_GW=$GUEST_GW
+    INTERNAL_DNS=$GUEST_GW
+  else
+    if [ "$TYPE" == "dhcpsrvr" ]
+    then
+      DEFAULT_GW=$GW
+    else
+      DEFAULT_GW=$ETH0_IP
+    fi
+    INTERNAL_DNS=$ETH0_IP
   fi
-
+  sed -i -e "/^[#]*dhcp-option=option:router.*$/d" /etc/dnsmasq.conf
+  [ $DEFAULT_GW ] && echo "dhcp-option=option:router,$DEFAULT_GW" >> /etc/dnsmasq.conf
+  NS=$NS1
+  [ -n "$NS2" ] && NS=$NS1,$NS2
+    #for now set up ourself as the dns server as well
+  sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf
+  if [ "$USE_EXTERNAL_DNS" == "true" ]
+  then
+    [ $ETH0_IP ] && echo "dhcp-option=6,$NS" >> /etc/dnsmasq.conf
+  else
+    [ $ETH0_IP ] && echo "dhcp-option=6,$INTERNAL_DNS,$NS" >> /etc/dnsmasq.conf
+  fi
+  [ $ETH0_IP6 ] && echo "dhcp-option=option6:dns-server,[::]" >> /etc/dnsmasq.conf
 }
 
 setup_sshd(){
@@ -606,14 +624,6 @@ setup_router() {
   
   setup_dnsmasq
   
-  NS=$NS1
-  [ -n "$NS2" ] && NS=$NS1,$NS2
-  if [ "$USE_EXTERNAL_DNS" == "true" ]
-  then
-      sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf
-      echo "dhcp-option=6,$NS" >> /etc/dnsmasq.conf
-  fi
-  
   setup_apache2 $ETH0_IP
 
   sed -i  /gateway/d /etc/hosts
@@ -715,28 +725,6 @@ setup_dhcpsrvr() {
   setup_dnsmasq
   setup_apache2 $ETH0_IP
 
-  NS=$NS1
-  [ -n "$NS2" ] && NS=$NS1,$NS2
-  if [ "$DEFAULTROUTE" != "false" ]
-  then
-    sed -i -e "/^[#]*dhcp-option=option:router.*$/d" /etc/dnsmasq.conf
-    [ $GW ] && echo "dhcp-option=option:router,$GW" >> /etc/dnsmasq.conf
-    #for now set up ourself as the dns server as well
-    sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf
-    if [ "$USE_EXTERNAL_DNS" == "true" ]
-    then
-        echo "dhcp-option=6,$NS" >> /etc/dnsmasq.conf
-    else
-        [ $ETH0_IP ] && echo "dhcp-option=6,$ETH0_IP,$NS" >> /etc/dnsmasq.conf
-        [ $ETH0_IP6 ] && echo "dhcp-option=option6:dns-server,[::]" >> /etc/dnsmasq.conf
-    fi
-  else
-    sed -i -e "/^[#]*dhcp-option=option:router.*$/d" /etc/dnsmasq.conf
-    echo "dhcp-option=option:router" >> /etc/dnsmasq.conf
-    sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf
-    echo "dhcp-option=6,$NS" >> /etc/dnsmasq.conf
-  fi
-
   sed -i  /gateway/d /etc/hosts
   [ $ETH0_IP ] && echo "$ETH0_IP $NAME" >> /etc/hosts
   [ $ETH0_IP6 ] && echo "$ETH0_IP6 $NAME" >> /etc/hosts

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/0923bf8f/patches/systemvm/debian/config/root/edithosts.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/root/edithosts.sh b/patches/systemvm/debian/config/root/edithosts.sh
index 3cf2742..257de92 100755
--- a/patches/systemvm/debian/config/root/edithosts.sh
+++ b/patches/systemvm/debian/config/root/edithosts.sh
@@ -173,18 +173,13 @@ then
 
   tag=$(echo $ipv4 | tr '.' '_')
   sed -i /$tag/d $DHCP_OPTS
-  if [ "$dflt" != "0.0.0.0" ]
-  then
-      logger -t cloud "$0: setting default router for $ipv4 to $dflt"
-      echo "$tag,3,$dflt" >> $DHCP_OPTS
-  else
-      logger -t cloud "$0: unset default router for $ipv4"
-      echo "$tag,3," >> $DHCP_OPTS
-  fi
-  if [ "$dns" != "" ] 
+  if [ "$dflt" == "0.0.0.0" ]
   then
+    logger -t cloud "$0: unset default router for $ipv4"
+    echo "$tag,3" >> $DHCP_OPTS
     logger -t cloud "$0: setting dns server for $ipv4 to $dns"
-    echo "$tag,6,$dns" >> $DHCP_OPTS
+    echo "$tag,6" >> $DHCP_OPTS
+    echo "$tag,15" >> $DHCP_OPTS
   fi
   [ "$routes" != "" ] && echo "$tag,121,$routes" >> $DHCP_OPTS
   #delete entry we just put in because we need a tag


Mime
View raw message