Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ipv4/routing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ module Make(Log : Logs.LOG) (A : Arp.S) = struct
Log.info (fun f -> f "IP.output: %a" A.pp_error e);
Error `Local
end
|ip when Ipaddr.V4.Prefix.mem ip Ipaddr.V4.Prefix.loopback -> (* Loopback *)
Lwt.return (Error `Loopback)
|ip -> (* Gateway *)
match gateway with
| None ->
Expand Down
3 changes: 3 additions & 0 deletions src/ipv4/static_ipv4.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ module Make (Ethernet: Ethernet.S) (Arpv4 : Arp.S) = struct
| Error `Local ->
Log.warn (fun f -> f "Could not find %a on the local network" Ipaddr.V4.pp dst);
Lwt.return @@ Error (`No_route "no response for IP on local network")
| Error `Loopback ->
Log.warn (fun f -> f "Write to loopback %a dropped" Ipaddr.V4.pp dst);
Lwt.return @@ Error (`No_route "Loopback address")
| Error `Gateway when t.gateway = None ->
Log.warn (fun f -> f "Write to %a would require an external route, which was not provided" Ipaddr.V4.pp dst);
Lwt.return @@ Ok ()
Expand Down