Page MenuHomeFreeBSD

"source routing" in rpcbind
ClosedPublic

Authored by asomers on Dec 22 2015, 10:39 PM.
Tags
None
Referenced Files
F83989358: D4690.diff
Fri, May 17, 9:21 PM
Unknown Object (File)
Thu, May 2, 7:48 AM
Unknown Object (File)
Fri, Apr 26, 8:53 PM
Unknown Object (File)
Fri, Apr 26, 8:30 PM
Unknown Object (File)
Mar 7 2024, 2:51 PM
Unknown Object (File)
Feb 2 2024, 4:07 AM
Unknown Object (File)
Jan 15 2024, 8:58 PM
Unknown Object (File)
Dec 20 2023, 3:39 AM
Subscribers
None

Details

Summary

Fix a bug in rpcbind for multihomed hosts. If the server had interfaces on
two separate subnets, and a client on the first subnet contacted rpcbind at
the address on the second subnet, rpcbind would advertise addresses on the
first subnet. This is a bug, because it should prefer to advertise the
address where it was contacted. The requested service might be firewalled
off from the address on the first subnet, for example.

usr.sbin/rpcbind/check_bound.c
If the address on which a request was received is known, pass that
to addrmerge as the clnt_uaddr parameter. That is what addrmerge's
comment indicates the parameter is supposed to mean. The previous
behavior is that clnt_uaddr would contain the address from which the
client sent the request.

usr.sbin/rpcbind/util.c
Modify addrmerge to prefer to use an IP that is equal to clnt_uaddr,
if one is found. Refactor the relevant portion of the function for
clarity, and to reduce the number of ifdefs.

usr.sbin/rpcbind/tests/Makefile
Don't define INET6. That statement was intended for
debugging only and should not have been committed in the
last revision.

etc/mtree/BSD.tests.dist
usr.sbin/rpcbind/tests/Makefile
usr.sbin/rpcbind/tests/addrmerge_test.c
Add unit tests for usr.sbin/rpcbind/util.c:addrmerge.

usr.sbin/rpcbind/check_bound.c
usr.sbin/rpcbind/rpcbind.h
usr.sbin/rpcbind/util.c
Constify some function arguments

Test Plan

Export an nfs share from a server with network interfaces on two separate
subnets. Start statd and lockd too. On the client, mount the share using
the server's second address. Then run "lockf /mnt/whatever sleep 500". In
a separate terminal, use tcpdump to verify that the lockd traffic uses the
server's second address, instead of the first one.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 1796
Build 1802: arc lint + arc unit

Event Timeline

asomers retitled this revision from to "source routing" in rpcbind.
asomers updated this object.
asomers edited the test plan for this revision. (Show Details)
asomers added a reviewer: imp.

Warner, have you had a chance to review this change yet? This is something we discussed back in May 2014, btw.

imp edited edge metadata.

This looks good to me. The ipv6 stuff is a bit outside the data I keep in my brain,
but the sorts of tests look like the right ones.

This revision is now accepted and ready to land.Jan 5 2016, 11:50 PM
This revision was automatically updated to reflect the committed changes.