@@ -743,7 +743,11 @@ module Dhclient = struct
743743 then (debug " %s is the default gateway interface" interface; [" routers" ])
744744 else (debug " %s is NOT the default gateway interface" interface; [] )
745745 in
746- let set_dns = if List. mem `set_dns options then [" domain-name" ; " domain-name-servers" ] else [] in
746+ let set_dns =
747+ if List. mem (`dns interface) options
748+ then (debug " %s is the DNS interface" interface; [" domain-name" ; " domain-name-servers" ])
749+ else (debug " %s is NOT the DNS interface" interface; [] )
750+ in
747751 let request = minimal @ set_gateway @ set_dns in
748752 Printf. sprintf " interface \" %s\" {\n request %s;\n }\n " interface (String. concat " , " request)
749753
@@ -760,19 +764,22 @@ module Dhclient = struct
760764 (* This prevents the default route being set erroneously on CentOS *)
761765 (* Normally this wouldn't happen as we're not requesting routers, *)
762766 (* but some buggy DHCP servers ignore this *)
767+ (* Same story for DNS! *)
763768 (* See CA-137892 *)
764769 let gw_opt = List. fold_left
765770 (fun l x ->
766771 match x with
767772 | `gateway y -> [" -e" ; " GATEWAYDEV=" ^ y]
768773 | _ -> l) [] options in
774+ let dns_opt = if List. mem (`dns interface) options then [] else [" -e" ; " PEERDNS=no" ] in
769775 write_conf_file ~ipv6 interface options;
770776 let ipv6' = if ipv6 then [" -6" ] else [] in
771- call_script ~timeout: None dhclient (ipv6' @ gw_opt @ [" -q" ;
772- " -pf" ; pid_file ~ipv6 interface;
773- " -lf" ; lease_file ~ipv6 interface;
774- " -cf" ; conf_file ~ipv6 interface;
775- interface])
777+ call_script ~timeout: None dhclient (ipv6' @ gw_opt @ dns_opt @
778+ [" -q" ;
779+ " -pf" ; pid_file ~ipv6 interface;
780+ " -lf" ; lease_file ~ipv6 interface;
781+ " -cf" ; conf_file ~ipv6 interface;
782+ interface])
776783
777784 let stop ?(ipv6 =false ) interface =
778785 try
0 commit comments