Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/rpcbind Move routines which fill in tbuf in addrmer...
details: https://anonhg.NetBSD.org/src/rev/bebd536471dc
branches: trunk
changeset: 501995:bebd536471dc
user: jmc <jmc%NetBSD.org@localhost>
date: Wed Jan 10 05:23:43 2001 +0000
description:
Move routines which fill in tbuf in addrmerge(). The fixes in 1.4 pick a new
interface but don't fill in tbuf which results in clients getting garbage back
in part of the answer. This makes sure there's something in tbuf.
At some point this whole logic should be looked at, as just picking a random
local up interface for non-local requests doesn't feel right.
diffstat:
usr.sbin/rpcbind/util.c | 39 ++++++++++++++++++++++-----------------
1 files changed, 22 insertions(+), 17 deletions(-)
diffs (72 lines):
diff -r dc28b669a936 -r bebd536471dc usr.sbin/rpcbind/util.c
--- a/usr.sbin/rpcbind/util.c Wed Jan 10 04:47:10 2001 +0000
+++ b/usr.sbin/rpcbind/util.c Wed Jan 10 05:23:43 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: util.c,v 1.4 2000/08/03 00:04:30 fvdl Exp $ */
+/* $NetBSD: util.c,v 1.5 2001/01/10 05:23:43 jmc Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -183,15 +183,6 @@
ifsin = (struct sockaddr_in *)ifap->ifa_addr;
if (!bitmaskcmp(&ifsin->sin_addr, &clntsin->sin_addr,
&sinmask->sin_addr, sizeof (struct in_addr))) {
- /*
- * Found it.
- */
- memcpy(newsin, ifap->ifa_addr,
- clnt_sa->sa_len);
- newsin->sin_port = servsin->sin_port;
- tbuf.len = clnt_sa->sa_len;
- tbuf.maxlen = sizeof (struct sockaddr_storage);
- tbuf.buf = newsin;
goto found;
}
break;
@@ -224,18 +215,12 @@
if (ifsin6->sin6_scope_id !=
realsin6->sin6_scope_id)
continue;
-match:
- memcpy(newsin6, ifsin6, clnt_sa->sa_len);
- newsin6->sin6_port = servsin6->sin6_port;
- tbuf.maxlen = sizeof (struct sockaddr_storage);
- tbuf.len = clnt_sa->sa_len;
- tbuf.buf = newsin6;
goto found;
}
if (!bitmaskcmp(&ifsin6->sin6_addr,
&clntsin6->sin6_addr, &sin6mask->sin6_addr,
sizeof (struct in6_addr)))
- goto match;
+ goto found;
break;
#endif
default:
@@ -265,6 +250,26 @@
}
ifap = bestif;
found:
+ switch (clnt->sa_family) {
+ case AF_INET:
+ memcpy(newsin, ifap->ifa_addr, clnt_sa->sa_len);
+ newsin->sin_port = servsin->sin_port;
+ tbuf.len = clnt_sa->sa_len;
+ tbuf.maxlen = sizeof (struct sockaddr_storage);
+ tbuf.buf = newsin;
+ break;
+#ifdef INET6
+ case AF_INET6:
+ memcpy(newsin6, ifsin6, clnt_sa->sa_len);
+ newsin6->sin6_port = servsin6->sin6_port;
+ tbuf.maxlen = sizeof (struct sockaddr_storage);
+ tbuf.len = clnt_sa->sa_len;
+ tbuf.buf = newsin6;
+ break;
+#endif
+ default:
+ goto freeit;
+ }
if (ifap != NULL)
ret = taddr2uaddr(nconf, &tbuf);
freeit:
Home |
Main Index |
Thread Index |
Old Index