Skip to content

Commit

Permalink
Merge pull request #22 from BSpendlove/master
Browse files Browse the repository at this point in the history
fix ipv6 when creating attribute for SetValue
  • Loading branch information
gen2brain authored Dec 2, 2024
2 parents 512f07e + 277605f commit 0f66927
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,15 @@ func newPacket(secret []byte, address string, statAttr radius.Attribute) (*radiu
}
}

attrIP, err := radius.NewIPAddr(ip)
var attrIP radius.Attribute
if ip.To16() != nil {
attrIP, err = radius.NewIPv6Addr(ip)
} else if ip.To4() != nil {
attrIP, err = radius.NewIPAddr(ip)
} else {
return nil, fmt.Errorf("invalid IP address: %v", host)
}

if err != nil {
return nil, err
}
Expand Down

0 comments on commit 0f66927

Please sign in to comment.