Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the options to specify "host" (and "socket") for the host system network stack #1525

Merged
merged 1 commit into from
May 3, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -604,7 +604,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