Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _oasis
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Library tcp
Tcp_wire, Tcp_packet
BuildDepends: logs,mirage-types,ipaddr,cstruct,cstruct.ppx,lwt,result,rresult,mirage-profile,
io-page,
tcpip, duration
tcpip, duration, randomconv

Library dhcpv4
CompiledObject: best
Expand All @@ -107,7 +107,7 @@ Library dhcpv4
Findlibname: dhcpv4
Modules: Dhcpv4_option,Dhcp_clientv4
BuildDepends: logs,io-page,mirage-types,ipaddr,cstruct,cstruct.ppx,lwt,
tcpip.udp, duration
tcpip.udp, duration, randomconv

Library "tcpip-stack-direct"
CompiledObject: best
Expand Down
7 changes: 6 additions & 1 deletion _tags
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: 865c70bb000f8ddf7f1771b483047749)
# DO NOT EDIT (digest: bb445ce5e2101b5879bf9a10a8602530)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process
Expand Down Expand Up @@ -128,6 +128,7 @@ true: annot, bin_annot
<lib/tcp/*.ml{,i,y}>: pkg_lwt
<lib/tcp/*.ml{,i,y}>: pkg_mirage-profile
<lib/tcp/*.ml{,i,y}>: pkg_mirage-types
<lib/tcp/*.ml{,i,y}>: pkg_randomconv
<lib/tcp/*.ml{,i,y}>: pkg_result
<lib/tcp/*.ml{,i,y}>: pkg_rresult
<lib/tcp/*.ml{,i,y}>: use_tcpip
Expand All @@ -142,6 +143,7 @@ true: annot, bin_annot
<lib/dhcp/*.ml{,i,y}>: pkg_lwt
<lib/dhcp/*.ml{,i,y}>: pkg_mirage-profile
<lib/dhcp/*.ml{,i,y}>: pkg_mirage-types
<lib/dhcp/*.ml{,i,y}>: pkg_randomconv
<lib/dhcp/*.ml{,i,y}>: pkg_result
<lib/dhcp/*.ml{,i,y}>: pkg_rresult
<lib/dhcp/*.ml{,i,y}>: use_tcpip
Expand All @@ -157,6 +159,7 @@ true: annot, bin_annot
<lib/*.ml{,i,y}>: pkg_lwt
<lib/*.ml{,i,y}>: pkg_mirage-profile
<lib/*.ml{,i,y}>: pkg_mirage-types
<lib/*.ml{,i,y}>: pkg_randomconv
<lib/*.ml{,i,y}>: pkg_result
<lib/*.ml{,i,y}>: pkg_rresult
<lib/*.ml{,i,y}>: use_dhcpv4
Expand Down Expand Up @@ -212,6 +215,7 @@ true: annot, bin_annot
<lib_test/test.{native,byte}>: pkg_mirage-vnetif
<lib_test/test.{native,byte}>: pkg_oUnit
<lib_test/test.{native,byte}>: pkg_pcap-format
<lib_test/test.{native,byte}>: pkg_randomconv
<lib_test/test.{native,byte}>: pkg_result
<lib_test/test.{native,byte}>: pkg_rresult
<lib_test/test.{native,byte}>: use_arpv4
Expand Down Expand Up @@ -247,6 +251,7 @@ true: annot, bin_annot
<lib_test/*.ml{,i,y}>: pkg_mirage-vnetif
<lib_test/*.ml{,i,y}>: pkg_oUnit
<lib_test/*.ml{,i,y}>: pkg_pcap-format
<lib_test/*.ml{,i,y}>: pkg_randomconv
<lib_test/*.ml{,i,y}>: pkg_result
<lib_test/*.ml{,i,y}>: pkg_rresult
<lib_test/*.ml{,i,y}>: use_arpv4
Expand Down
6 changes: 3 additions & 3 deletions lib/META
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: 70283308f244bdf3d28fb6bd5d374881)
# DO NOT EDIT (digest: 6a8a6d795abb6ec056a6784efaf0d74f)
version = "2.8.0"
description =
"Implementations for network-related module types from MirageOS."
Expand Down Expand Up @@ -88,7 +88,7 @@ package "tcp" (
description =
"Implementations for network-related module types from MirageOS."
requires =
"logs mirage-types ipaddr cstruct cstruct.ppx lwt result rresult mirage-profile io-page tcpip duration"
"logs mirage-types ipaddr cstruct cstruct.ppx lwt result rresult mirage-profile io-page tcpip duration randomconv"
archive(byte) = "tcp.cma"
archive(byte, plugin) = "tcp.cma"
archive(native) = "tcp.cmxa"
Expand Down Expand Up @@ -189,7 +189,7 @@ package "dhcpv4" (
description =
"Implementations for network-related module types from MirageOS."
requires =
"logs io-page mirage-types ipaddr cstruct cstruct.ppx lwt tcpip.udp duration"
"logs io-page mirage-types ipaddr cstruct cstruct.ppx lwt tcpip.udp duration randomconv"
archive(byte) = "dhcpv4.cma"
archive(byte, plugin) = "dhcpv4.cma"
archive(native) = "dhcpv4.cmxa"
Expand Down
4 changes: 2 additions & 2 deletions lib/dhcp/dhcp_clientv4.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open Lwt.Infix

module Make
(Time : V1_LWT.TIME)
(Random : V1.RANDOM)
(Random : V1_LWT.RANDOM)
(Udp : V1_LWT.UDPV4) = struct

type offer = {
Expand Down Expand Up @@ -193,7 +193,7 @@ module Make
let start_discovery t =
Time.sleep_ns (Duration.of_ms 200)
>>= fun () ->
let xid = Random.int32 Int32.max_int in
let xid = Randomconv.int32 Random.generate in
let yiaddr = Ipaddr.V4.any in
let siaddr = Ipaddr.V4.any in
let options = { Dhcpv4_option.Packet.op=`Discover; opts= [
Expand Down
2 changes: 1 addition & 1 deletion lib/tcp/flow.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exception Refused
let src = Logs.Src.create "flow" ~doc:"Mirage TCP Flow module"
module Log = (val Logs.src_log src : Logs.LOG)

module Make(IP:V1_LWT.IP)(TM:V1_LWT.TIME)(C:V1.MCLOCK)(R:V1.RANDOM) = struct
module Make(IP:V1_LWT.IP)(TM:V1_LWT.TIME)(C:V1.MCLOCK)(R:V1_LWT.RANDOM) = struct

module Pcb = Pcb.Make(IP)(TM)(C)(R)

Expand Down
2 changes: 1 addition & 1 deletion lib/tcp/flow.mli
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exception Refused
(** {b NOTE}: to be removed in favor of a proper result type in
V1.write_nodelay and V1.writev_nodelay.*)

module Make (IP:V1_LWT.IP)(TM:V1_LWT.TIME)(C:V1.MCLOCK)(R:V1.RANDOM) : sig
module Make (IP:V1_LWT.IP)(TM:V1_LWT.TIME)(C:V1.MCLOCK)(R:V1_LWT.RANDOM) : sig
include V1_LWT.TCP
with type ip = IP.t
and type ipaddr = IP.ipaddr
Expand Down
10 changes: 5 additions & 5 deletions lib/tcp/pcb.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 "pcb" ~doc:"Mirage TCP PCB module"
module Log = (val Logs.src_log src : Logs.LOG)

module Make(Ip:V1_LWT.IP)(Time:V1_LWT.TIME)(Clock:V1.MCLOCK)(Random:V1.RANDOM) =
module Make(Ip:V1_LWT.IP)(Time:V1_LWT.TIME)(Clock:V1.MCLOCK)(Random:V1_LWT.RANDOM) =
struct

module RXS = Segment.Rx(Time)
Expand Down Expand Up @@ -416,7 +416,7 @@ struct
Logs.(log_with_stats Debug "process-syn" t);
match listeners @@ WIRE.src_port_of_id id with
| Some pushf ->
let tx_isn = Sequence.of_int ((Random.int 65535) + 0x1AFE0000) in
let tx_isn = Sequence.of_int32 (Randomconv.int32 Random.generate) in
(* TODO: make this configurable per listener *)
let rx_wnd = 65535 in
let rx_wnd_scaleoffer = wscale_default in
Expand Down Expand Up @@ -581,7 +581,7 @@ struct

let connect t ~dst ~dst_port =
let id = getid t dst dst_port in
let tx_isn = Sequence.of_int ((Random.int 65535) + 0x1BCD0000) in
let tx_isn = Sequence.of_int32 (Randomconv.int32 Random.generate) in
(* TODO: This is hardcoded for now - make it configurable *)
let rx_wnd_scaleoffer = wscale_default in
let options =
Expand All @@ -602,8 +602,8 @@ struct

(* Construct the main TCP thread *)
let create ip clock =
Random.self_init ();
let localport = 10000 + (Random.int 10000) in
(* XXX: I've no clue why this is the way it is (10000 + Random ~bound:10000) -- hannes *)
let localport = 10000 + (Randomconv.int Random.generate ~bound:10000) in
let listens = Hashtbl.create 1 in
let connects = Hashtbl.create 1 in
let channels = Hashtbl.create 7 in
Expand Down
2 changes: 1 addition & 1 deletion lib/tcp/pcb.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:V1_LWT.IP)(Time:V1_LWT.TIME)(Clock:V1.MCLOCK)(Random:V1.RANDOM) : sig
module Make(Ip:V1_LWT.IP)(Time:V1_LWT.TIME)(Clock:V1.MCLOCK)(Random:V1_LWT.RANDOM) : sig

(** Overall state of the TCP stack *)
type t
Expand Down
2 changes: 1 addition & 1 deletion lib/tcpip_stack_direct.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module type TCPV4_DIRECT = V1_LWT.TCPV4

module Make
(Time : V1_LWT.TIME)
(Random : V1.RANDOM)
(Random : V1_LWT.RANDOM)
(Netif : V1_LWT.NETWORK)
(Ethif : V1_LWT.ETHIF with type netif = Netif.t)
(Arpv4 : V1_LWT.ARP)
Expand Down
2 changes: 1 addition & 1 deletion lib/tcpip_stack_direct.mli
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module type TCPV4_DIRECT = V1_LWT.TCPV4

module Make
(Time : V1_LWT.TIME)
(Random : V1.RANDOM)
(Random : V1_LWT.RANDOM)
(Netif : V1_LWT.NETWORK)
(Ethif : V1_LWT.ETHIF with type netif = Netif.t)
(Arpv4 : V1_LWT.ARP)
Expand Down
1 change: 1 addition & 0 deletions opam
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ depends: [
"lwt" {>= "2.4.7"}
"logs" {>= "0.6.0"}
"duration"
"randomconv"
]
depopts: [
"mirage-xen"
Expand Down
13 changes: 8 additions & 5 deletions setup.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(* setup.ml generated for the first time by OASIS v0.4.5 *)

(* OASIS_START *)
(* DO NOT EDIT (digest: c66b3ccd67691495732c021d86045b62) *)
(* DO NOT EDIT (digest: 97fdc978030881618fe6279b270b1427) *)
(*
Regenerated by OASIS v0.4.6
Visit http://oasis.forge.ocamlcore.org for more information and
Expand Down Expand Up @@ -7302,7 +7302,8 @@ let setup_t =
FindlibPackage ("mirage-profile", None);
FindlibPackage ("io-page", None);
InternalLibrary "tcpip";
FindlibPackage ("duration", None)
FindlibPackage ("duration", None);
FindlibPackage ("randomconv", None)
];
bs_build_tools = [ExternalTool "ocamlbuild"];
bs_c_sources = [];
Expand Down Expand Up @@ -7359,7 +7360,8 @@ let setup_t =
FindlibPackage ("cstruct.ppx", None);
FindlibPackage ("lwt", None);
InternalLibrary "udp";
FindlibPackage ("duration", None)
FindlibPackage ("duration", None);
FindlibPackage ("randomconv", None)
];
bs_build_tools = [ExternalTool "ocamlbuild"];
bs_c_sources = [];
Expand Down Expand Up @@ -7728,14 +7730,15 @@ let setup_t =
};
oasis_fn = Some "_oasis";
oasis_version = "0.4.6";
oasis_digest = Some "\021<)K\251R\252\\K2\157\191!\2216\244";
oasis_digest =
Some "\162h\220\1786\155\220\134\023V\176\159\002;\002\197";
oasis_exec = None;
oasis_setup_args = [];
setup_update = false
};;

let setup () = BaseSetup.setup setup_t;;

# 7740 "setup.ml"
# 7743 "setup.ml"
(* OASIS_STOP *)
let () = setup ();;