diff --git a/.merlin b/.merlin index 7d5942ab2..1363999e5 100644 --- a/.merlin +++ b/.merlin @@ -1,8 +1,8 @@ PKG async async_kernel PKG re ipaddr uri base64 hashcons cstruct result cstruct.ppx PKG lwt mirage-profile cmdliner re.str lwt.uni uri.services ipaddr.unix -PKG io-page duration mirage-time-lwt mirage-stack-lwt mirage-kv-lwt -PKG oUnit pcap-format mirage-protocols mirage-kv io-page.unix +PKG duration mirage-time-lwt mirage-stack-lwt mirage-kv-lwt +PKG oUnit pcap-format mirage-protocols mirage-kv S lib S lib_test diff --git a/_tags b/_tags index dc7a554d4..b38be12d0 100644 --- a/_tags +++ b/_tags @@ -9,7 +9,7 @@ true : package(re re.str ipaddr uri base64 hashcons cstruct result) "lwt": include : package(lwt mirage-profile) : package(cmdliner lwt.unix uri.services ipaddr.unix lwt) -: package(io-page lwt duration mirage-time-lwt) +: package(lwt duration mirage-time-lwt) : package(mirage-stack-lwt mirage-kv-lwt) : package(async async_kernel threads), thread @@ -20,7 +20,7 @@ true : package(re re.str ipaddr uri base64 hashcons cstruct result) "async": include : package(lwt lwt.unix uri.services ipaddr.unix) : package(oUnit cstruct.ppx pcap-format lwt mirage-protocols) -: package(mirage-stack-lwt mirage-time-lwt mirage-kv io-page) +: package(mirage-stack-lwt mirage-time-lwt mirage-kv) : package(mirage-kv-lwt lwt.unix uri.services) -: package(mirage-profile lwt ipaddr.unix duration io-page.unix) -: package(async threads), thread +: package(mirage-profile lwt ipaddr.unix duration) +: package(async threads uri.services), thread diff --git a/async/async_dns_resolver.ml b/async/async_dns_resolver.ml index 53c34a54d..8d28f42b9 100644 --- a/async/async_dns_resolver.ml +++ b/async/async_dns_resolver.ml @@ -28,8 +28,8 @@ type result = Answer of DP.t | Err of exn type commfn = { log : Log.t option; - txfn : Buf.t -> unit Deferred.t; - rxfn : (Buf.t -> Packet.t option) -> DP.t Deferred.t; + txfn : Cstruct.t -> unit Deferred.t; + rxfn : (Cstruct.t -> Packet.t option) -> DP.t Deferred.t; timerfn : unit -> unit Deferred.t; cleanfn : unit -> unit Deferred.t; } @@ -50,9 +50,9 @@ let rec send_req txfn timerfn q = function send_req txfn timerfn q (count - 1) end -let send_pkt client { log; txfn; rxfn; timerfn; cleanfn } pkt = +let send_pkt ?alloc client { log; txfn; rxfn; timerfn; cleanfn } pkt = let module R = (val client: CLIENT ) in - let cqpl = R.marshal pkt in + let cqpl = R.marshal ?alloc pkt in let resl = List.map cqpl ~f:begin fun (ctxt, q) -> Deferred.any [ ((send_req txfn timerfn q 4) >>| fun () -> (Err (R.timeout ctxt))); (try_with (fun () -> rxfn (R.parse ctxt)) >>| function @@ -78,19 +78,19 @@ let send_pkt client { log; txfn; rxfn; timerfn; cleanfn } pkt = find_answer errors rs in select [] resl -let resolve ?(dnssec = false) client commfn q_class q_type q_name = +let resolve ?alloc ?(dnssec = false) client commfn q_class q_type q_name = Monitor.try_with_or_error begin fun () -> let id = (let module R = (val client: CLIENT ) in R.get_id ()) in let q = Dns.Query.create ~id ~dnssec q_class q_type q_name in - send_pkt client commfn q + send_pkt ?alloc client commfn q end >>| fun r -> don't_wait_for (commfn.cleanfn ()); r -let gethostbyname ?(q_class=DP.Q_IN) ?(q_type=DP.Q_A) commfn name = +let gethostbyname ?alloc ?(q_class=DP.Q_IN) ?(q_type=DP.Q_A) commfn name = let open DP in let domain = Name.of_string name in - resolve (module Dns.Protocol.Client) commfn q_class q_type domain >>| + resolve ?alloc (module Dns.Protocol.Client) commfn q_class q_type domain >>| Or_error.map ~f:begin fun r -> List.fold_right r.answers ~init:[] ~f:begin fun x a -> match x.rdata with diff --git a/async/async_dns_resolver.mli b/async/async_dns_resolver.mli index 4458170e6..4efebc861 100644 --- a/async/async_dns_resolver.mli +++ b/async/async_dns_resolver.mli @@ -24,13 +24,14 @@ open Dns type commfn = { log : Log.t option; - txfn : Buf.t -> unit Deferred.t; - rxfn : (Buf.t -> Packet.t option) -> Packet.t Deferred.t; + txfn : Cstruct.t -> unit Deferred.t; + rxfn : (Cstruct.t -> Packet.t option) -> Packet.t Deferred.t; timerfn : unit -> unit Deferred.t; cleanfn : unit -> unit Deferred.t; } val resolve : + ?alloc:(unit -> Cstruct.t) -> ?dnssec:bool -> (module Protocol.CLIENT) -> commfn -> @@ -39,6 +40,7 @@ val resolve : Name.t -> Packet.t Deferred.Or_error.t val gethostbyname : + ?alloc:(unit -> Cstruct.t) -> ?q_class:Packet.q_class -> ?q_type:Packet.q_type -> commfn -> diff --git a/async/async_dns_resolver_unix.ml b/async/async_dns_resolver_unix.ml index fe711c137..cdd19f3b1 100644 --- a/async/async_dns_resolver_unix.ml +++ b/async/async_dns_resolver_unix.ml @@ -38,7 +38,7 @@ let cleanfn ?log sock () = let connect_to_resolver ?log ?(timeout=Time_ns.Span.of_int_sec 1) ?(port=53) addr = let sock = Socket.create (Socket.Type.udp) in - let addr = sockaddr addr port in + let addr = sockaddr addr ~port in Monitor.try_with_or_error (fun () -> Socket.connect_interruptible sock addr ~interrupt:(Clock_ns.after timeout)) >>= begin function | Error e -> @@ -48,13 +48,13 @@ let connect_to_resolver ?log ?(timeout=Time_ns.Span.of_int_sec 1) ?(port=53) add | Ok (`Ok ac_sock) -> let txfn buf = let w = Writer.create (Socket.fd ac_sock) in - Writer.write_bigstring ~pos:0 ~len:(Buf.length buf) w buf; + Writer.write_bigstring ~pos:buf.Cstruct.off ~len:buf.Cstruct.len w buf.Cstruct.buffer; Writer.flushed w in let rec rxfn f = let r = Reader.create (Socket.fd ac_sock) in let handle_chunk (iobuf : ([ `Read | `Who_can_write of Core_kernel.Perms.me ], Iobuf.seek) Iobuf.t) = - match f @@ Iobuf.Consume.To_bigstring.subo (iobuf :> ([ `Read ], Iobuf.seek) Iobuf.t) with + match f @@ Cstruct.of_bigarray (Iobuf.Consume.To_bigstring.subo (iobuf :> ([ `Read ], Iobuf.seek) Iobuf.t)) with | None -> Option.iter log ~f:(fun log -> Log.error log "Received wrong data, retrying"); return `Continue diff --git a/doc/api.odocl b/doc/api.odocl index 9100704be..9c543fd41 100644 --- a/doc/api.odocl +++ b/doc/api.odocl @@ -9,7 +9,6 @@ Zone Zone_lexer Zone_parser Resolvconf -Buf Protocol Probe diff --git a/lib/buf.ml b/lib/buf.ml deleted file mode 100644 index 2ebcfe869..000000000 --- a/lib/buf.ml +++ /dev/null @@ -1,29 +0,0 @@ -(* - * Copyright (c) 2013 David Sheets - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - *) - -module B = Bigarray -module B1 = B.Array1 - -type t = (char, B.int8_unsigned_elt, B.c_layout) B1.t - -let default_allocator () = Bigarray.(Array1.create char c_layout 4096) - -let create ?(alloc=default_allocator) len = B1.sub (alloc ()) 0 len -let length = B1.dim -let of_cstruct c = Cstruct.(B1.sub c.buffer c.off c.len) -let shift b k = B1.sub b k (length b - k) -let sub = B1.sub diff --git a/lib/buf.mli b/lib/buf.mli deleted file mode 100644 index 6dc758e4d..000000000 --- a/lib/buf.mli +++ /dev/null @@ -1,32 +0,0 @@ -(* - * Copyright (c) 2013 David Sheets - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - *) - -(** Buffer handling for DNS packets *) - -(** A [t] is an externally managed Bigarray *) -type t = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t - -(** [create ?alloc b] will allocate a buffer of [b] bytes, where the - maximum size is 4096 bytes. - If [alloc] is supplied then it will be used to allocate the memory - page instead of the default [malloc]-based Bigarray create function. *) -val create : ?alloc:(unit -> t) -> int -> t - -val length : t -> int -val of_cstruct : Cstruct.t -> t -val shift : t -> int -> t -val sub : t -> int -> int -> t diff --git a/lib/dns.mlpack b/lib/dns.mlpack index 838c8e6f4..7984f2215 100644 --- a/lib/dns.mlpack +++ b/lib/dns.mlpack @@ -9,7 +9,6 @@ Zone Zone_lexer Zone_parser Resolvconf -Buf Protocol Dig Probe diff --git a/lib/packet.ml b/lib/packet.ml index f2411d48b..25baffe9c 100644 --- a/lib/packet.ml +++ b/lib/packet.ml @@ -1459,7 +1459,6 @@ let to_string d = (d.additionals ||> rr_to_string |> String.concat ",") let parse buf = - let buf = Cstruct.of_bigarray buf in let names = Hashtbl.create 32 in let parsen f base n buf typ = let rec aux acc n base buf = @@ -1489,12 +1488,12 @@ let parse buf = (* eprintf "RX: %s\n%!" (to_string dns); *) dns -let marshal txbuf dns = +let marshal ?(alloc = fun () -> Cstruct.create 4096) dns = + let txbuf = alloc () in let marshaln f names base buf values = List.fold_left f (names, base, buf) values in - let txbuf = Cstruct.of_bigarray txbuf in set_h_id txbuf dns.id; set_h_detail txbuf (marshal_detail dns.detail); set_h_qdcount txbuf (List.length dns.questions); @@ -1510,7 +1509,7 @@ let marshal txbuf dns = let names,base,buf = marshaln marshal_rr names base buf dns.authorities in let _,_,buf = marshaln marshal_rr names base buf dns.additionals in - let txbuf = Buf.sub txbuf.Cstruct.buffer 0 Cstruct.(len txbuf - len buf) in + let txbuf = Cstruct.(sub txbuf 0 (len txbuf - len buf)) in (* Cstruct.hexdump txbuf; *) (* eprintf "TX: %s\n%!" (txbuf |> parse (Hashtbl.create 8) |> to_string); *) txbuf diff --git a/lib/packet.mli b/lib/packet.mli index d0f45cf45..01232abfc 100644 --- a/lib/packet.mli +++ b/lib/packet.mli @@ -356,10 +356,10 @@ type t = { } val to_string : t -> string -val parse : Buf.t -> t +val parse : Cstruct.t -> t (** The marshalling entry point, given a {! dns} structure. @return the marshalled packet *) -val marshal : Buf.t -> t -> Buf.t +val marshal : ?alloc:(unit -> Cstruct.t) -> t -> Cstruct.t diff --git a/lib/protocol.ml b/lib/protocol.ml index 840995c7c..fda5fe69e 100644 --- a/lib/protocol.ml +++ b/lib/protocol.ml @@ -22,8 +22,8 @@ module type CLIENT = sig val get_id : unit -> int - val marshal : ?alloc:(unit -> Buf.t) -> Packet.t -> (context * Buf.t) list - val parse : context -> Buf.t -> Packet.t option + val marshal : ?alloc:(unit -> Cstruct.t) -> Packet.t -> (context * Cstruct.t) list + val parse : context -> Cstruct.t -> Packet.t option val timeout : context -> exn end @@ -37,7 +37,7 @@ module Client : CLIENT = struct Random.int (1 lsl 16) let marshal ?alloc q = - [q.Packet.id, Packet.marshal (Buf.create ?alloc 4096) q] + [q.Packet.id, Packet.marshal ?alloc q] let parse id buf = let pkt = Packet.parse buf in @@ -51,8 +51,8 @@ module type SERVER = sig val query_of_context : context -> Packet.t - val parse : Buf.t -> context option - val marshal : Buf.t -> context -> Packet.t -> Buf.t option + val parse : Cstruct.t -> context option + val marshal : ?alloc:(unit -> Cstruct.t) -> context -> Packet.t -> Cstruct.t option end @@ -70,6 +70,6 @@ module Server : SERVER with type context = Packet.t = struct let query_of_context x = x let parse buf = contain_exc "parse" (fun () -> Packet.parse buf) - let marshal buf _q response = - contain_exc "marshal" (fun () -> Packet.marshal buf response) + let marshal ?alloc _q response = + contain_exc "marshal" (fun () -> Packet.marshal ?alloc response) end diff --git a/lib/protocol.mli b/lib/protocol.mli index a8dd8405c..3a64fc9da 100644 --- a/lib/protocol.mli +++ b/lib/protocol.mli @@ -32,12 +32,12 @@ module type CLIENT = sig successful parse or timeout. With this behavior, it is easy to construct low-latency but network-environment-aware DNS resolvers. *) - val marshal : ?alloc:(unit -> Buf.t) -> Packet.t -> (context * Buf.t) list + val marshal : ?alloc:(unit -> Cstruct.t) -> Packet.t -> (context * Cstruct.t) list (** [parse ctxt buf] is the potential packet extracted out of [buf] with [ctxt] *) - val parse : context -> Buf.t -> Packet.t option + val parse : context -> Cstruct.t -> Packet.t option (** [timeout ctxt] is the exception resulting from a context [ctxt] that has timed-out @@ -61,15 +61,15 @@ module type SERVER = sig @param buf message buffer @return parsed packet and context *) - val parse : Buf.t -> context option + val parse : Cstruct.t -> context option (** DNS wire format marshal function. - @param buf output resource + @param alloc allocator @param _q context @param response answer packet @return buffer to write *) - val marshal : Buf.t -> context -> Packet.t -> Buf.t option + val marshal : ?alloc:(unit -> Cstruct.t) -> context -> Packet.t -> Cstruct.t option end (** The default DNS server using the standard DNS protocol *) diff --git a/lib_test/mirage-mdns/unikernel.ml b/lib_test/mirage-mdns/unikernel.ml index 4977d4f28..5af2d1346 100644 --- a/lib_test/mirage-mdns/unikernel.ml +++ b/lib_test/mirage-mdns/unikernel.ml @@ -28,7 +28,6 @@ module Main (C:CONSOLE) (K:KV_RO) (S:STACKV4) = struct let open Mdns_responder in let udp = S.udpv4 s in let module Responder = Make(struct - let alloc () = (Io_page.get 1 :> Dns.Buf.t) let write (dest_ip,dest_port) txbuf = U.write ~source_port:listening_port ~dest_ip:dest_ip ~dest_port udp (Cstruct.of_bigarray txbuf) let sleep t = OS.Time.sleep t diff --git a/lib_test/ounit/test_dns_server_mirage.ml b/lib_test/ounit/test_dns_server_mirage.ml index 28fa487b5..920ec8541 100644 --- a/lib_test/ounit/test_dns_server_mirage.ml +++ b/lib_test/ounit/test_dns_server_mirage.ml @@ -27,8 +27,8 @@ let simulate_query detail= {qr=Query; opcode=Standard; aa=false; tc=false; rd=true; ra=false; rcode=NoError}; questions=[question]; answers=[]; authorities=[]; additionals=[]; } in - let buf = marshal (Dns.Buf.create 512) request |> Cstruct.of_bigarray in - let listener_thread = match MockStack.udpv4_listeners stack 53 with + let buf = marshal request in + let listener_thread = match MockStack.udpv4_listeners stack ~dst_port:53 with | None -> assert_failure "missing listener" | Some listener -> listener ~src:from_ip ~dst:to_ip ~src_port:from_port buf in @@ -140,7 +140,7 @@ let tests = assert_equal ~printer:string_of_int 53 w.src_port; assert_ip client_ip w.dst; assert_equal ~printer:string_of_int 12345 w.dst_port; - let packet = parse (Dns.Buf.of_cstruct w.buf) in + let packet = parse w.buf in assert_packet ~prefix:"1" ~id:3848 packet {qr=Response; opcode=Standard; aa=true; tc=false; rd=true; ra=false; rcode=NoError} 1 1 2 3; @@ -170,7 +170,7 @@ let tests = assert_equal ~printer:string_of_int 53 w.src_port; assert_ip client_ip w.dst; assert_equal ~printer:string_of_int 12345 w.dst_port; - let packet = parse (Dns.Buf.of_cstruct w.buf) in + let packet = parse w.buf in assert_packet ~prefix:"2" ~id:19560 packet {qr=Response; opcode=Standard; aa=true; tc=false; rd=true; ra=false; rcode=NoError} 1 1 2 3; diff --git a/lib_test/ounit/test_mdns_resolver_mirage.ml b/lib_test/ounit/test_mdns_resolver_mirage.ml index aae4c6011..5d954cb58 100644 --- a/lib_test/ounit/test_mdns_resolver_mirage.ml +++ b/lib_test/ounit/test_mdns_resolver_mirage.ml @@ -87,6 +87,8 @@ module StubIpv4 = struct type uipaddr = Ipaddr.t let to_uipaddr ip = Ipaddr.V4 ip let of_uipaddr = Ipaddr.to_v4 + + let mtu _ = 1500 end @@ -269,8 +271,8 @@ let simulate_response stack = let response = { id; detail; questions=[]; answers; authorities=[]; additionals=[]; } in - let buf = marshal (Dns.Buf.create 512) response |> Cstruct.of_bigarray in - let listener_thread = match MockStack.udpv4_listeners stack 5353 with + let buf = marshal response in + let listener_thread = match MockStack.udpv4_listeners ~dst_port:5353 stack with | None -> assert_failure "missing listener" | Some listener -> listener ~src:from_ip ~dst:to_ip ~src_port:from_port buf in @@ -320,7 +322,7 @@ let tests = assert_equal ~printer:string_of_int 5353 w.src_port; assert_ip mdns_ip w.dst; assert_equal ~printer:string_of_int 5353 w.dst_port; - let packet = parse (Dns.Buf.of_cstruct w.buf) in + let packet = parse w.buf in (* AA bit MUST be zero; RA bit MUST be zero; RD bit SHOULD be zero *) let expected = "0000 Query:0 na:c:nr:rn 0 > " in assert_equal ~msg:"packet" ~printer:(fun s -> s) expected (to_string packet); @@ -372,7 +374,7 @@ let tests = assert_equal ~printer:string_of_int 5353 w2.src_port; assert_ip mdns_ip w2.dst; assert_equal ~printer:string_of_int 5353 w2.dst_port; - let query_packet = parse (Dns.Buf.of_cstruct w2.buf) in + let query_packet = parse w2.buf in (* AA bit MUST be zero; RA bit MUST be zero; RD bit SHOULD be zero *) let expected = "0000 Query:0 na:c:nr:rn 0 > " in assert_equal ~msg:"query_packet" ~printer:(fun s -> s) expected (to_string query_packet); @@ -409,7 +411,7 @@ let tests = assert_equal ~printer:string_of_int 5353 w.src_port; assert_ip mdns_ip w.dst; assert_equal ~printer:string_of_int 5353 w.dst_port; - let packet = parse (Dns.Buf.of_cstruct w.buf) in + let packet = parse w.buf in (* AA bit MUST be zero; RA bit MUST be zero; RD bit SHOULD be zero *) let expected = "0000 Query:0 na:c:nr:rn 0 > " in assert_equal ~msg:"packet" ~printer:(fun s -> s) expected (to_string packet); diff --git a/lib_test/ounit/test_mdns_responder.ml b/lib_test/ounit/test_mdns_responder.ml index 8b40eef2b..67de02ae5 100644 --- a/lib_test/ounit/test_mdns_responder.ml +++ b/lib_test/ounit/test_mdns_responder.ml @@ -14,8 +14,6 @@ let load_file path = let assert_range low high actual = assert_bool (sprintf "%f not in range %f <= x < %f" actual low high) (low <= actual && actual < high) -let allocfn () = Bigarray.Array1.create Bigarray.char Bigarray.c_layout 4096 - open Dns open Packet @@ -88,7 +86,7 @@ let tests = "q-A-AAAA" >:: (fun test_ctxt -> let txlist = ref [] in let module MockTransport = struct - let alloc () = allocfn () + let alloc () = Cstruct.create 4096 let write addr buf = txlist := (addr, buf) :: !txlist; Lwt.return () @@ -127,7 +125,7 @@ let tests = "q-legacy" >:: (fun test_ctxt -> let txlist = ref [] in let module MockTransport = struct - let alloc () = allocfn () + let alloc () = Cstruct.create 4096 let write addr buf = txlist := (addr, buf) :: !txlist; Lwt.return () @@ -173,7 +171,7 @@ let tests = "q-PTR-first" >:: (fun test_ctxt -> let txlist = ref [] in let module MockTransport = struct - let alloc () = allocfn () + let alloc () = Cstruct.create 4096 let write addr buf = txlist := (addr, buf) :: !txlist; Lwt.return () @@ -253,7 +251,7 @@ let tests = "q-PTR-known" >:: (fun test_ctxt -> let module MockTransport = struct - let alloc () = allocfn () + let alloc () = Cstruct.create 4096 let write addr buf = assert_failure "write shouldn't be called" let sleep t = @@ -275,7 +273,7 @@ let tests = let txlist = ref [] in let sleepl = ref [] in let module MockTransport = struct - let alloc () = allocfn () + let alloc () = Cstruct.create 4096 let write addr buf = txlist := (addr, buf) :: !txlist; Lwt.return () @@ -317,7 +315,7 @@ let tests = let cond = Lwt_condition.create () in let sleepl = ref [] in let module MockTransport = struct - let alloc () = allocfn () + let alloc () = Cstruct.create 4096 let write addr buf = txlist := (addr, buf) :: !txlist; Lwt.return () @@ -387,8 +385,8 @@ let tests = let cond = Lwt_condition.create () in let sleepl = ref [] in let module MockTransport = struct + let alloc () = Cstruct.create 4096 open Lwt - let alloc () = allocfn () let write addr buf = txlist := (addr, buf) :: !txlist; return_unit @@ -429,7 +427,7 @@ let tests = detail= {qr=Response; opcode=Standard; aa=true; tc=false; rd=false; ra=false; rcode=NoError}; questions=[]; answers=[answer]; authorities=[]; additionals=[]; } in - let response_buf = marshal (Dns.Buf.create 512) response in + let response_buf = marshal response in let _ = Responder.process responder ~src:(response_src_ip, 5353) ~dst:txaddr response_buf in (* A new probe cycle begins *) @@ -453,8 +451,8 @@ let tests = let cond = Lwt_condition.create () in let sleepl = ref [] in let module MockTransport = struct + let alloc () = Cstruct.create 4096 open Lwt - let alloc () = allocfn () let write addr buf = txlist := (addr, buf) :: !txlist; return_unit @@ -490,7 +488,7 @@ let tests = detail= {qr=Response; opcode=Standard; aa=true; tc=false; rd=false; ra=false; rcode=NoError}; questions=[]; answers=[answer]; authorities=[]; additionals=[]; } in - let response_buf = marshal (Dns.Buf.create 512) response in + let response_buf = marshal response in let _ = Responder.process responder ~src:(response_src_ip, 5353) ~dst:txaddr response_buf in (* Verify the second probe *) @@ -539,8 +537,8 @@ let tests = let cond = Lwt_condition.create () in let sleepl = ref [] in let module MockTransport = struct + let alloc () = Cstruct.create 4096 open Lwt - let alloc () = allocfn () let write addr buf = txlist := (addr, buf) :: !txlist; return_unit @@ -584,7 +582,7 @@ let tests = detail= {qr=Query; opcode=Standard; aa=false; tc=false; rd=false; ra=false; rcode=NoError}; questions=[question]; answers=[]; authorities=[auth]; additionals=[]; } in - let query_buf = marshal (Dns.Buf.create 512) query in + let query_buf = marshal query in let _ = Responder.process responder ~src:(conflict_src_ip, 5353) ~dst:txaddr query_buf in (* One-second delay before restarting the probe cycle *) @@ -615,7 +613,7 @@ let tests = let txlist = ref [] in let sleepl = ref [] in let module MockTransport = struct - let alloc () = allocfn () + let alloc () = Cstruct.create 4096 let write addr buf = txlist := (addr, buf) :: !txlist; Lwt.return () diff --git a/lib_test/ounit/test_packet.ml b/lib_test/ounit/test_packet.ml index c2a060037..c922fc07d 100644 --- a/lib_test/ounit/test_packet.ml +++ b/lib_test/ounit/test_packet.ml @@ -57,24 +57,14 @@ let load_packet path = assert_equal 4 version; assert_equal 17 (get_ipv4_proto ip); let udp = Cstruct.shift ip sizeof_ipv4 in - let body = Cstruct.shift udp sizeof_udpv4 in - Dns.Buf.of_cstruct body + Cstruct.shift udp sizeof_udpv4 | None -> assert_failure "No packets" let hexdump ibuf = - let n = Dns.Buf.length ibuf in - let obuf = Buffer.create (3 * n) in - let rec acc i = - let ch = (int_of_char ibuf.{i}) in - Buffer.add_char obuf (if ch < 32 || ch >= 127 then '.' else ibuf.{i}); - Buffer.add_string obuf (sprintf "%.2x " ch); - if i mod 16 = 15 then Buffer.add_char obuf '\n'; - if i < n - 1 then acc (i + 1); - in - if n >= 1 then acc 0; - if n mod 16 != 15 then Buffer.add_char obuf '\n'; - Buffer.contents obuf + let b = Buffer.create 16 in + Cstruct.hexdump_to_buffer b ibuf ; + Buffer.contents b open Dns open Packet @@ -117,8 +107,8 @@ let tests = id=0x930b; detail; questions=[q]; answers=[]; authorities=[]; additionals=[]; } in - let buf = marshal (Dns.Buf.create 512) packet in - assert_equal ~printer:hexdump raw buf + let buf = marshal packet in + assert_equal ~cmp:Cstruct.equal ~printer:hexdump raw buf ); "parse-dns-r-A" >:: (fun test_ctxt -> @@ -188,8 +178,8 @@ let tests = id=0x930b; detail; questions=[q]; answers; authorities=[]; additionals=[]; } in - let buf = marshal (Dns.Buf.create 512) packet in - assert_equal ~printer:hexdump raw buf + let buf = marshal packet in + assert_equal ~cmp:Cstruct.equal ~printer:hexdump raw buf ); "parse-mdns-q-A" >:: (fun test_ctxt -> @@ -230,8 +220,8 @@ let tests = id=0; detail; questions=[q]; answers=[]; authorities=[]; additionals=[]; } in - let buf = marshal (Dns.Buf.create 512) packet in - assert_equal ~printer:hexdump raw buf + let buf = marshal packet in + assert_equal ~cmp:Cstruct.equal ~printer:hexdump raw buf ); "parse-mdns-r-A" >:: (fun test_ctxt -> @@ -275,8 +265,8 @@ let tests = id=0; detail; questions=[]; answers=[a]; authorities=[]; additionals=[]; } in - let buf = marshal (Dns.Buf.create 512) packet in - assert_equal ~printer:hexdump raw buf + let buf = marshal packet in + assert_equal ~cmp:Cstruct.equal ~printer:hexdump raw buf ); "q_unicast" >:: (fun test_ctxt -> @@ -294,7 +284,7 @@ let tests = id=0; detail; questions=[q]; answers=[]; authorities=[]; additionals=[]; } in - let buf = marshal (Dns.Buf.create 512) packet in + let buf = marshal packet in let parsed = parse buf in let q = List.hd parsed.questions in assert_equal Q_mDNS_Unicast q.q_unicast diff --git a/lwt/dns_resolver.ml b/lwt/dns_resolver.ml index 5f26acafa..cde0e6576 100644 --- a/lwt/dns_resolver.ml +++ b/lwt/dns_resolver.ml @@ -27,8 +27,8 @@ module DP = Packet type result = Answer of DP.t | Error of exn type commfn = { - txfn : Dns.Buf.t -> unit Lwt.t; - rxfn : (Dns.Buf.t -> Dns.Packet.t option) -> DP.t Lwt.t; + txfn : Cstruct.t -> unit Lwt.t; + rxfn : (Cstruct.t -> Dns.Packet.t option) -> DP.t Lwt.t; timerfn : unit -> unit Lwt.t; cleanfn : unit -> unit Lwt.t; } @@ -41,7 +41,7 @@ let rec send_req txfn timerfn q = timerfn () >>= fun () -> send_req txfn timerfn q (count - 1) -let send_pkt ?alloc client ({ txfn; rxfn; timerfn; cleanfn }) pkt = +let send_pkt client ?alloc ({ txfn; rxfn; timerfn; cleanfn }) pkt = let module R = (val client : CLIENT) in let cqpl = R.marshal ?alloc pkt in let resl = List.map (fun (ctxt,q) -> @@ -73,7 +73,7 @@ let send_pkt ?alloc client ({ txfn; rxfn; timerfn; cleanfn }) pkt = let resolve_pkt client ?alloc (commfn:commfn) pkt = Lwt.catch (fun () -> - send_pkt ?alloc client commfn pkt + send_pkt client ?alloc commfn pkt >>= fun r -> commfn.cleanfn () >>= fun () -> Lwt.return r) (function exn -> @@ -97,7 +97,7 @@ let gethostbyname name = let open DP in let domain = Name.of_string name in - resolve ?alloc (module Dns.Protocol.Client) commfn q_class q_type domain + resolve (module Dns.Protocol.Client) ?alloc commfn q_class q_type domain >|= fun r -> List.fold_left (fun a x -> match x.rdata with @@ -115,7 +115,7 @@ let gethostbyaddr = let addr = Name.of_ipaddr (Ipaddr.V4 addr) in let open DP in - resolve ?alloc (module Dns.Protocol.Client) commfn q_class q_type addr + resolve (module Dns.Protocol.Client) ?alloc commfn q_class q_type addr >|= fun r -> List.fold_left (fun a x -> match x.rdata with |PTR n -> (Name.to_string n)::a |_->a diff --git a/lwt/dns_resolver.mli b/lwt/dns_resolver.mli index 26cdab75a..54fc7e11b 100644 --- a/lwt/dns_resolver.mli +++ b/lwt/dns_resolver.mli @@ -17,10 +17,10 @@ *) type commfn = { - txfn : Dns.Buf.t -> unit Lwt.t; + txfn : Cstruct.t -> unit Lwt.t; (** [txfn buf] resolves when [buf] has been transmitted. *) - rxfn : (Dns.Buf.t -> Dns.Packet.t option) -> Dns.Packet.t Lwt.t; + rxfn : (Cstruct.t -> Dns.Packet.t option) -> Dns.Packet.t Lwt.t; (** [rxfn parse] resolves to a packet processed by [parse] after it has been received. *) @@ -37,7 +37,7 @@ type commfn = { val resolve_pkt : (module Dns.Protocol.CLIENT) -> - ?alloc:(unit -> Dns.Buf.t) -> + ?alloc:(unit -> Cstruct.t) -> commfn -> Dns.Packet.t -> Dns.Packet.t Lwt.t (** [resolve_pkt client ?alloc commfn packet] will attempt resolution @@ -54,7 +54,7 @@ val resolve_pkt : val resolve : (module Dns.Protocol.CLIENT) -> - ?alloc:(unit -> Dns.Buf.t) -> + ?alloc:(unit -> Cstruct.t) -> ?dnssec:bool -> commfn -> Dns.Packet.q_class -> Dns.Packet.q_type -> @@ -65,13 +65,13 @@ val resolve : [name] and then attempt to resolve it by calling {!resolve_pkt}. *) val gethostbyname : - ?alloc:(unit -> Dns.Buf.t) -> + ?alloc:(unit -> Cstruct.t) -> ?q_class:Dns.Packet.q_class -> ?q_type:Dns.Packet.q_type -> commfn -> string -> Ipaddr.t list Lwt.t val gethostbyaddr : - ?alloc:(unit -> Dns.Buf.t) -> + ?alloc:(unit -> Cstruct.t) -> ?q_class:Dns.Packet.q_class -> ?q_type:Dns.Packet.q_type -> commfn -> Ipaddr.V4.t -> string list Lwt.t diff --git a/lwt/dns_resolver_unix.ml b/lwt/dns_resolver_unix.ml index 797ec1d15..b58648a97 100644 --- a/lwt/dns_resolver_unix.ml +++ b/lwt/dns_resolver_unix.ml @@ -56,13 +56,13 @@ let connect_to_resolver server port = ) in let timerfn () = Lwt_unix.sleep 5.0 in let txfn buf = - Lwt_bytes.sendto ofd buf 0 (Dns.Buf.length buf) [] dst + Cstruct.(Lwt_bytes.sendto ofd buf.buffer buf.off buf.len [] dst) >>= fun _ -> Lwt.return_unit in let rec rxfn f = - let buf = Dns.Buf.create buflen in - Lwt_bytes.recvfrom ofd buf 0 buflen [] + let buf = Cstruct.create buflen in + Cstruct.(Lwt_bytes.recvfrom ofd buf.buffer buf.off buf.len []) >>= fun (len, sa) -> - let buf = Dns.Buf.sub buf 0 len in + let buf = Cstruct.sub buf 0 len in match f buf with | None -> rxfn f | Some r -> Lwt.return r diff --git a/lwt/dns_server.ml b/lwt/dns_server.ml index 2ad4fae7f..9c5a5c1cc 100644 --- a/lwt/dns_server.ml +++ b/lwt/dns_server.ml @@ -44,9 +44,9 @@ let compose process backup ~src ~dst packet = | _ -> backup ~src ~dst packet) | None -> backup ~src ~dst packet -let process_query buf len obuf src dst processor = +let process_query ?alloc buf len src dst processor = let module Processor = (val processor : PROCESSOR) in - match Processor.parse (Dns.Buf.sub buf 0 len) with + match Processor.parse (Cstruct.sub buf 0 len) with |None -> Lwt.return_none |Some ctxt -> Processor.process ~src ~dst ctxt >|= function @@ -54,7 +54,7 @@ let process_query buf len obuf src dst processor = |Some answer -> let query = Processor.query_of_context ctxt in let response = Dns.Query.response_of_answer query answer in - Processor.marshal obuf ctxt response + Processor.marshal ?alloc ctxt response let processor_of_process process : Dns.Packet.t processor = let module P = struct diff --git a/lwt/dns_server.mli b/lwt/dns_server.mli index 34d8846c4..a4dba66e0 100644 --- a/lwt/dns_server.mli +++ b/lwt/dns_server.mli @@ -55,9 +55,9 @@ type 'a processor = (module PROCESSOR with type context = 'a) an {!rcode} other than {!NoError} in which case it becomes [backup_process]. *) val compose: Dns.Packet.t process -> Dns.Packet.t process -> Dns.Packet.t process -(** [process_query ibuf ibuflen obuf src dst processor] *) -val process_query: Dns.Buf.t -> int -> Dns.Buf.t -> ip_endpoint -> ip_endpoint -> - (module PROCESSOR) -> Dns.Buf.t option Lwt.t +(** [process_query ?alloc ibuf ibuflen src dst processor] *) +val process_query: ?alloc:(unit -> Cstruct.t) -> Cstruct.t -> int -> ip_endpoint -> ip_endpoint -> + (module PROCESSOR) -> Cstruct.t option Lwt.t (** Returns a packet processor module by combining {!Dns.Protocol.Server} with the specified packet processing function. *) diff --git a/lwt/dns_server_unix.ml b/lwt/dns_server_unix.ml index 60de1450d..edf58467f 100644 --- a/lwt/dns_server_unix.ml +++ b/lwt/dns_server_unix.ml @@ -48,8 +48,6 @@ let eventual_process_of_zonefiles zonefiles = ) zonefiles >|= process_of_zonebufs -let bufsz = 4096 - let ipaddr_of_sockaddr = function | Unix.ADDR_UNIX _ -> Lwt.fail (Failure "Unix domain sockets not supported") @@ -57,27 +55,22 @@ let ipaddr_of_sockaddr = let listen ~fd ~src ~processor = let cont = ref true in - let bufs = Lwt_pool.create 64 (fun () -> Lwt.return (Dns.Buf.create bufsz)) in ipaddr_of_sockaddr src >>= fun src -> let rec loop () = if not !cont then Lwt.return_unit else - Lwt_pool.use bufs - (fun buf -> - Lwt_bytes.recvfrom fd buf 0 bufsz [] - >>= fun (len, dst) -> - (* TODO Process in a background thread; should be a bounded queue *) - Lwt.async (fun () -> - ipaddr_of_sockaddr dst - >>= fun dst' -> - process_query buf len buf src dst' processor >>= function - | None -> Lwt.return_unit - | Some buf -> - Lwt_bytes.sendto fd buf 0 (Dns.Buf.length buf) [] dst - >>= fun _ -> Lwt.return_unit); - Lwt.return_unit) - >>= fun () -> + let buf = Cstruct.create 4096 in + Cstruct.(Lwt_bytes.recvfrom fd buf.buffer buf.off buf.len []) + >>= fun (len, dst) -> + (* TODO Process in a background thread; should be a bounded queue *) + Lwt.async (fun () -> + ipaddr_of_sockaddr dst >>= fun dst' -> + process_query buf len src dst' processor >>= function + | None -> Lwt.return_unit + | Some buf -> + Cstruct.(Lwt_bytes.sendto fd buf.buffer buf.off buf.len [] dst) + >>= fun _ -> Lwt.return_unit); loop () in Lwt.async loop; diff --git a/lwt/mdns_responder.ml b/lwt/mdns_responder.ml index fd65cece1..1c61f0b8b 100644 --- a/lwt/mdns_responder.ml +++ b/lwt/mdns_responder.ml @@ -26,8 +26,8 @@ module Probe = Dns.Probe type ip_endpoint = Ipaddr.V4.t * int module type TRANSPORT = sig - val alloc : unit -> Dns.Buf.t - val write : ip_endpoint -> Dns.Buf.t -> unit Lwt.t + val alloc : unit -> Cstruct.t + val write : ip_endpoint -> Cstruct.t -> unit Lwt.t val sleep : float -> unit Lwt.t end @@ -230,8 +230,7 @@ module Make (Transport : TRANSPORT) = struct let rec probe_forever t action first first_wakener = let send_action packet ip port = - let obuf = Transport.alloc () in - match Dns.Protocol.contain_exc "marshal" (fun () -> DP.marshal obuf packet) with + match Dns.Protocol.contain_exc "marshal" (fun () -> DP.marshal ~alloc:Transport.alloc packet) with | None -> Lwt.return_unit | Some buf -> Transport.write (ip, port) buf in @@ -349,8 +348,7 @@ module Make (Transport : TRANSPORT) = struct Lwt.return_unit else (* TODO: limit the response packet size *) - let obuf = Transport.alloc () in - match DS.marshal obuf fake_query response with + match DS.marshal ~alloc:Transport.alloc fake_query response with | None -> Lwt.return_unit | Some obuf -> write_repeat (dest_host,dest_port) obuf repeat 1.0 @@ -429,8 +427,7 @@ module Make (Transport : TRANSPORT) = struct (* Possible delay before responding *) get_delay legacy response >>= fun () -> (* TODO: limit the response packet size *) - let obuf = Transport.alloc () in - match DS.marshal obuf query response with + match DS.marshal ~alloc:Transport.alloc query response with | None -> Lwt.return_unit | Some obuf -> (* RFC 6762 section 11 - TODO: send with IP TTL = 255 *) diff --git a/lwt/mdns_responder.mli b/lwt/mdns_responder.mli index 5c7e3cc63..73a460830 100644 --- a/lwt/mdns_responder.mli +++ b/lwt/mdns_responder.mli @@ -51,8 +51,8 @@ type ip_endpoint = Ipaddr.V4.t * int (** Encapsulates the dependencies that the responder requires for performing I/O. *) module type TRANSPORT = sig - val alloc : unit -> Dns.Buf.t - val write : ip_endpoint -> Dns.Buf.t -> unit Lwt.t + val alloc : unit -> Cstruct.t + val write : ip_endpoint -> Cstruct.t -> unit Lwt.t val sleep : float -> unit Lwt.t end @@ -92,7 +92,7 @@ module Make : functor (Transport : TRANSPORT) -> sig mDNS queries, but it also parses responses to detect conflicts with unique records. *) - val process : t -> src:ip_endpoint -> dst:ip_endpoint -> Dns.Buf.t -> unit Lwt.t + val process : t -> src:ip_endpoint -> dst:ip_endpoint -> Cstruct.t -> unit Lwt.t (** Call this function to permanently stop the probe thread, to shut down the responder. diff --git a/mirage-dns.opam b/mirage-dns.opam index 347e1a270..56048fcb8 100644 --- a/mirage-dns.opam +++ b/mirage-dns.opam @@ -22,7 +22,6 @@ depends: [ "mirage-kv-lwt" "mirage-time-lwt" "duration" - "io-page" "lwt" "mirage-profile" ] diff --git a/mirage/dns_resolver_mirage.ml b/mirage/dns_resolver_mirage.ml index 95263e2f6..8531d35eb 100644 --- a/mirage/dns_resolver_mirage.ml +++ b/mirage/dns_resolver_mirage.ml @@ -111,8 +111,7 @@ module Make(Time:Mirage_time_lwt.S)(S:Mirage_stack_lwt.V4) = struct let cleanfn () = return () in S.listen_udpv4 s ~port:src_port callback; let rec txfn buf = - Cstruct.of_bigarray buf |> - S.UDPV4.write ~src_port ~dst ~dst_port udp >>= function + S.UDPV4.write ~src_port ~dst ~dst_port udp buf >>= function | Error e -> Fmt.kstrf fail_with "Attempting to communicate with remote resolver: %a" @@ -122,7 +121,7 @@ module Make(Time:Mirage_time_lwt.S)(S:Mirage_stack_lwt.V4) = struct let rec rxfn f = Lwt_mvar.take mvar >>= fun buf -> - match f (Dns.Buf.of_cstruct buf) with + match f buf with | None -> rxfn f | Some packet -> return packet in @@ -130,27 +129,25 @@ module Make(Time:Mirage_time_lwt.S)(S:Mirage_stack_lwt.V4) = struct Hashtbl.add res endp commfn; commfn - let alloc () = (Io_page.get 1 :> Dns.Buf.t) - let resolve client s server dns_port (q_class:DP.q_class) (q_type:DP.q_type) (q_name:Name.t) = let commfn = connect_to_resolver s (server,dns_port) in - resolve ~alloc client commfn q_class q_type q_name + resolve client commfn q_class q_type q_name let gethostbyname s ?(server = default_ns) ?(dns_port = default_port) ?(q_class:DP.q_class = DP.Q_IN) ?(q_type:DP.q_type = DP.Q_A) name = let commfn = connect_to_resolver s (server,dns_port) in - gethostbyname ~alloc ~q_class ~q_type commfn name + gethostbyname ~q_class ~q_type commfn name let gethostbyaddr s ?(server = default_ns) ?(dns_port = default_port) ?(q_class:DP.q_class = DP.Q_IN) ?(q_type:DP.q_type = DP.Q_PTR) addr = let commfn = connect_to_resolver s (server,dns_port) in - gethostbyaddr ~alloc ~q_class ~q_type commfn addr + gethostbyaddr ~q_class ~q_type commfn addr end diff --git a/mirage/dns_server_mirage.ml b/mirage/dns_server_mirage.ml index 9a8ed2bd9..b99c924b3 100644 --- a/mirage/dns_server_mirage.ml +++ b/mirage/dns_server_mirage.ml @@ -58,19 +58,16 @@ module Make(K:Mirage_kv_lwt.RO)(S:Mirage_stack_lwt.V4) = struct let serve_with_processor t ~port ~processor = let udp = S.udpv4 t.s in let listener ~src ~dst ~src_port buf = - let ba = Cstruct.to_bigarray buf in let src' = (Ipaddr.V4 dst), port in let dst' = (Ipaddr.V4 src), src_port in - let obuf = (Io_page.get 1 :> Dns.Buf.t) in - process_query ba (Dns.Buf.length ba) obuf src' dst' processor + process_query buf (Cstruct.len buf) src' dst' processor >>= function | None -> return () | Some rba -> - let rbuf = Cstruct.of_bigarray rba in (* Do not attempt to retry if serving failed *) - S.UDPV4.write ~src_port:port ~dst:src ~dst_port:src_port udp rbuf >|= fun _ -> () + S.UDPV4.write ~src_port:port ~dst:src ~dst_port:src_port udp rba >|= fun _ -> () in - S.listen_udpv4 t.s port listener; + S.listen_udpv4 t.s ~port listener; S.listen t.s let serve_with_zonebufs t ~port ~zonebufs = diff --git a/mirage/mdns_resolver_mirage.ml b/mirage/mdns_resolver_mirage.ml index b3672e993..c98d82fcc 100644 --- a/mirage/mdns_resolver_mirage.ml +++ b/mirage/mdns_resolver_mirage.ml @@ -34,8 +34,7 @@ module Client : Dns.Protocol.CLIENT = struct let get_id () = 0 - let marshal ?alloc q = - [q, DP.marshal (Dns.Buf.create ?alloc 4096) q] + let marshal ?alloc q = [q, DP.marshal ?alloc q] let packet_matches query packet = let open DP in @@ -100,8 +99,7 @@ module Make(Time:Mirage_time_lwt.S)(S:Mirage_stack_lwt.V4) = struct (* FIXME: can't coexist with server yet because both listen on port 5353 *) S.listen_udpv4 s ~port:src_port callback; let rec txfn buf = - Cstruct.of_bigarray buf |> - S.UDPV4.write ~src_port ~dst ~dst_port udp >>= function + S.UDPV4.write ~src_port ~dst ~dst_port udp buf >>= function | Error e -> Fmt.kstrf fail_with "Attempting to communicate with remote resolver: %a" @@ -111,7 +109,7 @@ module Make(Time:Mirage_time_lwt.S)(S:Mirage_stack_lwt.V4) = struct let rec rxfn f = Lwt_mvar.take mvar >>= fun buf -> - match f (Dns.Buf.of_cstruct buf) with + match f buf with | None -> rxfn f | Some packet -> return packet in @@ -119,8 +117,6 @@ module Make(Time:Mirage_time_lwt.S)(S:Mirage_stack_lwt.V4) = struct Hashtbl.add res endp commfn; commfn - let alloc () = (Io_page.get 1 :> Dns.Buf.t) - let create_packet q_class q_type q_name = let open Dns.Packet in let detail = { @@ -138,7 +134,7 @@ module Make(Time:Mirage_time_lwt.S)(S:Mirage_stack_lwt.V4) = struct (q_name:Name.t) = let commfn = connect_to_resolver t (server,dns_port) in let q = create_packet q_class q_type q_name in - resolve_pkt ~alloc client commfn q + resolve_pkt client commfn q let gethostbyname t ?(server = default_ns) ?(dns_port = default_port) diff --git a/opam b/opam index dd23a75c4..ce1f70712 100644 --- a/opam +++ b/opam @@ -22,7 +22,7 @@ tags: [ build: [ ["ocaml" "pkg/pkg.ml" "build" "--pinned" "%{pinned}%" "--tests" "false" "--with-lwt" "%{lwt+mirage-profile+cmdliner:installed}%" - "--with-mirage" "%{mirage-time-lwt+mirage-stack-lwt+mirage-kv-lwt+lwt+duration+io-page+mirage-profile:installed}%" + "--with-mirage" "%{mirage-time-lwt+mirage-stack-lwt+mirage-kv-lwt+lwt+duration+mirage-profile:installed}%" "--with-async" "%{async:installed}%" ] ] build-test: [ @@ -53,7 +53,6 @@ depends: [ "mirage-kv-lwt" {test} "mirage-profile" {test} "duration" {test} - "io-page" {test} ] depopts: [ "async" @@ -66,7 +65,6 @@ depopts: [ "mirage-kv-lwt" "mirage-time-lwt" "duration" - "io-page" ] conflicts: [ "mirage-types-lwt" {< "3.0.0"}