File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -737,11 +737,21 @@ module Interface = struct
737737 ) ) ->
738738 update_config name c ;
739739 exec (fun () ->
740- (* Old configs used empty dns lists to mean none, keep that
741- behaviour instead of writing an empty resolv.conf *)
742740 match dns with
743- | None | Some ( [] , [] ) ->
741+ | None ->
744742 ()
743+ | Some ([] , [] ) -> (
744+ match (ipv4_conf, ipv6_conf) with
745+ | Static4 _ , _ | _ , Static6 _ | _ , Autoconf6 ->
746+ (* clear DNS for Static mode *)
747+ set_dns () dbg ~name ~nameservers: [] ~domains: []
748+ | _ ->
749+ (* networkd.db in v25.28.0 and before stores empty
750+ dns lists for DHCP mode, this case is to keep
751+ resolv.conf intact when Toolstack update from
752+ version earlier than v25.28.0 *)
753+ ()
754+ )
745755 | Some (nameservers , domains ) ->
746756 set_dns () dbg ~name ~nameservers ~domains
747757 ) ;
Original file line number Diff line number Diff line change @@ -638,8 +638,10 @@ let bring_pif_up ~__context ?(management_interface = false) (pif : API.ref_PIF)
638638 in
639639 let dns =
640640 match (static, rc.API. pIF_DNS) with
641- | false , _ | true , "" ->
641+ | false , _ ->
642642 None
643+ | true , "" ->
644+ Some ([] , [] )
643645 | true , pif_dns ->
644646 let nameservers =
645647 List. map Unix. inet_addr_of_string
You can’t perform that action at this time.
0 commit comments