Fixed bug in bpf where IPv4 destination address was stored as IPv6#648
Fixed bug in bpf where IPv4 destination address was stored as IPv6#648kmesh-bot merged 3 commits intokmesh-net:mainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Continue to review full report in Codecov by Sentry.
|
bpf/kmesh/workload/sockops.c
Outdated
| IP6_COPY(key.addr.ip6, skops->local_ip6); | ||
| if (skops->family == AF_INET6) { | ||
| if (is_ipv4_mapped_addr(skops->local_ip6)) | ||
| key.addr.ip4 = skops->local_ip4; |
There was a problem hiding this comment.
is skops->local_ip4 and skops->local_ip6 set simutaneously?
bpf/kmesh/workload/sockops.c
Outdated
| tuple_key->ipv6.dport = GET_SKOPS_REMOTE_PORT(skops); | ||
| } | ||
|
|
||
| if (is_ipv4_mapped_addr(tuple_key->ipv6.daddr)) { |
There was a problem hiding this comment.
I doubt this is not right. If the dst address is mapped address. Assume you want to extract to ipv4, i am not sure why operating on ip6 below, since is it a union of ipv4 and ipv6.
And BTW, since the family == AF_INET6, how can we make it work when we dnat to v4?
Can you test with a real example
40ef3e2 to
c33e38e
Compare
c33e38e to
6dda9e0
Compare
6dda9e0 to
ccb0848
Compare
| } | ||
| conn.dstPort = uint32(tupleV6.DstPort) | ||
| // conn.dstIp = restoreIPv4(conn.dstIp) | ||
| // conn.srcIp = restoreIPv4(conn.srcIp) |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Should be backported |
|
In response to a cherrypick label: new pull request created: #660 |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #653
Special notes for your reviewer:
Does this PR introduce a user-facing change?: