mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 15:57:00 +00:00
getdata: add cidr range support
This makes 'range6 123::/45' style cidr notation to be understood as address range. Earlier ranges that used cidr failed to parse completely. Reported-by: Jeff Bailey <jeffrey.bailey@bt.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
48d0629881
commit
bb0fa9adae
13 changed files with 175 additions and 5 deletions
|
|
@ -20,6 +20,8 @@ TESTS = \
|
|||
tests/leading0 \
|
||||
tests/one-ip \
|
||||
tests/one-line \
|
||||
tests/range4 \
|
||||
tests/range6 \
|
||||
tests/same-twice \
|
||||
tests/simple \
|
||||
tests/sorts \
|
||||
|
|
|
|||
31
tests/confs/range4
Normal file
31
tests/confs/range4
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
shared-network example1 {
|
||||
subnet 10.0.0.0 netmask 255.255.255.0 {
|
||||
pool {
|
||||
range 10.0.0.0/27;
|
||||
}
|
||||
}
|
||||
subnet 10.1.0.0 netmask 255.255.255.0 {
|
||||
pool {
|
||||
range 10.1.0.1/27;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
shared-network example2 {
|
||||
subnet 10.2.0.0 netmask 255.255.255.0 {
|
||||
pool {
|
||||
range 10.2.0.1/28;
|
||||
}
|
||||
}
|
||||
subnet 10.3.0.0 netmask 255.255.255.0 {
|
||||
pool {
|
||||
range 10.3.0.1/29;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subnet 10.4.0.0 netmask 255.255.255.0 {
|
||||
pool {
|
||||
range 10.4.0.1/32;
|
||||
}
|
||||
}
|
||||
4
tests/confs/range6
Normal file
4
tests/confs/range6
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
subnet6 dead:abba:1000::/56 {
|
||||
range6 dead:abba:1000::/56;
|
||||
prefix6 dead:abba:1000:0100:: dead:abba:1000:ff00::/56;
|
||||
}
|
||||
16
tests/expected/range4
Normal file
16
tests/expected/range4
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Ranges:
|
||||
shared net name first ip last ip max cur percent touch t+c t+c perc
|
||||
example1 10.0.0.0 - 10.0.0.31 32 12 37.500 0 12 37.500
|
||||
example1 10.1.0.1 - 10.1.0.31 31 10 32.258 0 10 32.258
|
||||
example2 10.2.0.1 - 10.2.0.15 15 8 53.333 0 8 53.333
|
||||
example2 10.3.0.1 - 10.3.0.7 7 7 100.000 0 7 100.000
|
||||
All networks 10.4.0.1 - 10.4.0.1 1 1 100.000 0 1 100.000
|
||||
|
||||
Shared networks:
|
||||
name max cur percent touch t+c t+c perc
|
||||
example1 63 22 34.921 0 22 34.921
|
||||
example2 22 15 68.182 0 15 68.182
|
||||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 86 38 44.186 0 38 44.186
|
||||
10
tests/expected/range6
Normal file
10
tests/expected/range6
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Ranges:
|
||||
shared net name first ip last ip max cur percent touch t+c t+c perc
|
||||
All networks dead:abba:1000:: - dead:abba:1000:ff:ffff:ffff:ffff:ffff 4.72237e+21 2 0.000 1 3 0.000
|
||||
|
||||
Shared networks:
|
||||
name max cur percent touch t+c t+c perc
|
||||
|
||||
Sum of all ranges:
|
||||
name max cur percent touch t+c t+c perc
|
||||
All networks 4.72237e+21 2 0.000 1 3 0.000
|
||||
1
tests/leases/range4
Symbolic link
1
tests/leases/range4
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
complete
|
||||
1
tests/leases/range6
Symbolic link
1
tests/leases/range6
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
v6
|
||||
1
tests/range4
Symbolic link
1
tests/range4
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
test.sh
|
||||
1
tests/range6
Symbolic link
1
tests/range6
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
test.sh
|
||||
Loading…
Add table
Add a link
Reference in a new issue