Skip to content

Commit

Permalink
Merge pull request #1525 from hannesm/rename-direct-socket
Browse files Browse the repository at this point in the history
add the options to specify "host" (and "socket") for the host system network stack
  • Loading branch information
hannesm committed May 3, 2024
2 parents 481ceff + ed3b4c4 commit dcb0462
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
8 changes: 6 additions & 2 deletions lib/devices/key.ml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@ let dhcp ?group () =
let doc = Fmt.str "Enable dhcp for %a." pp_group group in
configure_key ~doc ?group ~default:false Arg.bool "dhcp"

let net ?group () : [ `Socket | `Direct ] option Key.key =
let enum = [ ("socket", `Socket); ("direct", `Direct) ] in
let net ?group () : [ `Host | `OCaml ] option Key.key =
let enum =
[
("host", `Host); ("socket", `Host); ("direct", `OCaml); ("ocaml", `OCaml);
]
in
let conv = Cmdliner.Arg.enum enum in
let doc =
Fmt.str "Use %s group for %a."
Expand Down
4 changes: 2 additions & 2 deletions lib/devices/key.mli
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ val block : ?group:string -> unit -> [ `XenstoreId | `BlockFile | `Ramdisk ] key
val dhcp : ?group:string -> unit -> bool key
(** Enable dhcp. Is either [true] or [false]. *)

val net : ?group:string -> unit -> [ `Direct | `Socket ] option key
(** The type of stack. Is either ["direct"] or ["socket"]. *)
val net : ?group:string -> unit -> [ `OCaml | `Host ] option key
(** The type of stack. Is either ["ocaml"] or ["host"]. *)
2 changes: 1 addition & 1 deletion lib/devices/stack.ml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ let generic_stackv4v6 ?group ?ipv6_config ?ipv4_config
let choose target net dhcp =
match (target, net, dhcp) with
| `Qubes, _, _ -> `Qubes
| _, Some `Socket, _ -> `Socket
| _, Some `Host, _ -> `Socket
| _, _, true -> `Dhcp
| (`Unix | `MacOSX), None, false -> `Socket
| _, _, _ -> `Static
Expand Down
2 changes: 1 addition & 1 deletion lib/devices/stack.mli
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ val generic_stackv4v6 :
?ipv6_config:Ip.ipv6_config ->
?ipv4_config:Ip.ipv4_config ->
?dhcp_key:bool value ->
?net_key:[ `Direct | `Socket ] option value ->
?net_key:[ `OCaml | `Host ] option value ->
?tcp:Tcp.tcpv4v6 impl ->
Network.network impl ->
stackv4v6 impl
2 changes: 1 addition & 1 deletion lib/mirage.mli
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ val generic_stackv4v6 :
?ipv6_config:ipv6_config ->
?ipv4_config:ipv4_config ->
?dhcp_key:bool value ->
?net_key:[ `Direct | `Socket ] option value ->
?net_key:[ `OCaml | `Host ] option value ->
?tcp:tcpv4v6 impl ->
network impl ->
stackv4v6 impl
Expand Down

0 comments on commit dcb0462

Please sign in to comment.