Skip to content

fix: CompareIpByte skips invalid IP bytes instead of using zero-value IP - #1909

Open
bhumikadangayach wants to merge 1 commit into
kmesh-net:mainfrom
bhumikadangayach:fix/compareipbyte-invalid-ip
Open

fix: CompareIpByte skips invalid IP bytes instead of using zero-value IP#1909
bhumikadangayach wants to merge 1 commit into
kmesh-net:mainfrom
bhumikadangayach:fix/compareipbyte-invalid-ip

Conversation

@bhumikadangayach

Copy link
Copy Markdown

Fixes #1908

CompareIpByte logged an error on invalid IP bytes but didn't stop - the zero-value IP's String() ("invalid IP") was used as a map key anyway, so multiple malformed entries would collide under the same key, and a malformed entry in one side could incorrectly match against one left over from the other side.

Added continue after the error log in both loops, so malformed entries are skipped entirely instead of participating in the comparison.

Added a test case covering malformed entries mixed with valid ones on both sides, verifying the diff result only reflects genuine IP comparisons.

@kmesh-bot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign okabe-rintarou-0 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.59%. Comparing base (32fe3df) to head (21ceff1).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Coverage Δ
pkg/nets/nets.go 45.45% <100.00%> (+4.71%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 045678d...21ceff1. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yashisrani

Copy link
Copy Markdown
Contributor

There is one commit incorrectly signed off. This means that the author of this commit failed to include a Signed-off-by line in the commit message.

To avoid having PRs blocked in the future, always include Signed-off-by: Author Name authoremail@example.com in every commit message. You can also do this automatically by using the -s flag (i.e., git commit -s).

Here is how to fix the problem so that this code can be merge

Signed-off-by: Bhumika Dangayach <139267865+bhumikadangayach@users.noreply.github.com>
@bhumikadangayach

Copy link
Copy Markdown
Author

E2E istio 1.26 failed on the log-collection step after all tests passed - PASS on TestKmeshRestart etc, but exits 1 because of cat: kmesh_daemon.log: No such file or directory afterward. Same pattern on #1845 and #1881, both resolved on re-run. Filed separately as #1911. Could you trigger a re-run?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CompareIpByte silently continues after invalid IP bytes, causing wrong service address diffs

3 participants