mirror of
https://github.com/mirage/qubes-mirage-firewall.git
synced 2025-01-13 16:19:27 -05:00
Add a comment about our usage of List.hd (which can fail) and String.split_on_char
This commit is contained in:
parent
ad1afe99ee
commit
3dc545681d
2
dao.ml
2
dao.ml
@ -81,6 +81,8 @@ let vifs client domid =
|
||||
let get_client_ip () =
|
||||
let* str = Xen_os.Xs.read handle (Fmt.str "%s/%d/ip" path device_id) in
|
||||
let client_ip = List.hd (String.split_on_char ' ' str) in
|
||||
(* XXX(dinosaure): it's safe to use [List.hd] here,
|
||||
[String.split_on_char] can not return an empty list. *)
|
||||
Lwt.return_some (vif, Ipaddr.V4.of_string_exn client_ip)
|
||||
in
|
||||
Lwt.catch get_client_ip @@ function
|
||||
|
Loading…
Reference in New Issue
Block a user