cilium-cli: Fix ipv6 ping regex #38814
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix IPv6 ping header detection in connectivity test
Description
This PR fixes the ping header regex pattern to support both IPv4 and IPv6 formats in the connectivity test.
Currently, when running connectivity tests with IPv6, the ping command's header has a slightly different format:
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
PING 2606:4700:4700::1111(2606:4700:4700::1111) 56 data bytes
The existing regex only matches the IPv4 format (
bytes of data.
), causing issues when testing with IPv6.Changes
pingHeaderPattern
regex to match both IPv4 and IPv6 ping header formats^PING .*(bytes of data\.|data bytes)
Testing
I created a test program to verify the updated regex pattern works with both IPv4 and IPv6 formats:
Output:
Related Issues
Fixes cilium/cilium-cli#2352