File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 20
20
import os
21
21
import re
22
22
23
- from ipaddress import IPv6Network
23
+ from ipaddress import IPv6Network , IPv6Address
24
24
from json import dumps as json_write
25
25
26
26
from vyos import ConfigError
@@ -103,8 +103,14 @@ def verify(nat64) -> None:
103
103
# Verify that source.prefix is set and is a /96
104
104
if not dict_search ("source.prefix" , instance ):
105
105
raise ConfigError (f"Source NAT64 rule { rule } missing source prefix" )
106
- if IPv6Network (instance ["source" ]["prefix" ]).prefixlen != 96 :
106
+ src_prefix = IPv6Network (instance ["source" ]["prefix" ])
107
+ if src_prefix .prefixlen != 96 :
107
108
raise ConfigError (f"Source NAT64 rule { rule } source prefix must be /96" )
109
+ if (int (src_prefix [0 ]) & int (IPv6Address ('0:0:0:0:ff00::' ))) != 0 :
110
+ raise ConfigError (
111
+ f'Source NAT64 rule { rule } source prefix is not RFC6052-compliant: '
112
+ 'bits 64 to 71 (9th octet) must be zeroed'
113
+ )
108
114
109
115
pools = dict_search ("translation.pool" , instance )
110
116
if pools :
You can’t perform that action at this time.
0 commit comments