add zero max ports error

This commit is contained in:
soypat
2025-07-15 00:57:24 -03:00
parent ad22c61b28
commit 63dc5d1079
4 changed files with 8 additions and 0 deletions
+2
View File
@@ -36,6 +36,8 @@ func (ls *StackEthernet) HardwareAddr6() [6]byte {
func (ls *StackEthernet) Reset6(mac, gateway [6]byte, mtu, maxNodes int) error {
if mtu > math.MaxUint16 || mtu < 256 {
return errors.New("invalid MTU")
} else if maxNodes <= 0 {
return errZeroMaxNodes
}
ls.handlers = slices.Grow(ls.handlers[:0], maxNodes)
*ls = StackEthernet{