From owner-freebsd-current Wed Jan 5 0:47:38 2000 Delivered-To: freebsd-current@freebsd.org Received: from poboxer.pobox.com (ferg5200-1-11.cpinternet.com [208.149.16.11]) by hub.freebsd.org (Postfix) with ESMTP id BC7D614A27 for ; Wed, 5 Jan 2000 00:47:26 -0800 (PST) (envelope-from alk@poboxer.pobox.com) Received: (from alk@localhost) by poboxer.pobox.com (8.9.3/8.9.1) id CAA00481; Wed, 5 Jan 2000 02:43:24 -0600 (CST) (envelope-from alk) From: Anthony Kimball MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 5 Jan 2000 02:43:24 -0600 (CST) X-Face: \h9Jg:Cuivl4S*UP-)gO.6O=T]]@ncM*tn4zG);)lk#4|lqEx=*talx?.Gk,dMQU2)ptPC17cpBzm(l'M|H8BUF1&]dDCxZ.c~Wy6-j,^V1E(NtX$FpkkdnJixsJHE95JlhO 5\M3jh'YiO7KPCn0~W`Ro44_TB@&JuuqRqgPL'0/{):7rU-%.*@/>q?1&Ed Reply-To: alk@pobox.com To: current@freebsd.org Subject: portmap problems X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs Lucid Message-ID: <14451.257.54511.497159@avalon.east> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Recently I've noticed that it takes a long time for portmap to settle well enough so that mountd and nfsd can register. Jan 5 02:16:56 avalon mountd[97]: can't register mount Jan 5 02:16:56 avalon nfsd:[99]: can't register with udp portmap Very strange. Strange enough so that perhaps it might catch someone else's interest. Someone who might actually do something about it, maybe even. portmap was pid 92 this time. Killing and restarting mountd and nfsd works: % rpcinfo -p program vers proto port 100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper 100005 3 udp 1011 mountd 100005 3 tcp 1020 mountd 100005 1 udp 1011 mountd 100005 1 tcp 1020 mountd 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs Which suggests to me -- perhaps portmap and mountd should be allowed to take a -u argument as well, to reduce port consumption? If so, I imagine the patch would be something like this: diff -u sbin/mountd/mountd.c.orig sbin/mountd/mountd.c.new --- sbin/mountd/mountd.c.orig Wed Jan 5 02:36:27 2000 +++ sbin/mountd/mountd.c.new Wed Jan 5 02:38:22 2000 @@ -229,6 +229,8 @@ int debug = 0; #endif +int udponly = 0; + /* * Mountd server for NFS mount protocol as described in: * NFS: Network File System Protocol Specification, RFC1094, Appendix A @@ -255,7 +257,7 @@ if (error) errx(1, "NFS support is not available in the running kernel"); - while ((c = getopt(argc, argv, "2dlnr")) != -1) + while ((c = getopt(argc, argv, "2dlnru")) != -1) switch (c) { case '2': force_v2 = 1; @@ -272,6 +274,9 @@ case 'l': log = 1; break; + case 'u': + udponly = 1; + break; default: usage(); }; @@ -317,7 +322,7 @@ } } if ((udptransp = svcudp_create(RPC_ANYSOCK)) == NULL || - (tcptransp = svctcp_create(RPC_ANYSOCK, 0, 0)) == NULL) { + (!udponly && (tcptransp = svctcp_create(RPC_ANYSOCK, 0, 0)) == NULL)) { syslog(LOG_ERR, "can't create socket"); exit(1); } @@ -325,12 +330,12 @@ pmap_unset(RPCPROG_MNT, 3); if (!force_v2) if (!svc_register(udptransp, RPCPROG_MNT, 3, mntsrv, IPPROTO_UDP) || - !svc_register(tcptransp, RPCPROG_MNT, 3, mntsrv, IPPROTO_TCP)) { + (!udponly && !svc_register(tcptransp, RPCPROG_MNT, 3, mntsrv, IPPROTO_TCP))) { syslog(LOG_ERR, "can't register mount"); exit(1); } if (!svc_register(udptransp, RPCPROG_MNT, 1, mntsrv, IPPROTO_UDP) || - !svc_register(tcptransp, RPCPROG_MNT, 1, mntsrv, IPPROTO_TCP)) { + (!udponly && !svc_register(tcptransp, RPCPROG_MNT, 1, mntsrv, IPPROTO_TCP))) { syslog(LOG_ERR, "can't register mount"); exit(1); } diff -u usr.sbin/portmap/portmap.c.orig usr.sbin/portmap/portmap.c.new --- usr.sbin/portmap/portmap.c.orig Wed Jan 5 02:33:53 2000 +++ usr.sbin/portmap/portmap.c.new Wed Jan 5 02:36:03 2000 @@ -109,6 +109,7 @@ struct pmaplist *pmaplist; int debugging = 0; +int udponly = 0; int main(argc, argv) @@ -121,7 +122,7 @@ int len = sizeof(struct sockaddr_in); register struct pmaplist *pml; - while ((c = getopt(argc, argv, "dv")) != -1) { + while ((c = getopt(argc, argv, "duv")) != -1) { switch (c) { case 'd': @@ -132,6 +133,10 @@ verboselog = 1; break; + case 'u': + udponly = 1; + break; + default: usage(); } @@ -169,29 +174,32 @@ pml->pml_map.pm_port = PMAPPORT; pmaplist = pml; - if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { + if (!udponly) { + + if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { syslog(LOG_ERR, "cannot create tcp socket: %m"); exit(1); - } - if (bind(sock, (struct sockaddr *)&addr, len) != 0) { + } + if (bind(sock, (struct sockaddr *)&addr, len) != 0) { syslog(LOG_ERR, "cannot bind tcp: %m"); exit(1); - } - if ((xprt = svctcp_create(sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE)) - == (SVCXPRT *)NULL) { + } + if ((xprt = svctcp_create(sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE)) + == (SVCXPRT *)NULL) { syslog(LOG_ERR, "couldn't do tcp_create"); exit(1); + } + /* make an entry for ourself */ + pml = (struct pmaplist *)malloc((u_int)sizeof(struct pmaplist)); + pml->pml_map.pm_prog = PMAPPROG; + pml->pml_map.pm_vers = PMAPVERS; + pml->pml_map.pm_prot = IPPROTO_TCP; + pml->pml_map.pm_port = PMAPPORT; + pml->pml_next = pmaplist; + pmaplist = pml; + + (void)svc_register(xprt, PMAPPROG, PMAPVERS, reg_service, FALSE); } - /* make an entry for ourself */ - pml = (struct pmaplist *)malloc((u_int)sizeof(struct pmaplist)); - pml->pml_map.pm_prog = PMAPPROG; - pml->pml_map.pm_vers = PMAPVERS; - pml->pml_map.pm_prot = IPPROTO_TCP; - pml->pml_map.pm_port = PMAPPORT; - pml->pml_next = pmaplist; - pmaplist = pml; - - (void)svc_register(xprt, PMAPPROG, PMAPVERS, reg_service, FALSE); /* additional initializations */ check_startup(); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message