This commit is contained in:
parent
0af140b70f
commit
d7d6f2bdfc
|
@ -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 "/"))
|
||||
|
|
Loading…
Reference in New Issue