This commit is contained in:
parent
0af140b70f
commit
d7d6f2bdfc
|
@ -44,9 +44,10 @@
|
||||||
(string-join parts "."))
|
(string-join parts "."))
|
||||||
|
|
||||||
(define (ip-netmask ip)
|
(define (ip-netmask ip)
|
||||||
|
(- 32
|
||||||
(for/sum ([i (in-range 32)])
|
(for/sum ([i (in-range 32)])
|
||||||
#:break (positive? (bitwise-and ip (arithmetic-shift 1 i)))
|
#:break (positive? (bitwise-and ip (arithmetic-shift 1 i)))
|
||||||
1))
|
1)))
|
||||||
|
|
||||||
(define (string->subnet str)
|
(define (string->subnet str)
|
||||||
(match-define (list ipstr maskstr) (string-split str "/"))
|
(match-define (list ipstr maskstr) (string-split str "/"))
|
||||||
|
|
Loading…
Reference in New Issue