-
Notifications
You must be signed in to change notification settings - Fork 748
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
filter, action: Add support for tunnel_key #499
Conversation
LGTM |
af98a13
to
0677801
Compare
@vishvananda @aboch can this PR be merged? thanks. |
filter_linux.go
Outdated
if v4 := action.SrcAddr.To4(); v4 != nil { | ||
aopts.AddRtAttr(nl.TCA_TUNNEL_KEY_ENC_IPV4_SRC, v4[:]) | ||
} else { | ||
aopts.AddRtAttr(nl.TCA_TUNNEL_KEY_ENC_IPV6_SRC, action.SrcAddr.To16()[:]) |
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.
Why To16()
if you already know it is a IPv6 address?
https://golang.org/src/net/ip.go?s=5477:5499#L199
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 have fixed it. thanks.
Signed-off-by: Zhiyuan Hou <[email protected]>
0677801
to
1857744
Compare
@aboch fixed it. thanks. |
aopts.AddRtAttr(nl.TCA_TUNNEL_KEY_ENC_KEY_ID, htonl(action.KeyID)) | ||
if v4 := action.SrcAddr.To4(); v4 != nil { | ||
aopts.AddRtAttr(nl.TCA_TUNNEL_KEY_ENC_IPV4_SRC, v4[:]) | ||
} else if v6 := action.SrcAddr.To16(); v6 != nil { |
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.
What about here?
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.
@aboch In golang, ip address is a simple slice and does not have an address family flag. So if IP.To4() return a nil and IP.To16() reutrn a not nil, It should be ipv6 address.
This is a similar code: https://golang.org/src/net/ip.go#L420 .
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.
ok
LGTM |
The PR vishvananda/netlink#499 has been merged, update vendor to point new commit. Signed-off-by: Zhiyuan Hou <[email protected]>
Add support for tunnel_key