Page MenuHomeFreeBSD

[PPC64] pseries llan: fix MAC address
ClosedPublic

Authored by luporl on Jul 3 2019, 4:34 PM.

Details

Summary

There was an issue in pseries llan driver, that resulted in the first 2 bytes of the MAC address getting stripped, and the last 2 being always 0.

In most cases the network interface still worked, despite the MAC being different of what was specified to QEMU, but when some other host or DHCP server expected a specific MAC, this would fail.

This change fixes this by shifting right by 2 the local-mac-address read from device tree, if its length is 6 instead of 8, as observed in QEMU DT, that always presents a 6 bytes value for this property.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

luporl created this revision.Jul 3 2019, 4:34 PM
jhibbits added inline comments.Jul 3 2019, 7:04 PM
sys/powerpc/pseries/phyp_llan.c
173 ↗(On Diff #59348)

You can simply use memmove() or bcopy() here. Doesn't really make a significant difference, though. I think gcc and clang will both degenerate this into the equivalent loop, or a more optimized form.

luporl updated this revision to Diff 59357.Jul 3 2019, 7:30 PM
  • Address jhibbits comments
luporl marked an inline comment as done.Jul 3 2019, 7:32 PM
luporl added inline comments.
sys/powerpc/pseries/phyp_llan.c
173 ↗(On Diff #59348)

Right.

jhibbits accepted this revision.Jul 3 2019, 9:26 PM
This revision is now accepted and ready to land.Jul 3 2019, 9:26 PM
This revision was automatically updated to reflect the committed changes.