mirror of
https://github.com/mirage/qubes-mirage-firewall.git
synced 2024-10-01 01:05:39 -04:00
Minor cleanup
This commit is contained in:
parent
1da8775814
commit
aee124338a
@ -129,17 +129,18 @@ let nat_to t ~frame ~host ~port =
|
||||
(* Handle incoming packets *)
|
||||
|
||||
let apply_rules t rules info =
|
||||
let frame = info.frame in
|
||||
match rules info, info.dst with
|
||||
| `Accept, `Client client_link -> transmit ~frame:info.frame client_link
|
||||
| `Accept, (`External _ | `NetVM) -> transmit ~frame:info.frame t.Router.uplink
|
||||
| `Accept, `Client client_link -> transmit ~frame client_link
|
||||
| `Accept, (`External _ | `NetVM) -> transmit ~frame t.Router.uplink
|
||||
| `Accept, `Unknown_client _ ->
|
||||
Log.warn "Dropping packet to unknown client %a" (fun f -> f pp_packet info);
|
||||
return ()
|
||||
| `Accept, (`Firewall_uplink | `Client_gateway) ->
|
||||
Log.warn "Bad rule: firewall can't accept packets %a" (fun f -> f pp_packet info);
|
||||
return ()
|
||||
| `NAT, _ -> add_nat_and_forward_ipv4 t ~frame:info.frame
|
||||
| `NAT_to (host, port), _ -> nat_to t ~frame:info.frame ~host ~port
|
||||
| `NAT, _ -> add_nat_and_forward_ipv4 t ~frame
|
||||
| `NAT_to (host, port), _ -> nat_to t ~frame ~host ~port
|
||||
| `Drop reason, _ ->
|
||||
Log.info "Dropped packet (%s) %a" (fun f -> f reason pp_packet info);
|
||||
return ()
|
||||
|
@ -58,7 +58,7 @@ module Main (Clock : V1.CLOCK) = struct
|
||||
Log.info "agents connected in %.3f s (CPU time used since boot: %.3f s)"
|
||||
(fun f -> f (Clock.time () -. start_time) (Sys.time ()));
|
||||
(* Watch for shutdown requests from Qubes *)
|
||||
let shutdown_rq = OS.Lifecycle.await_shutdown () >>= function `Poweroff | `Reboot -> return () in
|
||||
let shutdown_rq = OS.Lifecycle.await_shutdown () >>= fun (`Poweroff | `Reboot) -> return () in
|
||||
(* Set up networking *)
|
||||
let net_listener = network qubesDB in
|
||||
(* Run until something fails or we get a shutdown request. *)
|
||||
|
Loading…
Reference in New Issue
Block a user