Page MenuHomeFreeBSD

Provide IP_ORIGDSTADDR socket option
ClosedPublic

Authored by eri on Jan 18 2017, 9:54 PM.

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
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

eri updated this revision to Diff 24171.Jan 18 2017, 9:54 PM
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.
eri added a subscriber: network.
adrian added a subscriber: adrian.Jan 19 2017, 12:48 AM
adrian added inline comments.
sys/netinet6/ip6_output.c
1853 ↗(On Diff #24171)

This should be using OPTBIT or OPTBIT2 as appropriate.

eri updated this revision to Diff 24180.EditedJan 19 2017, 4:50 AM
eri edited edge metadata.

Updated as per comments.

eri updated this revision to Diff 24183.Jan 19 2017, 5:08 AM
eri edited edge metadata.

Update patch to include context as well.

eri added a reviewer: gnn.Feb 5 2017, 9:07 PM
eri added a comment.Feb 9 2017, 6:31 AM

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

adrian accepted this revision.Feb 9 2017, 6:34 AM
adrian added a reviewer: adrian.

ok by me

gnn added inline comments.Feb 11 2017, 9:55 PM
sys/netinet/udp_usrreq.c
373 ↗(On Diff #24183)

Please add extra parens here to make the grouping clear.

420 ↗(On Diff #24183)

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

glebius added inline comments.
sys/netinet/udp_usrreq.c
469 ↗(On Diff #24183)

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 added a reviewer: ae.Feb 14 2017, 1:23 AM
eri updated this revision to Diff 25133.Feb 14 2017, 3:44 AM
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.

ae edited edge metadata.Feb 18 2017, 11:51 AM

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) ?

ae added inline comments.Feb 18 2017, 11:56 AM
sys/netinet6/udp6_usrreq.c
178 ↗(On Diff #25133)

I think there should be IPV6_ORIGDSTADDR.

eri updated this revision to Diff 25451.Feb 20 2017, 11:41 PM
eri edited edge metadata.

Update considering comments.

eri marked an inline comment as done.Feb 20 2017, 11:42 PM
eri updated this revision to Diff 25453.Feb 21 2017, 12:02 AM
eri edited edge metadata.
eri changed the repository for this revision from rS FreeBSD src repository to rP FreeBSD ports repository.

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

ae accepted this revision.Feb 24 2017, 7:04 AM
ae edited edge metadata.
This revision is now accepted and ready to land.Feb 24 2017, 7:04 AM
This revision was automatically updated to reflect the committed changes.