From f409a9535ffac8a4c3a1821b24a4b95392eabb43 Mon Sep 17 00:00:00 2001 From: Abhinandan Prateek Date: Wed, 10 Aug 2011 15:43:04 +0530 Subject: [PATCH] bug 10812: adding the domain serach order to option 15, now the dhcp client is able to set this for search entry --- .../config/etc/init.d/cloud-early-config | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) 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 39449f585b7..2785816331d 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -256,15 +256,28 @@ setup_dnsmasq() { log_it "Setting up dnsmasq" [ -z $DHCP_RANGE ] && DHCP_RANGE=$ETH0_IP [ -z $DOMAIN ] && DOMAIN="cloudnine.internal" + if [ -n "$DOMAIN" ] then - #send domain name to dhcp clients - sed -i s/[#]*dhcp-option=15.*$/dhcp-option=15,\"$DOMAIN\"/ /etc/dnsmasq.conf - #DNS server will append $DOMAIN to local queries - sed -r -i s/^[#]?domain=.*$/domain=$DOMAIN/ /etc/dnsmasq.conf - #answer all local domain queries - sed -i -e "s/^[#]*local=.*$/local=\/$DOMAIN\//" /etc/dnsmasq.conf + #send domain name to dhcp clients + sed -i s/[#]*dhcp-option=15.*$/dhcp-option=15,\"$DOMAIN\"/ /etc/dnsmasq.conf + #DNS server will append $DOMAIN to local queries + sed -r -i s/^[#]?domain=.*$/domain=$DOMAIN/ /etc/dnsmasq.conf + #answer all local domain queries + sed -i -e "s/^[#]*local=.*$/local=\/$DOMAIN\//" /etc/dnsmasq.conf fi + + if [ -n "$DNS_SEARCH_ORDER" ] + then + sed -i -e "/^[#]*dhcp-option.*=119.*$/d" /etc/dnsmasq.conf + echo "dhcp-option-force=119,$DNS_SEARCH_ORDER" >> /etc/dnsmasq.conf + # set the domain search order as a space seprated list for option 15 + DNS_SEARCH_ORDER=$(echo $DNS_SEARCH_ORDER | sed 's/,/ /g') + #send domain name to dhcp clients + sed -i s/[#]*dhcp-option=15.*$/dhcp-option=15,\""$DNS_SEARCH_ORDER"\"/ /etc/dnsmasq.conf + fi + + sed -i -e "s/^dhcp-range=.*$/dhcp-range=$DHCP_RANGE,static/" /etc/dnsmasq.conf sed -i -e "s/^[#]*listen-address=.*$/listen-address=$ETH0_IP/" /etc/dnsmasq.conf @@ -276,11 +289,6 @@ setup_dnsmasq() { echo "dhcp-option=6,$GUEST_GW" >> /etc/dnsmasq.conf fi - if [ -n "$DNS_SEARCH_ORDER" ] - then - sed -i -e "/^[#]*dhcp-option=119.*$/d" /etc/dnsmasq.conf - echo "dhcp-option=119,$DNS_SEARCH_ORDER" >> /etc/dnsmasq.conf - fi }