-
Notifications
You must be signed in to change notification settings - Fork 39
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
Address family is a u8, not u16 #198
Conversation
As per definition of ndmsg in kernel source: struct ndmsg { __u8 ndm_family; __u8 ndm_pad1; __u16 ndm_pad2; __s32 ndm_ifindex; __u16 ndm_state; __u8 ndm_flags; __u8 ndm_type; }; Signed-off-by: Daniel Swarbrick <[email protected]>
This probably did not have any ill-effects in the past, but if there was junk in Incidentally, why not use the predefined NdMsg struct (and others) in the unix package? |
Thank you! Nice catch. With regard to not using NdMsg, I believe at the time of writing the initial package (some 7 years ago), these structs where not yet extracted from the kernel and we had to do this in the package. |
If you don't mind, I would gladly submit a PR to refactor the code to use such structs from the unix package - in the interest of code cleanliness and DRY. |
If this can be done in a backwards compatible fashion I have no problem with that. the current design (using an internal |
Aha, now I see what you mean about your internal/unix package, providing the Linux constants on non-Linux GOOS. Correct me if I'm wrong, but doesn't this rtnetlink package specifically only support Linux? I'm not sure I understand what Darwin users could actually achieve by using this code, other than running the unit tests. It's not like the Darwin kernel is going to speak the same rtnetlink protocol as Linux does. |
The support is for sure linux only. The reasoning behind those internal constant for non-Linux GOOS was to allow macos developers to work with this package proper. i will have a look if this internal package is still required. @florianl could you elaborate a bit if the internal package created in pr #63 is still required these days? |
Looking at packages that import In addition, GOOS=darwin golang.org/x/sys/unix does not provide NdMsg. |
As per definition of ndmsg in kernel source: