Change the name for the local unix-socket based protocol

from "unix" back to "local".  Add some compat stuff so both
ways work for some time.

Reviewed by:    phk
Approved by:    imp (UPDATING)
Requested by:   iedowse, lukem@netbsd.org
This commit is contained in:
Martin Blapp 2002-12-16 22:24:26 +00:00
parent 6f8a5ea200
commit fb4c80619a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107952
8 changed files with 51 additions and 14 deletions

View file

@ -17,6 +17,13 @@ NOTE TO PEOPLE WHO THINK THAT 5.0-CURRENT IS SLOW:
developers choose to disable these features on build machines
to maximize performance.
20021216:
A name change in /etc/netconfig has been reverted to stay
compatible with with suns TIRPC and also with NetBSD. You need
to run mergemaster after make world. A new libc does still work
with a outdated /etc/netconfig for some time, but you'll get
a warning. This warning will be removed in 20030301.
20021202:
The recent binutils upgrade marks a kernel flag day on
sparc64: modules built with the old binutils will not work

View file

@ -16,4 +16,4 @@ tcp6 tpi_cots_ord v inet6 tcp - -
udp tpi_clts v inet udp - -
tcp tpi_cots_ord v inet tcp - -
rawip tpi_raw - inet - - -
unix tpi_cots_ord - loopback - - -
local tpi_cots_ord - loopback - - -

View file

@ -418,6 +418,18 @@ getnetconfigent(netid)
return (NULL);
}
if (strcmp(netid, "unix") == 0) {
fprintf(stderr, "The local transport is called \"unix\" ");
fprintf(stderr, "in /etc/netconfig.\n");
fprintf(stderr, "Please change this to \"local\" manually ");
fprintf(stderr, "or run mergemaster(8).\n");
fprintf(stderr, "See UPDATING entry 20021216 for details.\n");
fprintf(stderr, "Continuing in 10 seconds\n\n");
fprintf(stderr, "This warning will be removed 20030301\n");
sleep(10);
}
/*
* Look up table if the entries have already been read and parsed in
* getnetconfig(), then copy this entry into a buffer and return it.

View file

@ -98,7 +98,7 @@ static const struct netid_af na_cvt[] = {
{ "udp6", AF_INET6, IPPROTO_UDP },
{ "tcp6", AF_INET6, IPPROTO_TCP },
#endif
{ "unix", AF_LOCAL, 0 }
{ "local", AF_LOCAL, 0 }
};
#if 0
@ -524,7 +524,9 @@ __rpc_nconf2sockinfo(const struct netconfig *nconf, struct __rpc_sockinfo *sip)
int i;
for (i = 0; i < (sizeof na_cvt) / (sizeof (struct netid_af)); i++)
if (!strcmp(na_cvt[i].netid, nconf->nc_netid)) {
if (strcmp(na_cvt[i].netid, nconf->nc_netid) == 0 || (
strcmp(nconf->nc_netid, "unix") == 0 &&
strcmp(na_cvt[i].netid, "local") == 0)) {
sip->si_af = na_cvt[i].af;
sip->si_proto = na_cvt[i].protocol;
sip->si_socktype =
@ -554,13 +556,20 @@ __rpc_sockinfo2netid(struct __rpc_sockinfo *sip, const char **netid)
{
int i;
for (i = 0; i < (sizeof na_cvt) / (sizeof (struct netid_af)); i++)
for (i = 0; i < (sizeof na_cvt) / (sizeof (struct netid_af)); i++) {
if (na_cvt[i].af == sip->si_af &&
na_cvt[i].protocol == sip->si_proto) {
if (netid)
*netid = na_cvt[i].netid;
if (strcmp(na_cvt[i].netid, "local") == 0 &&
getnetconfigent("local") == NULL) {
if (netid)
*netid = "unix";
} else {
if (netid)
*netid = na_cvt[i].netid;
}
return 1;
}
}
return 0;
}

View file

@ -154,7 +154,9 @@ yppasswd_local(ypclnt_t *ypclnt, const struct passwd *pwd, const char *passwd)
}
/* connect to rpc.yppasswdd */
nc = getnetconfigent("unix");
nc = getnetconfigent("local");
if (nc == NULL)
nc = getnetconfigent("unix");
clnt = clnt_tp_create(ypclnt->server, YPPASSWDPROG, YPPASSWDVERS, nc);
if (clnt == NULL) {
ypclnt_error(ypclnt, __func__,

View file

@ -545,7 +545,7 @@ pmapdump(int argc, char **argv)
else if (head->pml_map.pm_prot == IPPROTO_TCP)
printf("%6s", "tcp");
else if (head->pml_map.pm_prot == IPPROTO_ST)
printf("%6s", "unix");
printf("%6s", "local");
else
printf("%6ld", head->pml_map.pm_prot);
printf("%7ld", head->pml_map.pm_port);

View file

@ -158,7 +158,9 @@ main(int argc, char *argv[])
tcptrans = "";
#endif
nconf = getnetconfigent("unix");
nconf = getnetconfigent("local");
if (nconf == NULL)
nconf = getnetconfigent("unix");
if (nconf == NULL) {
syslog(LOG_ERR, "%s: can't find local transport\n", argv[0]);
exit(1);
@ -279,7 +281,8 @@ init_transport(struct netconfig *nconf)
return (1);
}
if (!strcmp(nconf->nc_netid, "unix")) {
if ((strcmp(nconf->nc_netid, "local") == 0) ||
(strcmp(nconf->nc_netid, "unix") == 0)) {
memset(&sun, 0, sizeof sun);
sun.sun_family = AF_LOCAL;
unlink(_PATH_RPCBINDSOCK);
@ -438,7 +441,8 @@ init_transport(struct netconfig *nconf)
if (!checkbind)
return 1;
} else {
if (strcmp(nconf->nc_netid, "unix") != 0) {
if ((strcmp(nconf->nc_netid, "local") != 0) &&
(strcmp(nconf->nc_netid, "unix") != 0)) {
if ((aicode = getaddrinfo(NULL, servname, &hints, &res))
!= 0) {
syslog(LOG_ERR,
@ -502,7 +506,8 @@ init_transport(struct netconfig *nconf)
if ((strcmp(nconf->nc_protofmly, NC_INET) == 0 &&
(strcmp(nconf->nc_proto, NC_TCP) == 0 ||
strcmp(nconf->nc_proto, NC_UDP) == 0)) ||
strcmp(nconf->nc_netid, "unix") == 0) {
(strcmp(nconf->nc_netid, "unix") == 0) ||
(strcmp(nconf->nc_netid, "local") == 0)) {
struct pmaplist *pml;
if (!svc_register(my_xprt, PMAPPROG, PMAPVERS,
@ -543,7 +548,9 @@ init_transport(struct netconfig *nconf)
/* Let's snarf the universal address */
/* "h1.h2.h3.h4.p1.p2" */
udp_uaddr = taddr2uaddr(nconf, &taddr.addr);
} else if (strcmp(nconf->nc_netid, "unix") == 0)
} else if (strcmp(nconf->nc_netid, "local") == 0)
pml->pml_map.pm_prot = IPPROTO_ST;
else if (strcmp(nconf->nc_netid, "unix") == 0)
pml->pml_map.pm_prot = IPPROTO_ST;
pml->pml_next = list_pml;
list_pml = pml;

View file

@ -214,7 +214,7 @@ logit(int severity, struct sockaddr *addr, rpcproc_t procnum, rpcprog_t prognum,
/* Write syslog record. */
if (addr->sa_family == AF_LOCAL)
strcpy(fromname, "unix");
strcpy(fromname, "local");
else
getnameinfo(addr, addr->sa_len, fromname,
sizeof fromname, NULL, 0, NI_NUMERICHOST);