Skip to content

Commit

Permalink
add the options to specify "host" (and "socket") for the host system …
Browse files Browse the repository at this point in the history
…network stack.

the native ocaml stack can be used by passing "OCaml" or "direct".

over time, the confusion of "direct" has escalated. it is kept for backwards compatibility
  • Loading branch information
hannesm committed Apr 26, 2024
1 parent 88faf8f commit 2d50081
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/devices/key.ml
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ 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

0 comments on commit 2d50081

Please sign in to comment.