From 6a449648e32849228254e7f1533196a9bc4ff468 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sat, 23 Jan 2016 21:50:39 -0500 Subject: [PATCH] Use host-route netmask in gateway outbound relay. I'm not sure why previously it had been hardcoded to a 32-bit netmask; presumably this was an error on my part way back in the original routing implementation in minimart-netstack. It looks as if the code was originally written for a kind of host route that didn't have a netmask, and was never updated to include the netmask later. --- ip.rkt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ip.rkt b/ip.rkt index 4411023..7166647 100644 --- a/ip.rkt +++ b/ip.rkt @@ -127,7 +127,7 @@ (define (spawn-gateway-route network netmask gateway-addr interface-name) (define the-route (gateway-route network netmask gateway-addr interface-name)) - (define host-route-projector (compile-projection (host-route (?!) ? ?))) + (define host-route-projector (compile-projection (host-route (?!) (?!) ?))) (define gateway-route-projector (compile-projection (gateway-route (?!) (?!) ? ?))) (define net-route-projector (compile-projection (net-route (?!) (?!) ?))) (define gateway-arp-projector (arp-query IPv4-ethertype @@ -144,7 +144,7 @@ (spawn (lambda (e s) (match e [(scn g) - (define host-ips (trie-project/set/single g host-route-projector)) + (define host-ips+netmasks (trie-project/set g host-route-projector)) (define gw-nets+netmasks (trie-project/set g gateway-route-projector)) (define net-nets+netmasks (trie-project/set g net-route-projector)) (define gw-ip+hwaddr @@ -158,7 +158,7 @@ (if (trie-empty? (project-assertions g (?! the-route))) (quit) (transition (gateway-route-state - (set-union (for/set ([ip host-ips]) (list ip 32)) + (set-union host-ips+netmasks gw-nets+netmasks net-nets+netmasks) (and gw-ip+hwaddr (car gw-ip+hwaddr))