Permalink
Browse files

CA-74932: networkd: remove existing IPv4 addresses when configuring s…

…tatic IP

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
  • Loading branch information...
1 parent d94c241 commit 731a05714e71ace0c9dfa7c0860db758071b740e @robhoes robhoes committed Mar 13, 2012
Showing with 4 additions and 1 deletion.
  1. +1 −0 ocaml/network/network_server.ml
  2. +3 −1 ocaml/network/network_utils.ml
@@ -243,6 +243,7 @@ module Interface = struct
| Static4 addrs ->
if Dhclient.is_running name then
ignore (Dhclient.stop name);
+ Ip.flush_ip_addr name;
List.iter (Ip.set_ip_addr name) addrs
let set_ipv4_conf _ ~name ~conf =
@@ -326,7 +326,9 @@ module Ip = struct
let flush_ip_addr ?(ipv6=false) dev =
let ipv6' = if ipv6 then ["-6"] else ["-4"] in
- ignore (call(ipv6' @ ["addr"; "flush"; "dev"; dev]))
+ try
+ ignore (call(ipv6' @ ["addr"; "flush"; "dev"; dev]))
+ with _ -> ()
let route_show ?(version=V46) dev =
let v = string_of_version version in

0 comments on commit 731a057

Please sign in to comment.