Skip to content

xds: Prefer zero-length CIDR over unspecified prefix ranges - #13159

Open
hidingmyname wants to merge 1 commit into
grpc:masterfrom
hidingmyname:xds-wildcard-prefix-specificity
Open

hidingmyname wants to merge 1 commit into
grpc:masterfrom
hidingmyname:xds-wildcard-prefix-specificity

Conversation

@hidingmyname

Copy link
Copy Markdown

Fixes #13149

An empty prefix_ranges list and a matching 0.0.0.0/0 both got a matching prefix length of 0, so both filter chains survived the prefix step and select() threw "Found more than one matching filter chains". gRFC A36 says a CIDR with prefix_len 0 is not the same as an unspecified one, because it still matches a network type, so the /0 chain should win.

This scores an empty CIDR list below any matching CIDR: no match is -2, unspecified is -1, and a matching CIDR is its prefix length. The same code handles source_prefix_ranges, so that is fixed too. XdsListenerResource is unchanged, since its uniqueness check already treats the two as different.

Added destPrefixRange_zeroLengthMoreSpecificThanUnspecified and sourcePrefixRange_zeroLengthMoreSpecificThanUnspecified. Both fail without the change.

:grpc-xds:test passes (4488 tests).

An empty prefix_ranges (or source_prefix_ranges) list and a matching
zero-length CIDR such as 0.0.0.0/0 both got a matching prefix length of
0, so FilterChainSelector kept both chains and select() could throw
"Found more than one matching filter chains". Per gRFC A36 a CIDR with
prefix_len 0 still matches an address family, so it is more specific
than an unspecified CIDR. Score an empty CIDR list below any matching
CIDR.

Fixes grpc#13149

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant