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 Socket created for each outbound packet #8

Closed
henridevieux opened this issue Apr 26, 2017 · 2 comments
Closed

New Socket created for each outbound packet #8

henridevieux opened this issue Apr 26, 2017 · 2 comments
Assignees

Comments

@henridevieux
Copy link
Contributor

In tcp/tcp.go, the send function creates a new raw socket each time it gets called.

This causes unnecessary overhead. Socket's should be created and passed along to the send code.

Note: The DSCP value is currently being set on each socket file descriptor, rather than in a manually created IP header, so this will have to occur on the shared socket at the start of each batch cycle.

@henridevieux
Copy link
Contributor Author

This needs to be addressed with two related changes.

First, using RawConn from net.IPv4 (or building something similar) will allow for creating a connection that can get passed down to the send function in tcp.go so that it does not require creating a new raw socket for each outbound packet.

However, the system currently sets the DSCP/TOS parameter on the raw socket itself. If we are sharing one socket file descriptor, we will need to set the TOS field in the IP header, which means we now need to create the IP header ourselves (and make use of IP_HDRINCL).

So the second change will be to use gopacket to create the packet from layer 3 and up. The kernel will still handle layer 2.

@henridevieux
Copy link
Contributor Author

#25

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

No branches or pull requests

1 participant