Component
securityGroup
Problem description
IPv6 range validation compares the textual forms of the start and end addresses with String.compareTo instead of comparing parsed IPv6 values.
Relevant code:
https://github.com/ZSvirt/zsvirt/blob/main/plugin/securityGroup/src/main/java/org/zstack/network/securitygroup/SecurityGroupApiInterceptor.java#L809
For example, 2001:db8::2-2001:db8::10 is a valid ascending range numerically, but the string comparison sees "2" as greater than "1" and rejects it. Conversely, some reversed ranges can pass this check.
Steps to reproduce
- Create an IPv6 security group.
- Add a rule whose IPv6 source or destination range is
2001:db8::2-2001:db8::10.
- Observe that the rule is rejected as an invalid range.
Expected behavior
IPv6 range ordering should be evaluated numerically after parsing both addresses.
Proposed fix
Reuse IPv6NetworkUtils.isValidIpRange or compare parsed IPv6Address values, and add regression cases for multi-digit host portions and reversed ranges.
Component
securityGroup
Problem description
IPv6 range validation compares the textual forms of the start and end addresses with
String.compareToinstead of comparing parsed IPv6 values.Relevant code:
https://github.com/ZSvirt/zsvirt/blob/main/plugin/securityGroup/src/main/java/org/zstack/network/securitygroup/SecurityGroupApiInterceptor.java#L809
For example,
2001:db8::2-2001:db8::10is a valid ascending range numerically, but the string comparison sees"2"as greater than"1"and rejects it. Conversely, some reversed ranges can pass this check.Steps to reproduce
2001:db8::2-2001:db8::10.Expected behavior
IPv6 range ordering should be evaluated numerically after parsing both addresses.
Proposed fix
Reuse
IPv6NetworkUtils.isValidIpRangeor compare parsedIPv6Addressvalues, and add regression cases for multi-digit host portions and reversed ranges.