Removed unreachable Lwt.catch

Spotted by Hannes Mehnert.
This commit is contained in:
Thomas Leonard 2020-01-13 10:05:38 +00:00
parent ab3508a936
commit 8e714c7712
2 changed files with 17 additions and 27 deletions

View File

@ -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: 6f8f0f19ba62bf5312039f2904ea8696584f8ff49443dec098facf261449ebf2" echo "SHA2 last known: 91c5bf44a85339aaf14e4763a29c2b64537f5bc41cd7dc2571af954ec9dd3cad"
echo "(hashes should match for released versions)" echo "(hashes should match for released versions)"

View File

@ -12,33 +12,23 @@ module Log = (val Logs.src_log src : Logs.LOG)
let transmit_ipv4 packet iface = let transmit_ipv4 packet iface =
Lwt.catch Lwt.catch
(fun () -> (fun () ->
Lwt.catch let fragments = ref [] in
(fun () -> iface#writev `IPv4 (fun b ->
let fragments = ref [] in match Nat_packet.into_cstruct packet b with
iface#writev `IPv4 (fun b -> | Error e ->
match Nat_packet.into_cstruct packet b with Log.warn (fun f -> f "Failed to NAT packet to %a: %a"
| Error e -> Ipaddr.V4.pp iface#other_ip
Log.warn (fun f -> f "Failed to write packet to %a: %a" Nat_packet.pp_error e);
Ipaddr.V4.pp iface#other_ip 0
Nat_packet.pp_error e); | Ok (n, frags) -> fragments := frags ; n) >>= fun () ->
0 Lwt_list.iter_s (fun f ->
| Ok (n, frags) -> fragments := frags ; n) >>= fun () -> let size = Cstruct.len f in
Lwt_list.iter_s (fun f -> iface#writev `IPv4 (fun b -> Cstruct.blit f 0 b 0 size ; size))
let size = Cstruct.len f in !fragments)
iface#writev `IPv4 (fun b -> Cstruct.blit f 0 b 0 size ; size))
!fragments)
(fun ex ->
Log.warn (fun f -> f "Failed to write packet to %a: %s"
Ipaddr.V4.pp iface#other_ip
(Printexc.to_string ex));
Lwt.return_unit
)
)
(fun ex -> (fun ex ->
Log.err (fun f -> f "Exception in transmit_ipv4: %s for:@.%a" Log.warn (fun f -> f "Failed to write packet to %a: %s"
(Printexc.to_string ex) Ipaddr.V4.pp iface#other_ip
Nat_packet.pp packet (Printexc.to_string ex));
);
Lwt.return_unit Lwt.return_unit
) )