bug 10812: adding the domain serach order to option 15, now the dhcp client is able to set this for search entry

This commit is contained in:
Abhinandan Prateek 2011-08-10 15:43:04 +05:30 committed by root
parent 9bba09857e
commit f409a9535f

View File

@ -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
}