Skip to content

Commit

Permalink
Document usage of IP_PKTINFO
Browse files Browse the repository at this point in the history
Ideally this would be documented in the nix package itself, but
documenting it here, will already help people.
  • Loading branch information
eskimor committed Sep 16, 2020
1 parent 44a3d55 commit d4e581f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ fn create_on_interfaces(
socket.set_reuse_address(true)?;
socket.set_reuse_port(true)?;

// Ipv4PacketInfo translates to `IP_PKTINFO`. Checkout the [ip
// manpage](https://man7.org/linux/man-pages/man7/ip.7.html) for more details. In summary
// setting this option allows for determining on which interface a packet was received.
sock::setsockopt(socket.as_raw_fd(), sock::sockopt::Ipv4PacketInfo, &true)
.map_err(nix_to_io_error)?;

Expand Down

0 comments on commit d4e581f

Please # to comment.