NetBSD Problem Report #469

From gnats  Thu Sep  8 14:51:45 1994
Received: from python.CS.ORST.EDU (root@python.CS.ORST.EDU [128.193.164.60]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id OAA01185 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Thu, 8 Sep 1994 14:51:44 -0700
Message-Id: <199409081838.LAA15515@helix.CS.ORST.EDU>
Date: Thu, 8 Sep 1994 11:38:15 -0700
From: "Jason R. Thorpe" <thorpej@mail.cs.orst.edu>
Reply-To: thorpej@mail.cs.orst.edu
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: mountd cannot grok duplicate hosts in exports list
X-Send-Pr-Version: 3.2

>Number:         469
>Category:       bin
>Synopsis:       mountd cannot grok duplicate hosts in exports list
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 08 15:05:08 +0000 1994
>Closed-Date:    Sun Jul 20 23:33:16 +0000 1997
>Last-Modified:  Sun Jul 20 23:44:50 +0000 1997
>Originator:     Jason R. Thorpe
>Release:        NetBSD 1.0_BETA (sup'd ~9.4.94)
>Organization:
	Department of Computer Science
	Oregon State University
>Environment:

System: NetBSD helix 1.0_BETA NetBSD 1.0_BETA (HELIX) #15: Tue Sep 6 14:54:16 PDT 1994 thorpej@helix:/usr/src/sys/arch/hp300/compile/HELIX hp300


>Description:
	If, in /etc/exports, there is a duplicate hostname (or duplicate ip
	resolved from a hostname), the the entire export of that filesystem
	fails.  This will probably bite most people when exporting to 
	netgroups, especially if each netgroup has two entries for each host
	in the netgroup (to work around a bug in a *really* old NFS
	implementation).  However, it will also bite people if a filesystem
	is exported to a netgroup that is a partial subset of another
	netgroup that the filesystem is also exported to.
>How-To-Repeat:
	In my case:

	(output from mountd compiled with -DDEBUG)
	helix# obj.hp300/mountd
	Getting export list.
	Got line /usr/src               -maproot=root INST-HPS
	Making new ep fs=0x42f,0x6bb
	doing opt -maproot=root INST-HPS
	got host lespaul.CS.ORST.EDU
	got host gibson.CS.ORST.EDU
	got host strat.CS.ORST.EDU
	got host fender.CS.ORST.EDU
	got host typhoon.CS.ORST.EDU
	got host santiam.CS.ORST.EDU
	got host prism.CS.ORST.EDU
	got host helix.CS.ORST.EDU
	got host xanth.CS.ORST.EDU
	Getting mount list.
	Here we go.

	...all is ok here...but...

	helix# obj.hp300/mountd
	Getting export list.
	Got line /usr/src               -maproot=root INST-HPS NETBSD
	Making new ep fs=0x42f,0x6bb
	doing opt -maproot=root INST-HPS NETBSD
	got host lespaul.CS.ORST.EDU
	got host gibson.CS.ORST.EDU
	got host strat.CS.ORST.EDU
	got host fender.CS.ORST.EDU
	got host typhoon.CS.ORST.EDU
	got host santiam.CS.ORST.EDU
	got host prism.CS.ORST.EDU
	got host helix.CS.ORST.EDU
	got host xanth.CS.ORST.EDU
	got host helix.CS.ORST.EDU
	got host santiam.CS.ORST.EDU
	got host facelift.CS.ORST.EDU
	Can't change attributes for /usr/src.
	Bad exports list line /usr/src          -maprootGetting mount list.
	Here we go.

	...notice that helix.CS.ORST.EDU and santiam.CS.ORST.EDU are
	duplicates.  Also notice that whis makes the export of the 
	entire filesystem fail.

	The same also happens if a machine as two names (that both appear in
	a netgroup) that resolve to the same IP.  In my case, a machine called
	viper (which has two network interfaces) has three names:
		viper.cs.orst.edu
		viper32.cs.orst.edu
		viper164.cs.orst.edu
	viper.cs.orst.edu resolves to the same ip as viper32.cs.orst.edu.
	If both viper and viper32 are in the netgroup (INST-SUNS), then
	the export will fail.
>Fix:
	Perhaps the easiest (and a fairly fast way) to fix the problem would
	be to build a hash table (in memory or on disk - tmp file) of
	IPs that the filesystem is being exported to.  So, everytime
	a host was to be added to the list, a hash lookup could be done
	on the ip that the name resolves to.  If you get a hit, simply
	ignore the ip/name and continue.

	Another (and perhaps more expensive but maybe more correct) way
	would be to look for the ip in the kernel's mount list.  Again, skip
	the ip if it's found.

	Once again, I haven't had enough coffee to come up with any code
	at this time. But I've got it brewing...


	The problem here is a little strange.  Basically, mountd(8) causes
	the kernel to execute vfs_hang_addrlist().  This calls rn_addroute()
	to add radix nodes for each IP address.  If an existing entry is
	found, rn_addroute() returns a NULL pointer, indicating that.  When
	this happens, vfs_hang_addrlist() returns EPERM.  It would make
	more sense for it to check the existing node, and if it's the same,
	return 0.  I have a potential fix that does this, but I'm awaiting
	comments from other parties.  - mycroft

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: mycroft 
State-Changed-When: Sun Sep 18 15:04:03 PDT 1994 
State-Changed-Why:  
I've investigated the problem. 
State-Changed-From-To: analyzed->closed 
State-Changed-By: fvdl 
State-Changed-When: Sun Jul 20 16:33:16 PDT 1997 
State-Changed-Why:  
Fixed by allowing duplicate exports in the kernel iff they're the same. 
After 3 years of hard debugging. Really! 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.