mirror of
https://github.com/mirage/qubes-mirage-firewall.git
synced 2024-07-01 08:31:18 +00:00
Remove unused Clock argument to Uplink
This commit is contained in:
parent
48b38fa992
commit
ab3508a936
|
@ -5,5 +5,5 @@ docker build -t qubes-mirage-firewall .
|
||||||
echo Building Firewall...
|
echo Building Firewall...
|
||||||
docker run --rm -i -v `pwd`:/home/opam/qubes-mirage-firewall qubes-mirage-firewall
|
docker run --rm -i -v `pwd`:/home/opam/qubes-mirage-firewall qubes-mirage-firewall
|
||||||
echo "SHA2 of build: $(sha256sum qubes_firewall.xen)"
|
echo "SHA2 of build: $(sha256sum qubes_firewall.xen)"
|
||||||
echo "SHA2 last known: 8a337e61e7d093f7c1f0fa5fe277dace4d606bfa06cfde3f2d61d6bdee6eefbc"
|
echo "SHA2 last known: 6f8f0f19ba62bf5312039f2904ea8696584f8ff49443dec098facf261449ebf2"
|
||||||
echo "(hashes should match for released versions)"
|
echo "(hashes should match for released versions)"
|
||||||
|
|
|
@ -8,8 +8,6 @@ let src = Logs.Src.create "unikernel" ~doc:"Main unikernel code"
|
||||||
module Log = (val Logs.src_log src : Logs.LOG)
|
module Log = (val Logs.src_log src : Logs.LOG)
|
||||||
|
|
||||||
module Main (Clock : Mirage_clock.MCLOCK) = struct
|
module Main (Clock : Mirage_clock.MCLOCK) = struct
|
||||||
module Uplink = Uplink.Make(Clock)
|
|
||||||
|
|
||||||
(* Set up networking and listen for incoming packets. *)
|
(* Set up networking and listen for incoming packets. *)
|
||||||
let network nat qubesDB =
|
let network nat qubesDB =
|
||||||
(* Read configuration from QubesDB *)
|
(* Read configuration from QubesDB *)
|
||||||
|
|
18
uplink.ml
18
uplink.ml
|
@ -9,18 +9,17 @@ module Eth = Ethernet.Make(Netif)
|
||||||
let src = Logs.Src.create "uplink" ~doc:"Network connection to NetVM"
|
let src = Logs.Src.create "uplink" ~doc:"Network connection to NetVM"
|
||||||
module Log = (val Logs.src_log src : Logs.LOG)
|
module Log = (val Logs.src_log src : Logs.LOG)
|
||||||
|
|
||||||
module Make(Clock : Mirage_clock.MCLOCK) = struct
|
module Arp = Arp.Make(Eth)(OS.Time)
|
||||||
module Arp = Arp.Make(Eth)(OS.Time)
|
|
||||||
|
|
||||||
type t = {
|
type t = {
|
||||||
net : Netif.t;
|
net : Netif.t;
|
||||||
eth : Eth.t;
|
eth : Eth.t;
|
||||||
arp : Arp.t;
|
arp : Arp.t;
|
||||||
interface : interface;
|
interface : interface;
|
||||||
fragments : Fragments.Cache.t;
|
fragments : Fragments.Cache.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
class netvm_iface eth mac ~my_ip ~other_ip : interface = object
|
class netvm_iface eth mac ~my_ip ~other_ip : interface = object
|
||||||
val queue = FrameQ.create (Ipaddr.V4.to_string other_ip)
|
val queue = FrameQ.create (Ipaddr.V4.to_string other_ip)
|
||||||
method my_mac = Eth.mac eth
|
method my_mac = Eth.mac eth
|
||||||
method my_ip = my_ip
|
method my_ip = my_ip
|
||||||
|
@ -30,9 +29,9 @@ module Make(Clock : Mirage_clock.MCLOCK) = struct
|
||||||
mac >>= fun dst ->
|
mac >>= fun dst ->
|
||||||
Eth.write eth dst ethertype fillfn >|= or_raise "Write to uplink" Eth.pp_error
|
Eth.write eth dst ethertype fillfn >|= or_raise "Write to uplink" Eth.pp_error
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
let listen t get_ts router =
|
let listen t get_ts router =
|
||||||
Netif.listen t.net ~header_size:Ethernet_wire.sizeof_ethernet (fun frame ->
|
Netif.listen t.net ~header_size:Ethernet_wire.sizeof_ethernet (fun frame ->
|
||||||
(* Handle one Ethernet frame from NetVM *)
|
(* Handle one Ethernet frame from NetVM *)
|
||||||
Eth.input t.eth
|
Eth.input t.eth
|
||||||
|
@ -55,9 +54,9 @@ module Make(Clock : Mirage_clock.MCLOCK) = struct
|
||||||
frame
|
frame
|
||||||
) >|= or_raise "Uplink listen loop" Netif.pp_error
|
) >|= or_raise "Uplink listen loop" Netif.pp_error
|
||||||
|
|
||||||
let interface t = t.interface
|
let interface t = t.interface
|
||||||
|
|
||||||
let connect config =
|
let connect config =
|
||||||
let ip = config.Dao.uplink_our_ip in
|
let ip = config.Dao.uplink_our_ip in
|
||||||
Netif.connect "0" >>= fun net ->
|
Netif.connect "0" >>= fun net ->
|
||||||
Eth.connect net >>= fun eth ->
|
Eth.connect net >>= fun eth ->
|
||||||
|
@ -71,4 +70,3 @@ module Make(Clock : Mirage_clock.MCLOCK) = struct
|
||||||
~other_ip:config.Dao.uplink_netvm_ip in
|
~other_ip:config.Dao.uplink_netvm_ip in
|
||||||
let fragments = Fragments.Cache.create (256 * 1024) in
|
let fragments = Fragments.Cache.create (256 * 1024) in
|
||||||
Lwt.return { net; eth; arp; interface ; fragments }
|
Lwt.return { net; eth; arp; interface ; fragments }
|
||||||
end
|
|
||||||
|
|
16
uplink.mli
16
uplink.mli
|
@ -5,15 +5,13 @@
|
||||||
|
|
||||||
open Fw_utils
|
open Fw_utils
|
||||||
|
|
||||||
module Make(Clock : Mirage_clock.MCLOCK) : sig
|
type t
|
||||||
type t
|
|
||||||
|
|
||||||
val connect : Dao.network_config -> t Lwt.t
|
val connect : Dao.network_config -> t Lwt.t
|
||||||
(** Connect to our NetVM (gateway). *)
|
(** Connect to our NetVM (gateway). *)
|
||||||
|
|
||||||
val interface : t -> interface
|
val interface : t -> interface
|
||||||
(** The network interface to NetVM. *)
|
(** The network interface to NetVM. *)
|
||||||
|
|
||||||
val listen : t -> (unit -> int64) -> Router.t -> unit Lwt.t
|
val listen : t -> (unit -> int64) -> Router.t -> unit Lwt.t
|
||||||
(** Handle incoming frames from NetVM. *)
|
(** Handle incoming frames from NetVM. *)
|
||||||
end
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user