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

[inetstack] Fail to Close Bound and Unbound Sockets #517

Merged
merged 2 commits into from
Mar 8, 2023

Conversation

ppenna
Copy link
Contributor

@ppenna ppenna commented Mar 7, 2023

Description

Summary of Changes

  • Fixed close() to succeed when closing bound and unbound sockets
  • Fixed test code to use safe_close_active() to correctly close active sockets.

@ppenna ppenna added the bug Something Isn't Working label Mar 7, 2023
@ppenna ppenna requested a review from iyzhang March 7, 2023 14:40
@ppenna ppenna self-assigned this Mar 7, 2023
Copy link
Contributor

@iyzhang iyzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

let cause: String = format!("cannot close a socket that is closing (qd={:?})", qd);
error!("do_close(): {}", &cause);
return Err(Fail::new(libc::ENOTSUP, &cause));
},
}
},
_ => return Err(Fail::new(libc::EBADF, "bad queue descriptor")),
};
inner.addresses.remove(&SocketId::Passive(addr));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a TODO comment to remove active sockets from the addresses table when the close completes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@@ -459,7 +459,7 @@ fn tcp_bad_listen() {
Err(e) if e.errno == libc::EINVAL => (),
_ => panic!("invalid call to listen() should fail with EINVAL"),
};
safe_close_passive(&mut libos, sockqd);
safe_close_active(&mut libos, sockqd);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inside the safe_close_active function, the error still says passive socket.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@ppenna ppenna force-pushed the bugfix-inetstack-bind branch 2 times, most recently from 72f1872 to 8e1d719 Compare March 8, 2023 12:41
@ppenna ppenna merged commit f6c247f into dev Mar 8, 2023
@ppenna ppenna deleted the bugfix-inetstack-bind branch March 8, 2023 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something Isn't Working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[tests] Closing Active Sockets using safe_close_passive [inetstack] Fail to Close Bound and Unbound Sockets
2 participants