File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ var networkTemplate string
28
28
const (
29
29
magicComment = "--- Managed by zerotier-systemd-manager. Do not remove this comment. ---"
30
30
networkDir = "/etc/systemd/network"
31
- ipv4bits = net . IPv4len * 8
31
+ ipv4bits = 32
32
32
)
33
33
34
34
// parameter list for multiple template operations
@@ -158,14 +158,15 @@ func main() {
158
158
}
159
159
160
160
used , total := ipnet .Mask .Size ()
161
- bits := int (math .Ceil (float64 (total ) / float64 (used )))
162
161
163
- octets := make ([]byte , bits )
162
+ bits := int (math .Trunc (math .Ceil (float64 (total ) / float64 (used ))))
163
+
164
+ octets := make ([]byte , bits + 1 )
164
165
if total == ipv4bits {
165
166
ip = ip .To4 ()
166
167
}
167
168
168
- for i := 0 ; i < bits ; i ++ {
169
+ for i := 0 ; i <= bits ; i ++ {
169
170
octets [i ] = ip [i ]
170
171
}
171
172
You can’t perform that action at this time.
0 commit comments