Skip to content

Commit

Permalink
Merge pull request #841 from TrekkieCoder/main
Browse files Browse the repository at this point in the history
Added check for AF_INET/AF_INET6 for dual-stack environments
  • Loading branch information
UltraInstinct14 authored Oct 15, 2024
2 parents f919f5a + f354fa8 commit a5c12c2
Showing 1 changed file with 13 additions and 4 deletions.
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

0 comments on commit a5c12c2

Please sign in to comment.