Skip to content
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

Added check for AF_INET/AF_INET6 for dual-stack environments #841

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions api/loxinlp/nlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -1188,10 +1188,19 @@ func DelNeigh(neigh nlp.Neigh, link nlp.Link) int {
func AddRoute(route nlp.Route) int {
var ipNet net.IPNet
if route.Dst == nil {
r := net.IPv4(0, 0, 0, 0)
m := net.CIDRMask(0, 32)
r = r.Mask(m)
ipNet = net.IPNet{IP: r, Mask: m}
if route.Family == 2 {
r := net.IPv4(0, 0, 0, 0)
m := net.CIDRMask(0, 32)
r = r.Mask(m)
ipNet = net.IPNet{IP: r, Mask: m}
} else if route.Family == 10 {
r := net.ParseIP("::")
m := net.CIDRMask(0, 128)
r = r.Mask(m)
ipNet = net.IPNet{IP: r, Mask: m}
} else {
return -1
}
} else {
ipNet = *route.Dst
}
Expand Down
Loading