*BSD News Article 49874


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!pravda.aa.msen.com!spool.mu.edu!howland.reston.ans.net!sol.ctr.columbia.edu!startide.ctr.columbia.edu!wpaul
From: wpaul@ctr.columbia.edu (Bill Paul)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: FreeBSD, AMD and Suns
Date: 31 Aug 1995 18:58:35 GMT
Organization: Columbia University Center for Telecommunications Research
Lines: 112
Message-ID: <4250os$oio@sol.ctr.columbia.edu>
References: <GILHAM.95Aug30135200@lily.csl.sri.com>
NNTP-Posting-Host: startide.ctr.columbia.edu
X-Newsreader: TIN [version 1.2 PL2]

Daring to challenge the will of the almighty Leviam00se,
Fred Gilham (gilham@lily.csl.sri.com) had the courage to say:

: Hello,

: I've found a problem trying to set up a FreeBSD box to work among a
: set of Sun file servers and workstations.  The problem is that I don't
: know how to tell AMD to use a reserved port when it tries to talk to
: the Sun file servers.

Been there. Done that. Committed the fix (a _long_ time ago).

: This is a killer for me.  If I can't do automounting, I'll probably
: have to kiss FreeBSD goodbye.

Not so fast, monkey boy! All you need to do it show a little more
determination. This stuff isn't all that opaque.

Now then, let's review. The way you're supposed to mount NFS filesystems
is like this:

# mount -o resvport hostname:/filesystem /local/mount/point

Don't use mount_nfs directly. The top-level mount command is there
for a reason. Don't ignore it.

Now then class, what is resvport? Yes, that's right: it's a mount option.
And we all know how to specify default mount options in AMD maps, right
class?

Right?

Right?

Beuller?

Oh dear.

Alright, here's a map I use on my system:

[/homes/manager/CTR/dump/bin]:sirius{439}# ypcat -k amd.home
/defaults opts:=rw,nosuid,intr,resvport;type:=nfs
startide -rhost:=${key} host!=${key} host==${key};type:=link
procyon2 -rhost:=procyon host!=procyon host==procyon;type:=link
procyon -rhost:=${key} host!=${key} host==${key};type:=link
picasso -rhost:=${key} host!=${key} host==${key};type:=link
renoir -rhost:=${key} host!=${key} host==${key};type:=link
disney -rhost:=${key} host!=${key} host==${key};type:=link
bugle -rhost:=${key} host!=${key} host==${key};type:=link
sol -rhost:=${key} host!=${key} host==${key};type:=link
procyon3 -rhost:=procyon host!=procyon host==procyon;type:=link
polaris -rhost:=${key} host!=${key} host==${key};type:=link
cezanne -rhost:=${key} host!=${key} host==${key};type:=link
taurus -rhost:=${key};rfs:=/homes host!=${key} host==${key};type:=link
sirius -rhost:=${key} host!=${key} host==${key};type:=link
helios -rhost:=elara host!=elara host==elara;type:=link
elara -rhost:=${key} host!=${key} host==${key};type:=link
goya -rhost:=${key} host!=${key} host==${key};type:=link

Notice the /defaults line way up at the top? That 'resvport' keyword
nestled in among the mount options list will tell FreeBSD's amd to
specify the NFSMNT_RESVPORT flag when doing NFS mounts. Other systems
that don't recognize the resvport flag will simply ignore it. With
this default in place, I have no trouble using FreeBSD's amd with
a whole gaggle of systems, including Suns, SGIs, HPs and even a few
crufty old m68k Sony NEWS boxes.

: I'd appreciate any help here, or any pointers.  I.e. can I configure a
: kernel that will always use a reserved port for NFS?  I glanced over
: the config file and kernel source but couldn't find anything (I'm not
: experienced with the kernel source so that doesn't mean too much,
: though).

It might not be a bad idea to add an #ifdef somewhere that tells
the nfs mount code to reverse the meaning of the NFSMNT_RESVPORT bit 
so that it's on by default and specifying resvport would turn it off,
instead of the other way around. It should be pretty simple to fix
it so that you could toggle the behavior with sysctl too (or gdb,
for those who like to do things the hard way :). Still, I'm not convinced
that you really need kernel hackery since it's not that hard to
just specify the option when mounting.

Be advised that amd distributions other than the one packaged with
FreeBSD do not have support for the resvport flag. It is trivial to
hack the support in, however. Yo do it, you need to add the following
lines to nfs_ops.c:

#ifdef NFSMNT_RESVPORT
        if (hasmntopt(&mnt, "resvport") != NULL)
                nfs_args.flags |= NFSMNT_RESVPORT;
#endif

As for where to add it, check the FreeBSD version to give you some idea.
You may see similar conditionally compiled options for NFSMNT_BIODS
or NFSMNT_MAXGRPS. Adding the resvport code anywhere in that general
area is fine.

I was a bit surprised to find that 4.4BSD supported the NFSMNT_RESVPORT
flag but that the automounter didn't know anything about it. Some things
just fall through the cracks, I guess.


-Bill

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~T~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Bill Paul            (212) 854-6020 | System Manager
Work:         wpaul@ctr.columbia.edu | Center for Telecommunications Research
Home:  wpaul@skynet.ctr.columbia.edu | Columbia University, New York City
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Møøse Illuminati: ignore it and be confused, or join it and be confusing!
~~~~~~ "Welcome to All Things BSDish! If it's not BSDish, it's crap!" ~~~~~~~