@@ -85,21 +85,21 @@ def verify(dhcpv6):
85
85
86
86
# Stop address must be greater or equal to start address
87
87
if not ip_address (stop ) >= ip_address (start ):
88
- raise ConfigError (f'address-range stop address "{ stop } " must be greater then or equal ' \
88
+ raise ConfigError (f'address-range stop address "{ stop } " must be greater than or equal ' \
89
89
f'to the range start address "{ start } "!' )
90
90
91
91
# DHCPv6 range start address must be unique - two ranges can't
92
92
# start with the same address - makes no sense
93
93
if start in range6_start :
94
94
raise ConfigError (f'Conflicting DHCPv6 lease range: ' \
95
- f'Pool start address "{ start } " defined multipe times!' )
95
+ f'Pool start address "{ start } " defined multiple times!' )
96
96
range6_start .append (start )
97
97
98
98
# DHCPv6 range stop address must be unique - two ranges can't
99
99
# end with the same address - makes no sense
100
100
if stop in range6_stop :
101
101
raise ConfigError (f'Conflicting DHCPv6 lease range: ' \
102
- f'Pool stop address "{ stop } " defined multipe times!' )
102
+ f'Pool stop address "{ stop } " defined multiple times!' )
103
103
range6_stop .append (stop )
104
104
105
105
if 'prefix' in subnet_config :
@@ -113,12 +113,32 @@ def verify(dhcpv6):
113
113
raise ConfigError ('prefix-delegation start address not defined!' )
114
114
115
115
for prefix , prefix_config in subnet_config ['prefix_delegation' ]['start' ].items ():
116
+ prefix_start_addr = prefix
117
+
118
+ # Prefix start address must be inside network
119
+ if not ip_address (prefix_start_addr ) in ip_network (subnet ):
120
+ raise ConfigError (f'Prefix delegation start address ' \
121
+ f'"{ prefix_start_addr } " is not in ' \
122
+ f'subnet "{ subnet } "' )
123
+
116
124
if 'stop' not in prefix_config :
117
- raise ConfigError (f'Stop address of delegated IPv6 prefix range "{ prefix } " ' \
125
+ raise ConfigError (f'Stop address of delegated IPv6 ' \
126
+ f'prefix range "{ prefix } " ' \
118
127
f'must be configured' )
119
128
129
+ if 'stop' in prefix_config :
130
+ prefix_stop_addr = prefix_config ['stop' ]
131
+
132
+ # Prefix stop address must be inside network
133
+ if not (ip_address (prefix_stop_addr ) in
134
+ ip_network (subnet )):
135
+ raise ConfigError (f'Prefix delegation stop ' \
136
+ f'address "{ prefix_stop_addr } " ' \
137
+ f'is not in subnet "{ subnet } "' )
138
+
120
139
if 'prefix_length' not in prefix_config :
121
- raise ConfigError ('Length of delegated IPv6 prefix must be configured' )
140
+ raise ConfigError (f'Length of delegated IPv6 prefix ' \
141
+ f'must be configured' )
122
142
123
143
# Static mappings don't require anything (but check if IP is in subnet if it's set)
124
144
if 'static_mapping' in subnet_config :
@@ -130,7 +150,7 @@ def verify(dhcpv6):
130
150
131
151
if 'vendor_option' in subnet_config :
132
152
if len (dict_search ('vendor_option.cisco.tftp_server' , subnet_config )) > 2 :
133
- raise ConfigError (f'No more then two Cisco tftp-servers should be defined for subnet "{ subnet } "!' )
153
+ raise ConfigError (f'No more than two Cisco tftp-servers should be defined for subnet "{ subnet } "!' )
134
154
135
155
# Subnets must be unique
136
156
if subnet in subnets :
0 commit comments