-
Notifications
You must be signed in to change notification settings - Fork 0
fix(encapsulation): route Cilium IPIP traffic through VxLAN overlay #6
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ func (t *Topology) Routes(kiloIfaceName string, kiloIface, privIface, tunlIface | |
| var gw net.IP | ||
| for _, segment := range t.segments { | ||
| if segment.location == t.location { | ||
| gw = enc.Gw(t.updateEndpoint(segment.endpoint, segment.key, &segment.persistentKeepalive).IP(), segment.privateIPs[segment.leader], segment.cidrs[segment.leader]) | ||
| gw = enc.Gw(t.updateEndpoint(segment.endpoint, segment.key, &segment.persistentKeepalive).IP(), segment.privateIPs[segment.leader], segment.ciliumInternalIPs[segment.leader], segment.cidrs[segment.leader]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: rg -n "ciliumInternalIPs" --type go -C 3Repository: cozystack/kilo Length of output: 15502 🏁 Script executed: sed -n '157,185p' pkg/mesh/topology.goRepository: cozystack/kilo Length of output: 1160 🏁 Script executed: sed -n '40,75p' pkg/mesh/routes.goRepository: cozystack/kilo Length of output: 1701 🏁 Script executed: sed -n '150,175p' pkg/mesh/routes.goRepository: cozystack/kilo Length of output: 1264 Fix slice length mismatch between The 🤖 Prompt for AI Agents |
||
| break | ||
| } | ||
| } | ||
|
|
@@ -61,10 +61,11 @@ func (t *Topology) Routes(kiloIfaceName string, kiloIface, privIface, tunlIface | |
| if segment.privateIPs[i].Equal(t.privateIP.IP) { | ||
| continue | ||
| } | ||
| nodeGw := enc.Gw(nil, segment.privateIPs[i], segment.ciliumInternalIPs[i], segment.cidrs[i]) | ||
| routes = append(routes, encapsulateRoute(&netlink.Route{ | ||
| Dst: segment.cidrs[i], | ||
| Flags: int(netlink.FLAG_ONLINK), | ||
| Gw: segment.privateIPs[i], | ||
| Gw: nodeGw, | ||
| LinkIndex: privIface, | ||
| Protocol: unix.RTPROT_STATIC, | ||
| }, enc.Strategy(), t.privateIP, tunlIface)) | ||
|
|
@@ -74,7 +75,7 @@ func (t *Topology) Routes(kiloIfaceName string, kiloIface, privIface, tunlIface | |
| routes = append(routes, &netlink.Route{ | ||
| Dst: oneAddressCIDR(segment.privateIPs[i]), | ||
| Flags: int(netlink.FLAG_ONLINK), | ||
| Gw: segment.privateIPs[i], | ||
| Gw: nodeGw, | ||
| LinkIndex: tunlIface, | ||
| Src: t.privateIP.IP, | ||
| Protocol: unix.RTPROT_STATIC, | ||
|
|
@@ -155,10 +156,11 @@ func (t *Topology) Routes(kiloIfaceName string, kiloIface, privIface, tunlIface | |
| if segment.privateIPs[i].Equal(t.privateIP.IP) { | ||
| continue | ||
| } | ||
| nodeGw := enc.Gw(nil, segment.privateIPs[i], segment.ciliumInternalIPs[i], segment.cidrs[i]) | ||
| routes = append(routes, encapsulateRoute(&netlink.Route{ | ||
| Dst: segment.cidrs[i], | ||
| Flags: int(netlink.FLAG_ONLINK), | ||
| Gw: segment.privateIPs[i], | ||
| Gw: nodeGw, | ||
| LinkIndex: privIface, | ||
| Protocol: unix.RTPROT_STATIC, | ||
| }, enc.Strategy(), t.privateIP, tunlIface)) | ||
|
|
@@ -168,7 +170,7 @@ func (t *Topology) Routes(kiloIfaceName string, kiloIface, privIface, tunlIface | |
| routes = append(routes, &netlink.Route{ | ||
| Dst: oneAddressCIDR(segment.privateIPs[i]), | ||
| Flags: int(netlink.FLAG_ONLINK), | ||
| Gw: segment.privateIPs[i], | ||
| Gw: nodeGw, | ||
| LinkIndex: tunlIface, | ||
| Src: t.privateIP.IP, | ||
| Protocol: unix.RTPROT_STATIC, | ||
|
|
||
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 error handling in this function is inconsistent. If
iproute.DeleteAddressesfails, the error is swallowed, andiproute.RemoveInterfaceis not called. However, ifiproute.RemoveInterfacefails, the error is returned. Swallowing the error fromDeleteAddressescan hide underlying issues during cleanup. It's better to return the error to the caller for logging and diagnostics.