Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions ocaml/networkd/bin/network_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,21 @@ module Interface = struct
) ) ->
update_config name c ;
exec (fun () ->
(* Old configs used empty dns lists to mean none, keep that
behaviour instead of writing an empty resolv.conf *)
match dns with
| None | Some ([], []) ->
| None ->
()
| Some ([], []) -> (
match (ipv4_conf, ipv6_conf) with
| Static4 _, _ | _, Static6 _ | _, Autoconf6 ->
(* clear DNS for Static mode *)
set_dns () dbg ~name ~nameservers:[] ~domains:[]
| _ ->
(* networkd.db in v25.28.0 and before stores empty
dns lists for DHCP mode, this case is to keep
resolv.conf intact when Toolstack update from
version earlier than v25.28.0 *)
()
)
| Some (nameservers, domains) ->
set_dns () dbg ~name ~nameservers ~domains
) ;
Expand Down
4 changes: 3 additions & 1 deletion ocaml/xapi/nm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,10 @@ let bring_pif_up ~__context ?(management_interface = false) (pif : API.ref_PIF)
in
let dns =
match (static, rc.API.pIF_DNS) with
| false, _ | true, "" ->
| false, _ ->
None
| true, "" ->
Some ([], [])
| true, pif_dns ->
let nameservers =
List.map Unix.inet_addr_of_string
Expand Down
Loading