From dd64fdbbb34998f760924921c490ebf56e0027da Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Mon, 21 Dec 2020 14:46:23 +0100 Subject: [PATCH] dual stack support --- monitoring-experiments.opam | 2 +- src/monitoring_experiments.ml | 10 +++++----- src/monitoring_experiments.mli | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/monitoring-experiments.opam b/monitoring-experiments.opam index d81e0b5..23e0975 100644 --- a/monitoring-experiments.opam +++ b/monitoring-experiments.opam @@ -16,7 +16,7 @@ depends: [ "astring" {>= "0.8.3"} "mirage-clock" {>= "3.0.0"} "mirage-time" {>= "2.0.0"} - "mirage-stack" {>= "2.0.0"} + "mirage-stack" {>= "2.2.0"} "tcpip" {>= "5.0.99"} "mirage-net-solo5" {>= "0.6.2"} "mirage-solo5" {>= "0.6.3"} diff --git a/src/monitoring_experiments.ml b/src/monitoring_experiments.ml index c9ddafa..6f2eabf 100644 --- a/src/monitoring_experiments.ml +++ b/src/monitoring_experiments.ml @@ -29,7 +29,7 @@ let counter_metrics ~f name = let vmname = Metrics.field ~doc:"name of the virtual machine" "vm" Metrics.String -module Make (T : Mirage_time.S) (S : Mirage_stack.V4) = struct +module Make (T : Mirage_time.S) (S : Mirage_stack.V4V6) = struct let timer conn get host stack dst = let datas = @@ -41,20 +41,20 @@ module Make (T : Mirage_time.S) (S : Mirage_stack.V4) = struct let datas = String.concat "" datas in let write flow = Log.debug (fun m -> m "sending measurements"); - S.TCPV4.write flow (Cstruct.of_string datas) >|= function + S.TCP.write flow (Cstruct.of_string datas) >|= function | Ok () -> () | Error e -> - Log.err (fun m -> m "error %a writing to metrics" S.TCPV4.pp_write_error e); + Log.err (fun m -> m "error %a writing to metrics" S.TCP.pp_write_error e); conn := None in match !conn with | None -> begin Log.debug (fun m -> m "creating connection"); - S.TCPV4.create_connection (S.tcpv4 stack) dst >>= function + S.TCP.create_connection (S.tcp stack) dst >>= function | Error msg -> Log.err (fun m -> m "couldn't create connection %a" - S.TCPV4.pp_error msg); + S.TCP.pp_error msg); Lwt.return_unit | Ok flow -> conn := Some flow; diff --git a/src/monitoring_experiments.mli b/src/monitoring_experiments.mli index 5d19523..41da9e4 100644 --- a/src/monitoring_experiments.mli +++ b/src/monitoring_experiments.mli @@ -5,6 +5,6 @@ val counter_metrics : f:('a -> string) -> string -> val vmname : string -> Metrics.field (** [vmname name] creates a [tag] with the virtual machine name. *) -module Make (T : Mirage_time.S) (S : Mirage_stack.V4) : sig - val create : ?interval:int -> ?hostname:string -> Ipaddr.V4.t -> ?port:int -> S.t -> unit +module Make (T : Mirage_time.S) (S : Mirage_stack.V4V6) : sig + val create : ?interval:int -> ?hostname:string -> Ipaddr.t -> ?port:int -> S.t -> unit end