Skip to content

Commit af0b2bb

Browse files
committed
CA-323523: Restrict the interface of the Dhclient module
Signed-off-by: Rob Hoes <[email protected]>
1 parent 65a652f commit af0b2bb

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/network_utils.ml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,17 @@ module Linux_bonding = struct
722722
error "Bond %s does not exist; cannot set properties" master
723723
end
724724

725-
module Dhclient = struct
725+
module Dhclient :
726+
sig
727+
type interface = string
728+
val remove_conf_file : ?ipv6:bool -> interface -> unit
729+
val is_running : ?ipv6:bool -> interface -> bool
730+
val stop : ?ipv6:bool -> interface -> unit
731+
val ensure_running : ?ipv6:bool -> interface -> [> `dns of string | `gateway of string ] list -> unit
732+
end =
733+
struct
734+
type interface = string
735+
726736
let pid_file ?(ipv6=false) interface =
727737
let ipv6' = if ipv6 then "6" else "" in
728738
Printf.sprintf "/var/run/dhclient%s-%s.pid" ipv6' interface

networkd/network_server.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ module Interface = struct
327327
Sysctl.set_ipv6_autoconf name false;
328328
Ip.flush_ip_addr ~ipv6:true name;
329329
Ip.set_ipv6_link_local_addr name;
330-
ignore (Dhclient.start ~ipv6:true name [])
330+
ignore (Dhclient.ensure_running ~ipv6:true name [])
331331
| Autoconf6 ->
332332
if Dhclient.is_running ~ipv6:true name then
333333
ignore (Dhclient.stop ~ipv6:true name);

0 commit comments

Comments
 (0)