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

New: Added iproute from trireme-lib to netlink-go #31

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

sibicramesh
Copy link
Contributor

@sibicramesh sibicramesh commented May 2, 2018

--> 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

@sibicramesh sibicramesh self-assigned this May 2, 2018
@sibicramesh sibicramesh requested review from amitlimaye and satyamsi May 2, 2018 18:08
return buf
}

func send(buf []byte) error {
Copy link
Contributor

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)

maskbuf := markMaskAttrToWire(uint32(rule.Mask))
nlmsghdr.Len = syscall.SizeofNlMsghdr + uint32(len(rtmsgbuf)+len(priobuf)+len(markbuf)+len(maskbuf))
buf := common.SerializeNlMsgHdr(nlmsghdr)

Copy link
Contributor

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

@sibicramesh
Copy link
Contributor Author

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 this pull request may close these issues.

2 participants