@@ -55,8 +55,8 @@ count=0
5555
5656
5757# fetching the dns Ips from the command line.
58- dns1=$( echo " $CMDLINE " | grep -o " dns1=.* " | sed -e ' s/dns1=//' | awk ' {print $1}' )
59- dns2=$( echo " $CMDLINE " | grep -o " dns2=.* " | sed -e ' s/dns2=//' | awk ' {print $1}' )
58+ dns1=$( echo " $CMDLINE " | grep -o " dns1=[[:digit:]] .* " | sed -e ' s/dns1=//' | awk ' {print $1}' )
59+ dns2=$( echo " $CMDLINE " | grep -o " dns2=[[:digit:]] .* " | sed -e ' s/dns2=//' | awk ' {print $1}' )
6060
6161dns_servers=" ${dns1} "
6262if [ -n " $dns2 " ]
8989
9090# logging the configuration being removed.
9191log=" "
92- log=" ${log} " ` grep " ^dhcp-option=6.*" " $DHCP_CONFIG_MAIN " ` " \n"
93- log=" ${log} " ` grep " ^dhcp-option=option:router.*" " $DHCP_CONFIG_MAIN " ` " \n"
94- log=" ${log} " ` grep " ^dhcp-range=.*" " $DHCP_CONFIG_MAIN " ` " \n"
95- echo -e " $log " > log.dnsmasq.txt
92+ log=" ${log} " ` grep " ^dhcp-option=6" " $DHCP_CONFIG_MAIN " ` " \n"
93+ log=" ${log} " ` grep " ^dhcp-option=option:router" " $DHCP_CONFIG_MAIN " ` " \n"
94+ log=" ${log} " ` grep " ^dhcp-range=" " $DHCP_CONFIG_MAIN " ` " \n"
9695
9796if [ " $log " != ' \n\n\n' ]
9897then
9998 # Cleaning the existing dhcp confgiuration
10099 logger -t cloud " dnsmasq.sh: remvoing the primaryip confg from dnsmasq.conf and adding it to /etc/dnsmaq.d/multiple_ranges.conf"
101100 logger -t cloud " dnsmasq.sh: config removed from dnsmasq.conf is $log "
102- sed -i -e ' /dhcp-option=6.* /d' " $DHCP_CONFIG_MAIN "
103- sed -i -e ' /dhcp-option=option:router.* /d' " $DHCP_CONFIG_MAIN "
104- sed -i -e ' /dhcp-range=.* /d' " $DHCP_CONFIG_MAIN "
101+ sed -i -e ' /dhcp-option=6/d' " $DHCP_CONFIG_MAIN "
102+ sed -i -e ' /dhcp-option=option:router/d' " $DHCP_CONFIG_MAIN "
103+ sed -i -e ' /^ dhcp-range=/d' " $DHCP_CONFIG_MAIN "
105104fi
106105
107106# wrting the new config into the config file.
0 commit comments