From Jean-Luc.Richier@imag.fr  Sun Aug 25 10:18:05 2002
Return-Path: <Jean-Luc.Richier@imag.fr>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3179037B400
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 25 Aug 2002 10:18:05 -0700 (PDT)
Received: from imag.imag.fr (imag.imag.fr [129.88.30.1])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 32F9D43E3B
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 25 Aug 2002 10:18:03 -0700 (PDT)
	(envelope-from Jean-Luc.Richier@imag.fr)
Received: from horus.imag.fr (horus.imag.fr [129.88.38.1])
	by imag.imag.fr (8.11.6/8.11.6) with ESMTP id g7PHI1v24468
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 25 Aug 2002 19:18:01 +0200 (MEST)
Received: (from richier@localhost)
	by horus.imag.fr (8.11.6/8.11.6/Imag.pm.V2) id g7PHI1s09466
	for FreeBSD-gnats-submit@freebsd.org; Sun, 25 Aug 2002 19:18:01 +0200 (MEST)
Received: from imag.imag.fr (imag.imag.fr [129.88.30.1])
	by horus.imag.fr (8.11.6/8.11.6/Imag.pm.V2) with ESMTP id g7PH81q09201
	for <richier@horus.imag.fr>; Sun, 25 Aug 2002 19:08:01 +0200 (MEST)
Received: from lagavulin.imag.fr (lagavulin.imag.fr [129.88.23.10])
	by imag.imag.fr (8.11.6/8.11.6) with ESMTP id g7PH80v24216
	for <Jean-Luc.Richier@imag.fr>; Sun, 25 Aug 2002 19:08:00 +0200 (MEST)
Received: from lagavulin.imag.fr (localhost [127.0.0.1])
	by lagavulin.imag.fr (8.12.5/8.12.5) with ESMTP id g7PH6j7B009258;
	Sun, 25 Aug 2002 19:06:45 +0200 (MEST)
	(envelope-from richier@horus.imag.fr)
Received: (from root@localhost)
	by lagavulin.imag.fr (8.12.5/8.12.5/Submit) id g7PH6iXC009257;
	Sun, 25 Aug 2002 19:06:44 +0200 (MEST)
	(envelope-from richier)
Message-Id: <200208251706.g7PH6iXC009257@lagavulin.imag.fr>
Date: Sun, 25 Aug 2002 19:06:44 +0200 (MEST)
From: Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
Reply-To: Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Jean-Luc.Richier@imag.fr
Subject: mount_nfs in UDP mode does not respect -c option and may fail
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         42003
>Category:       bin
>Synopsis:       mount_nfs in UDP mode does not respect -c option and may fail
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 25 10:20:01 PDT 2002
>Closed-Date:    Mon Aug 26 06:11:08 PDT 2002
>Last-Modified:  Mon Aug 26 06:11:08 PDT 2002
>Originator:     Jean-Luc Richier
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
LSR-IMAG, Grenoble, France
>Environment:
System: FreeBSD lagavulin.imag.fr 5.0-CURRENT FreeBSD 5.0-CURRENT #1: Thu Aug 22 09:43:42 MEST 2002 richier@lagavulin.imag.fr:/altroot1a/usr/obj/usr/src/sys/GENERIC i386

	
>Description:
	mount_nfs does not respect the NFSMNT_NOCONN mount option. Therefore
	in some case cases mount_nfs will fails to make a mount even tough the 
	kernel shoule accept accesses
>How-To-Repeat:
	Consider 2 machines, A with 2 interfaces and addresses A1 and A2,
	and B on the same cable as A1.
	If one does on B 'mount_nfs A2:/xxx /mnt', mount_nfs will not respond
	and do a time out, as mount_nfs wait for responses coming fro A1
	address.
	That is why there is a -c (NFSMNT_NOCONN) option, to accept answers
	coming from any address. However the NFSMNT_NOCONN is correctly treated
	in the kernel, but mount_nfs begins its code with a rpcping which does
	not respect the option. Therefore mount_nfs times out before the
	mount call .
>Fix:

	Test the NFSMNT_NOCONN option in the rpcping code and 
		`Use connect(), to match what the kernel does'
	only if this flag is off


--- sbin/mount_nfs/mount_nfs.c.1.53	Wed Aug  7 00:54:26 2002
+++ sbin/mount_nfs/mount_nfs.c	Sun Aug 25 18:23:09 2002
@@ -660,7 +660,8 @@
 		return (returncode(rpc_createerr.cf_stat,
 		    &rpc_createerr.cf_error));
 	}
-	if (nfsargsp->sotype == SOCK_DGRAM) {
+	if (nfsargsp->sotype == SOCK_DGRAM &&
+	    !(nfsargsp->flags & NFSMNT_NOCONN)) {
 		/*
 		 * Use connect(), to match what the kernel does. This
 		 * catches cases where the server responds from the

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: iedowse 
State-Changed-When: Mon Aug 26 06:08:34 PDT 2002 
State-Changed-Why:  

Committed, thanks! (I didn't know that the -c option existed when 
I changed mount_nfs to use connect(2)). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=42003 
>Unformatted:
