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

snet: discard stray incoming packets on Dialed conn #4546

Open
matzf opened this issue Jun 10, 2024 · 0 comments
Open

snet: discard stray incoming packets on Dialed conn #4546

matzf opened this issue Jun 10, 2024 · 0 comments

Comments

@matzf
Copy link
Contributor

matzf commented Jun 10, 2024

Follow up from #4344.

A connected UDP socket only receives packets from the connected address. All other packets are discarded. (See e.g. man 2 connect, "If the socket sockfd is of type SOCK_DGRAM, then addr [...] is the only address from which datagrams are received", analogous in BSD man connect).

In snet, this is not enforced. A Dialed snet connection will receive packets from any source address. If the caller uses Read (and not ReadFrom), it will have no way to tell whether the packet is from the connected host, or some other source.

Related note: the comment on snet.scionConnReader.Read() says: "If the remote address for the connection is unknown, Read returns an error." This is not implemented (it was, git blame shows removed in #2411).
It appears that these issues are related; Read should check that the source of the packet is the connected remote address. Stray packets should be silently dropped. If there is no connected remote address, Read should error.

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

No branches or pull requests

1 participant