Page MenuHomeFreeBSD

Provide IP_ORIGDSTADDR socket option
ClosedPublic

Authored by eri on Jan 18 2017, 9:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 2, 1:14 AM
Unknown Object (File)
Feb 10 2024, 8:23 PM
Unknown Object (File)
Jan 26 2024, 12:09 AM
Unknown Object (File)
Jan 25 2024, 3:15 PM
Unknown Object (File)
Jan 24 2024, 4:13 PM
Unknown Object (File)
Jan 22 2024, 4:55 PM
Unknown Object (File)
Jan 13 2024, 5:19 PM
Unknown Object (File)
Dec 25 2023, 4:04 AM

Details

Summary

The patch provides the same socket option as Linux IP_ORIGDSTADDR.
Unfortunately they will have different integer value due to Linux value being already assigned in FreeBSD.

The patch is similar to IP_RECVDSTADDR but also provides the destination port value to the application.

This allows/improves implementation of transparent proxies on UDP sockets due to having the whole information on forwarded packets.

Sponsored-by: rsync.net

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 6875

Event Timeline

eri retitled this revision from to Provide IP_ORIGDSTADDR socket option.
eri updated this object.
eri edited the test plan for this revision. (Show Details)
eri added a reviewer: network.
eri set the repository for this revision to rS FreeBSD src repository - subversion.
eri added a subscriber: network.
adrian added inline comments.
sys/netinet6/ip6_output.c
1853

This should be using OPTBIT or OPTBIT2 as appropriate.

eri edited edge metadata.

Updated as per comments.

eri edited edge metadata.

Update patch to include context as well.

Just looking for an OK here this is not rocket science!

sys/netinet/udp_usrreq.c
373

Please add extra parens here to make the grouping clear.

420

Please revert the name to udp_in so it matches the old code.

glebius added inline comments.
sys/netinet/udp_usrreq.c
469

Why not bzero both sockaddrs in one operation? Why the bzero is needed here at all? All important members of sockaddr_in are initialized.

eri edited edge metadata.

Update diff to include all remarks

eri marked 2 inline comments as done.Feb 14 2017, 3:47 AM
eri marked an inline comment as done.

Completed review tasks.

In general I'm agree with this patch, but the documentation is missing :)
Can you document added options in the corresponding man pages ip(4) and ip6(4) ?

sys/netinet6/udp6_usrreq.c
179

I think there should be IPV6_ORIGDSTADDR.

eri edited edge metadata.

Update considering comments.

eri marked an inline comment as done.Feb 20 2017, 11:42 PM
eri edited edge metadata.
eri changed the repository for this revision from rS FreeBSD src repository - subversion to rP FreeBSD ports repository.

Include documentation (man pages) though someone should give a review to those changes.

ae edited edge metadata.
This revision is now accepted and ready to land.Feb 24 2017, 7:04 AM