mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix the MAC address parse in IFLA_ADDRESS and add the tests.
PiperOrigin-RevId: 650333797
This commit is contained in:
@@ -206,10 +206,10 @@ func (s *Stack) setLink(ctx context.Context, id tcpip.NICID, linkAttrs map[uint1
|
||||
}
|
||||
}
|
||||
case linux.IFLA_ADDRESS:
|
||||
addr, err := tcpip.ParseMACAddress(v.String())
|
||||
if err != nil {
|
||||
if len(v) != tcpip.LinkAddressSize {
|
||||
return syserr.ErrInvalidArgument
|
||||
}
|
||||
addr := tcpip.LinkAddress(v)
|
||||
if err := s.Stack.SetNICAddress(id, addr); err != nil {
|
||||
return syserr.TranslateNetstackError(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user