Skip to content

Commit

Permalink
Merge pull request mirage#521 from hannesm/update
Browse files Browse the repository at this point in the history
use mirage-crypto 1.0 and randomconv 0.2, drop mirage-random dependency
  • Loading branch information
dinosaure authored Aug 22, 2024
2 parents f03cd0d + 8b78452 commit 519c576
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/ipv4/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
(public_name tcpip.ipv4)
(instrumentation
(backend bisect_ppx))
(libraries logs ipaddr cstruct tcpip tcpip.udp tcpip.checksum mirage-random
mirage-clock randomconv lru arp.mirage ethernet)
(libraries logs ipaddr cstruct tcpip tcpip.udp tcpip.checksum
mirage-crypto-rng-mirage mirage-clock randomconv lru arp.mirage ethernet)
(wrapped false))
2 changes: 1 addition & 1 deletion src/ipv4/static_ipv4.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ open Lwt.Infix
let src = Logs.Src.create "ipv4" ~doc:"Mirage IPv4"
module Log = (val Logs.src_log src : Logs.LOG)

module Make (R: Mirage_random.S) (C: Mirage_clock.MCLOCK) (Ethernet: Ethernet.S) (Arpv4 : Arp.S) = struct
module Make (R: Mirage_crypto_rng_mirage.S) (C: Mirage_clock.MCLOCK) (Ethernet: Ethernet.S) (Arpv4 : Arp.S) = struct
module Routing = Routing.Make(Log)(Arpv4)

(** IO operation errors *)
Expand Down
2 changes: 1 addition & 1 deletion src/ipv4/static_ipv4.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)

module Make (R: Mirage_random.S) (C: Mirage_clock.MCLOCK) (E: Ethernet.S) (A: Arp.S) : sig
module Make (R: Mirage_crypto_rng_mirage.S) (C: Mirage_clock.MCLOCK) (E: Ethernet.S) (A: Arp.S) : sig
include Tcpip.Ip.S with type ipaddr = Ipaddr.V4.t and type prefix = Ipaddr.V4.Prefix.t

val connect : ?no_init:bool -> cidr:Ipaddr.V4.Prefix.t -> ?gateway:Ipaddr.V4.t ->
Expand Down
4 changes: 2 additions & 2 deletions src/ipv6/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
(instrumentation
(backend bisect_ppx))
(libraries logs mirage-time mirage-net macaddr-cstruct tcpip.checksum
mirage-clock duration ipaddr cstruct mirage-random tcpip randomconv
ethernet ipaddr-cstruct)
mirage-clock duration ipaddr cstruct tcpip randomconv
mirage-crypto-rng-mirage ethernet ipaddr-cstruct)
(wrapped false))
2 changes: 1 addition & 1 deletion src/ipv6/ipv6.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ open Lwt.Infix

module Make (N : Mirage_net.S)
(E : Ethernet.S)
(R : Mirage_random.S)
(R : Mirage_crypto_rng_mirage.S)
(T : Mirage_time.S)
(C : Mirage_clock.MCLOCK) = struct
type ipaddr = Ipaddr.V6.t
Expand Down
2 changes: 1 addition & 1 deletion src/ipv6/ipv6.mli
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

module Make (N : Mirage_net.S)
(E : Ethernet.S)
(R : Mirage_random.S)
(R : Mirage_crypto_rng_mirage.S)
(T : Mirage_time.S)
(Clock : Mirage_clock.MCLOCK) : sig
include Tcpip.Ip.S with type ipaddr = Ipaddr.V6.t and type prefix = Ipaddr.V6.Prefix.t
Expand Down
4 changes: 2 additions & 2 deletions src/ipv6/ndpv6.mli
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type event =

type context

val local : handle_ra:bool -> now:time -> random:(int -> Cstruct.t) -> Macaddr.t ->
val local : handle_ra:bool -> now:time -> random:(int -> string) -> Macaddr.t ->
context * (Macaddr.t * int * (Cstruct.t -> int)) list
(** [local ~handle_ra ~now ~random mac] is a pair [ctx, outs] where [ctx] is a local IPv6 context
associated to the hardware address [mac]. [outs] is a list of ethif packets
Expand All @@ -48,7 +48,7 @@ val select_source : context -> ipaddr -> ipaddr
(** [select_source ctx ip] returns the ip that should be put in the source field
of a packet destined to [ip]. *)

val handle : now:time -> random:(int -> Cstruct.t) -> context -> Cstruct.t ->
val handle : now:time -> random:(int -> string) -> context -> Cstruct.t ->
context * (Macaddr.t * int * (Cstruct.t -> int)) list * event list
(** [handle ~now ~random ctx buf] handles an incoming ipv6 packet. It returns
[ctx', bufs, evs] where [ctx'] is the updated context, [bufs] is a list of
Expand Down
4 changes: 2 additions & 2 deletions src/stack-direct/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
(public_name tcpip.stack-direct)
(instrumentation
(backend bisect_ppx))
(libraries logs ipaddr lwt fmt mirage-time mirage-random mirage-net ethernet
arp.mirage tcpip.icmpv4 tcpip.udp tcpip.tcp))
(libraries logs ipaddr lwt fmt mirage-time mirage-crypto-rng-mirage mirage-net
ethernet arp.mirage tcpip.icmpv4 tcpip.udp tcpip.tcp))
2 changes: 1 addition & 1 deletion src/stack-direct/tcpip_stack_direct.ml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ end

module MakeV4V6
(Time : Mirage_time.S)
(Random : Mirage_random.S)
(Random : Mirage_crypto_rng_mirage.S)
(Netif : Mirage_net.S)
(Eth : Ethernet.S)
(Arpv4 : Arp.S)
Expand Down
2 changes: 1 addition & 1 deletion src/stack-direct/tcpip_stack_direct.mli
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ end

module MakeV4V6
(Time : Mirage_time.S)
(Random : Mirage_random.S)
(Random : Mirage_crypto_rng_mirage.S)
(Netif : Mirage_net.S)
(Ethernet : Ethernet.S)
(Arpv4 : Arp.S)
Expand Down
4 changes: 2 additions & 2 deletions src/tcp/dune
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
(instrumentation
(backend bisect_ppx))
(libraries logs ipaddr cstruct lwt-dllist tcpip.checksum
tcpip duration randomconv fmt mirage-time mirage-clock mirage-random
mirage-flow metrics))
tcpip duration randomconv fmt mirage-time mirage-clock
mirage-crypto-rng-mirage mirage-flow metrics))
2 changes: 1 addition & 1 deletion src/tcp/flow.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ open Lwt.Infix
let src = Logs.Src.create "tcp.pcb" ~doc:"Mirage TCP PCB module"
module Log = (val Logs.src_log src : Logs.LOG)

module Make(Ip: Tcpip.Ip.S)(Time:Mirage_time.S)(Clock:Mirage_clock.MCLOCK)(Random:Mirage_random.S) =
module Make(Ip: Tcpip.Ip.S)(Time:Mirage_time.S)(Clock:Mirage_clock.MCLOCK)(Random:Mirage_crypto_rng_mirage.S) =
struct

module ACK = Ack.Immediate
Expand Down
2 changes: 1 addition & 1 deletion src/tcp/flow.mli
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
module Make (IP:Tcpip.Ip.S)
(TM:Mirage_time.S)
(C:Mirage_clock.MCLOCK)
(R:Mirage_random.S) : sig
(R:Mirage_crypto_rng_mirage.S) : sig
include Tcpip.Tcp.S with type ipaddr = IP.ipaddr
val connect : IP.t -> t Lwt.t

Expand Down
2 changes: 1 addition & 1 deletion src/udp/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
(public_name tcpip.udp)
(instrumentation
(backend bisect_ppx))
(libraries mirage-random logs tcpip randomconv tcpip.checksum)
(libraries mirage-crypto-rng-mirage logs tcpip randomconv tcpip.checksum)
(wrapped false))
2 changes: 1 addition & 1 deletion src/udp/udp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ open Lwt.Infix
let src = Logs.Src.create "udp" ~doc:"Mirage UDP"
module Log = (val Logs.src_log src : Logs.LOG)

module Make (Ip : Tcpip.Ip.S) (Random : Mirage_random.S) = struct
module Make (Ip : Tcpip.Ip.S) (Random : Mirage_crypto_rng_mirage.S) = struct

type ipaddr = Ip.ipaddr
type callback = src:ipaddr -> dst:ipaddr -> src_port:int -> Cstruct.t -> unit Lwt.t
Expand Down
2 changes: 1 addition & 1 deletion src/udp/udp.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)

module Make (IP : Tcpip.Ip.S) (R : Mirage_random.S) : sig
module Make (IP : Tcpip.Ip.S) (R : Mirage_crypto_rng_mirage.S) : sig
include Tcpip.Udp.S with type ipaddr = IP.ipaddr
val connect : IP.t -> t Lwt.t
end
6 changes: 3 additions & 3 deletions tcpip.opam
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ depends: [
"cstruct-lwt"
"mirage-net" {>= "3.0.0"}
"mirage-clock" {>= "3.0.0"}
"mirage-random" {>= "2.0.0" & < "4.0.0"}
"mirage-crypto-rng-mirage" {>= "1.0.0"}
"mirage-time" {>= "2.0.0"}
"ipaddr" {>= "5.6.0"}
"macaddr" {>="4.0.0"}
Expand All @@ -40,15 +40,15 @@ depends: [
"lwt-dllist"
"logs" {>= "0.6.0"}
"duration"
"randomconv" {< "0.2.0"}
"randomconv" {>= "0.2.0"}
"ethernet" {>= "3.0.0"}
"arp" {>= "3.0.0"}
"mirage-flow" {>= "4.0.0"}
"mirage-vnetif" {with-test & >= "0.6.2"}
"alcotest" {with-test & >="1.5.0"}
"pcap-format" {with-test}
"mirage-clock-unix" {with-test & >= "3.0.0"}
"mirage-crypto-rng" {with-test & >= "0.11.0" & < "1.0"}
"mirage-crypto-rng" {with-test & >= "1.0.0"}
"ipaddr-cstruct"
"macaddr-cstruct"
"lru" {>= "0.3.0"}
Expand Down
2 changes: 1 addition & 1 deletion test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(name test)
(libraries alcotest mirage-crypto-rng mirage-crypto-rng.unix lwt.unix logs logs.fmt
mirage-flow mirage-vnetif mirage-clock-unix pcap-format duration
mirage-random arp arp.mirage ethernet tcpip.ipv4 tcpip.tcp tcpip.udp
mirage-crypto-rng-mirage arp arp.mirage ethernet tcpip.ipv4 tcpip.tcp tcpip.udp
tcpip.stack-direct tcpip.icmpv4 tcpip.udpv4v6-socket tcpip.tcpv4v6-socket
tcpip.icmpv4-socket tcpip.stack-socket tcpip.ipv6 ipaddr-cstruct
macaddr-cstruct tcpip)
Expand Down
2 changes: 1 addition & 1 deletion test/test_deadlock.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ let test_digest netif1 netif2 =
TCPIP.make `Server netif2 >>= fun server_stack ->

let send_data () =
let data = Mirage_crypto_rng.generate 100_000_000 |> Cstruct.to_string in
let data = Mirage_crypto_rng.generate 100_000_000 in
let t0 = Unix.gettimeofday () in
TCPIP.TCP.create_connection
TCPIP.(tcp @@ tcpip server_stack) (Ipaddr.V4 TCPIP.client_ip, port) >>= function
Expand Down

0 comments on commit 519c576

Please sign in to comment.