Uh oh!
There was an error while loading. Please reload this page.
socket set_mark addition. - #96334
Conversation
rust-highfive
commented
Apr 23, 2022
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
rust-highfive
commented
Apr 23, 2022
r? @thomcc (rust-highfive has picked a reviewer for you, use r? to override) |
thomcc
commented
Apr 23, 2022
r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs |
dtolnay
left a comment
There was a problem hiding this comment.
This seems okay to me. Needs documentation and a tracking issue; I assume that's why the PR is still marked Draft.
devnexen
commented
Apr 27, 2022
Not only that but waited to see if the idea itself would get traction. ok will do these. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
d9b1a9e to
57024fbCompareJohnCSimon
commented
Jun 18, 2022
ping from triage: FYI: when a PR is ready for review, send a message containing |
devnexen
commented
Jun 18, 2022
@rustbot ready |
There was a problem hiding this comment.
It's not clear to me what useful information "and is only a setter" is meant to convey here. Can this sentence be just the following?—
Set the id of the socket for network filtering purposes.
There was a problem hiding this comment.
It's odd to see expect here in a function that returns io::Result anyway. How about returning the error?
| /// fn main() -> std::io::Result<()> { | |
| /// let sock = UnixDatagram::unbound()?; | |
| /// sock.set_mark(32 as u32).expect("set_mark function failed"); | |
| /// fn main() -> std::io::Result<()> { | |
| /// let sock = UnixDatagram::unbound()?; | |
| /// sock.set_mark(32 as u32)?; |
There was a problem hiding this comment.
Thanks for opening the tracking issue. You need to put the issue number here inside the issue attribute. Check out the other unstable attributes in this file.
Same applies to the other new unstable attribute below.
There was a problem hiding this comment.
32 as u32 is redundant. This can just be sock.set_mark(32) and the integer will be of type u32 automatically.
There was a problem hiding this comment.
The signature is identical across all of these platforms, and the implementation is nearly identical. How about deduplicating it this way?—
pubfnset_mark(&self,mark:u32) -> io::Result<()>{#[cfg(target_os = "linux")]let option = libc::SO_MARK;#[cfg(target_os = "linux")]let option = libc::SO_USER_COOKIE;#[cfg(target_os = "linux")]let option = libc::SO_RTABLE;setsockopt(self, libc::SOL_SOCKET, option, mark as libc::c_int)}or maybe this:
pubfnset_mark(&self,mark:u32) -> io::Result<()>{setsockopt(self,
libc::SOL_SOCKET,#[cfg(target_os = "linux")]
libc::SO_MARK,#[cfg(target_os = "freebsd")]
libc::SO_USER_COOKIE,#[cfg(target_os = "openbsd")]
libc::SO_RTABLE,
mark as libc::c_int,)}JohnCSimon
commented
Aug 13, 2022
Triage: FYI: when a PR is ready for review, send a message containing @rustbot ready |
dtolnay
commented
Aug 26, 2022
@bors r+ |
bors
commented
Aug 26, 2022
socket `set_mark` addition. to be able to set a marker/id on the socket for network filtering (iptables/ipfw here) purpose.
socket `set_mark` addition. to be able to set a marker/id on the socket for network filtering (iptables/ipfw here) purpose.
socket `set_mark` addition. to be able to set a marker/id on the socket for network filtering (iptables/ipfw here) purpose.
socket `set_mark` addition. to be able to set a marker/id on the socket for network filtering (iptables/ipfw here) purpose.
socket `set_mark` addition. to be able to set a marker/id on the socket for network filtering (iptables/ipfw here) purpose.
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#94890 (Support parsing IP addresses from a byte string) - rust-lang#96334 (socket `set_mark` addition.) - rust-lang#99027 (Replace `Body::basic_blocks()` with field access) - rust-lang#100437 (Improve const mismatch `FulfillmentError`) - rust-lang#100843 (Migrate part of rustc_infer to session diagnostic) - rust-lang#100897 (extra sanity check against consts pointing to mutable memory) - rust-lang#100959 (translations: rename warn_ to warning) - rust-lang#101111 (Use the declaration's SourceInfo for FnEntry retags, not the outermost) - rust-lang#101116 ([rustdoc] Remove Attrs type alias) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
to be able to set a marker/id on the socket for network filtering
(iptables/ipfw here) purpose.