mirror of
https://github.com/mirage/qubes-mirage-firewall.git
synced 2025-01-17 01:57:15 -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. *)
|
cases. *)
|
||||||
let frame = fixup_checksums frame |> Cstruct.concat in
|
let frame = fixup_checksums frame |> Cstruct.concat in
|
||||||
let packet = Cstruct.shift frame Wire_structs.sizeof_ethernet 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 forward_ipv4 t frame =
|
||||||
let packet = Cstruct.shift frame Wire_structs.sizeof_ethernet in
|
let packet = Cstruct.shift frame Wire_structs.sizeof_ethernet in
|
||||||
|
Loading…
Reference in New Issue
Block a user