Skip to content

Commit

Permalink
Merge pull request #9 from eskimor/rk-document-IpvPacketInfo
Browse files Browse the repository at this point in the history
Document usage of IP_PKTINFO
  • Loading branch information
bltavares authored Sep 16, 2020
2 parents 44a3d55 + d4e581f commit 42893cd
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 42893cd

Please sign in to comment.