Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NeighAttributes does not appear to support non-Ethernet link-layer addresses #182

Closed
dswarbrick opened this issue Aug 17, 2023 · 3 comments · Fixed by #183
Closed

NeighAttributes does not appear to support non-Ethernet link-layer addresses #182

dswarbrick opened this issue Aug 17, 2023 · 3 comments · Fixed by #183

Comments

@dswarbrick
Copy link
Contributor

dswarbrick commented Aug 17, 2023

Poking around in the code, I see that NeighAttributes.decode() expects link-layer addresses to be six bytes (i.e. Ethernet MAC addresses).

func (a *NeighAttributes) decode(ad *netlink.AttributeDecoder) error {
	for ad.Next() {
		switch ad.Type() {
...
		case unix.NDA_LLADDR:
			if len(ad.Bytes()) != 6 {
				return errInvalidNeighMessageAttr
			}
			a.LLAddress = ad.Bytes()
...

It would be nice if this also supported other lengths supported by net.ParseMAC(), such as 20-byte InfiniBand link-layer addresses, allowing this package to be used in IPoIB environments.

@jsimonetti
Copy link
Owner

This was an easy fix.

Thanks for reporting it!

@dswarbrick
Copy link
Contributor Author

Wow, awesome! Thank you very much for the rapid response!

@jsimonetti
Copy link
Owner

My pleasure. I'll tag a new release in a minute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants