Skip to content

Update network interface association/disassociation#2594

Merged
stevenengler merged 5 commits intoshadow:mainfrom
stevenengler:associate-args
Dec 8, 2022
Merged

Update network interface association/disassociation#2594
stevenengler merged 5 commits intoshadow:mainfrom
stevenengler:associate-args

Conversation

@stevenengler
Copy link
Copy Markdown
Contributor

The network interface's association and disassociation methods use compatsocket_getSocketName and compatsocket_getPeerName to get the local ip/port and peer ip/port when generating the key, but this can be confusing and lead to bugs. For example, the calling code needs to make to set the correct addresses using compatsocket_setSocketName and compatsocket_setPeerName before associating the socket (setting them after would be a bug), and it's not clear that this requirement exists. Some related issues that come up because of this indirection are #2590 and #2592.

This PR changes the network interface to take the ip/ports explicitly instead. This also makes the code more flexible, and makes it easier to implement Rust socket objects. It also adds an improvement for #2590 so that UDP sockets are always associated using a peer ip/port of 0/0, which means we shouldn't leak UDP sockets anymore when they use connect().

@stevenengler stevenengler self-assigned this Dec 8, 2022
@github-actions github-actions bot added the Component: Main Composing the core Shadow executable label Dec 8, 2022
@stevenengler stevenengler requested review from sporksmith and removed request for sporksmith December 8, 2022 18:41
Rustfmt can't process "let else" blocks and this one was difficult to read, so
this block was broken up and changed.
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 8, 2022

Codecov Report

Base: 66.71% // Head: 67.04% // Increases project coverage by +0.33% 🎉

Coverage data is based on head (350a9c1) compared to base (5342aad).
Patch coverage: 96.96% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2594      +/-   ##
==========================================
+ Coverage   66.71%   67.04%   +0.33%     
==========================================
  Files         197      197              
  Lines       29133    29161      +28     
  Branches     5738     5736       -2     
==========================================
+ Hits        19435    19550     +115     
+ Misses       5162     5064      -98     
- Partials     4536     4547      +11     
Flag Coverage Δ
tests 67.04% <96.96%> (+0.33%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main/host/host.rs 80.78% <95.74%> (+0.33%) ⬆️
src/main/host/network_interface.rs 84.78% <100.00%> (+5.37%) ⬆️
src/main/host/descriptor/descriptor_table.rs 77.64% <0.00%> (-1.18%) ⬇️
src/test/signal/test_signals.rs 84.64% <0.00%> (+0.35%) ⬆️
src/main/host/descriptor/pipe.rs 85.00% <0.00%> (+0.62%) ⬆️
src/lib/shadow-shim-helper-rs/src/signals.rs 70.12% <0.00%> (+0.64%) ⬆️
src/main/host/syscall/handler/socket.rs 64.77% <0.00%> (+0.68%) ⬆️
src/main/network/graph/mod.rs 58.19% <0.00%> (+1.67%) ⬆️
src/main/host/memory_manager/mod.rs 79.22% <0.00%> (+1.69%) ⬆️
... and 10 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@stevenengler stevenengler merged commit 1806dcf into shadow:main Dec 8, 2022
@stevenengler stevenengler deleted the associate-args branch December 8, 2022 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Main Composing the core Shadow executable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants