-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for ipv6 #114
Add support for ipv6 #114
Conversation
Welcome to the Merbridge OpenSource Community!👏 We're delighted to have you onboard 💘 |
bpf/mb_connect.c
Outdated
struct origin_info origin = {.ip = ctx->user_ip4, | ||
.port = ctx->user_port}; | ||
struct origin_info origin; | ||
__builtin_memset(&origin, 0, sizeof(origin)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pattern avoids padding issues, otherwise there would be a verifier error
See iovisor/bcc#2623 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe we don't need the ENABLE_IPV4 macro, it's probably there by default.
I'm not sure if we are gonna support dual stack, if yes, the v4 macro would be helpful
|
6e80ef6
to
3a59641
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
just some nits.
96007c7
to
c307a37
Compare
enable dual stack and run prog error:
|
Fixed, |
I am testing it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @kebe7jun, it's ready for review now and I've tested it, PTAL when you get a chance
printk("write cookie_original_dst failed"); | ||
return 0; | ||
} | ||
// TODO(dddddai): add support for annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ipv6 annotations are not supported yet, will follow up
Great work! |
conn4 := fmt.Sprintf("%s/%s/net/tcp", config.HostProc, pid) | ||
return !findStr(conn4, []byte(fmt.Sprintf(": %0.8d:%0.4X %0.8d:%0.4X 0A", 0, 15001, 0, 0))) | ||
if config.EnableIPV4 { | ||
conn4 := fmt.Sprintf("%s/%s/net/tcp", config.HostProc, pid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the listener should also consider ipv6?
return !findStr(conn4, []byte(fmt.Sprintf(": %0.8d:%0.4X %0.8d:%0.4X 0A", 0, 15001, 0, 0))) | ||
if config.EnableIPV4 { | ||
conn4 := fmt.Sprintf("%s/%s/net/tcp", config.HostProc, pid) | ||
return !findStr(conn4, []byte(fmt.Sprintf(": %0.8d:%0.4X %0.8d:%0.4X 0A", 0, 15001, 0, 0))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it not supposed to use 15001 directly, in kuma or linkerd will not work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I don't know much about kuma and linkerd...
Could we focus on istio in this pr and support others later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give me some time, I'll look at it
@@ -29,6 +33,8 @@ var ( | |||
UseReconnect = true | |||
Debug = false | |||
EnableCNI = false | |||
EnableIPV4 = getEnvOrDefault("ENABLE_IPV4", "true") == "true" | |||
EnableIPV6 = getEnvOrDefault("ENABLE_IPV6", "false") == "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe using command line parameters will better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought so but I'm a bit concerned about:
merbridge/deploy/all-in-one.yaml
Lines 73 to 79 in 1dcf48b
lifecycle: | |
preStop: | |
exec: | |
command: | |
- make | |
- -k | |
- clean |
It can't get flags from the command params, so I use env variables instead, though merbridge will clean up eBPF stuff when it exits
merbridge/controller/localip/localip.go
Line 67 in 1dcf48b
if err = ebpfs.UnLoadMBProgs(); err != nil { |
Codecov Report
@@ Coverage Diff @@
## main #114 +/- ##
==========================================
+ Coverage 41.10% 41.83% +0.72%
==========================================
Files 6 6
Lines 399 404 +5
==========================================
+ Hits 164 169 +5
Misses 221 221
Partials 14 14
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
To enable ipv6 only, just add the following env in the daemon set:
Note that ipv6 requires cni-mode enabled