mirror of
https://github.com/mirage/qubes-mirage-firewall.git
synced 2024-12-29 00:56:13 -05:00
Cope with writing a frame failing
If a client disconnects suddenly then we may get an error trying to map its grant to send the frame. Fixes #8.
This commit is contained in:
parent
0230cfaf1e
commit
c11f245d64
@ -16,7 +16,14 @@ let transmit ~frame iface =
|
||||
cases. *)
|
||||
let frame = fixup_checksums frame |> Cstruct.concat in
|
||||
let packet = Cstruct.shift frame Wire_structs.sizeof_ethernet in
|
||||
iface#writev [packet]
|
||||
Lwt.catch
|
||||
(fun () -> iface#writev [packet])
|
||||
(fun ex ->
|
||||
Log.warn (fun f -> f "Failed to write packet to %a: %s"
|
||||
Ipaddr.V4.pp_hum iface#other_ip
|
||||
(Printexc.to_string ex));
|
||||
Lwt.return ()
|
||||
)
|
||||
|
||||
let forward_ipv4 t frame =
|
||||
let packet = Cstruct.shift frame Wire_structs.sizeof_ethernet in
|
||||
|
Loading…
Reference in New Issue
Block a user