From d7d6f2bdfccecec59395da7e75b84836cb3895f8 Mon Sep 17 00:00:00 2001 From: Milo Date: Fri, 31 Jan 2020 17:30:07 -0500 Subject: [PATCH] a --- iputil.rkt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/iputil.rkt b/iputil.rkt index 02664df..ecc9474 100644 --- a/iputil.rkt +++ b/iputil.rkt @@ -44,9 +44,10 @@ (string-join parts ".")) (define (ip-netmask ip) - (for/sum ([i (in-range 32)]) - #:break (positive? (bitwise-and ip (arithmetic-shift 1 i))) - 1)) + (- 32 + (for/sum ([i (in-range 32)]) + #:break (positive? (bitwise-and ip (arithmetic-shift 1 i))) + 1))) (define (string->subnet str) (match-define (list ipstr maskstr) (string-split str "/"))