-
Notifications
You must be signed in to change notification settings - Fork 7
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
New: Added iproute from trireme-lib to netlink-go #31
base: master
Are you sure you want to change the base?
Conversation
iproute/helpers.go
Outdated
return buf | ||
} | ||
|
||
func send(buf []byte) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have this function in our common library. Socket Send should be identical in all netlink packages.
(I think only the flags and family will change)
iproute/iproute.go
Outdated
maskbuf := markMaskAttrToWire(uint32(rule.Mask)) | ||
nlmsghdr.Len = syscall.SizeofNlMsghdr + uint32(len(rtmsgbuf)+len(priobuf)+len(markbuf)+len(maskbuf)) | ||
buf := common.SerializeNlMsgHdr(nlmsghdr) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make a variadic function allocate slice once and copy data.
Multiple appends here are not great and the same code is present in all functions
--> This PR adds iproute package from trireme-lib
--> Added interfaces for testing
--> Added mock for socket functions
--> Added unit tests for iproute
--> https://github.com/aporeto-inc/enforcerd/pull/577