Re: [List] Re: [nfsd_server_flags="-h ipaddress" has no effect]

From: Frank Leonhardt <freebsd-doc_at_fjl.co.uk>
Date: Mon, 01 Sep 2025 14:35:00 UTC
On 01/09/2025 14:02, void wrote:
> On Sun, Aug 31, 2025 at 07:45:13PM +0100, Frank Leonhardt wrote:
>>
>> Also opps - I replied to freebsd-questions :-)
>
> :D
>
>> No, indeed I would not. It's not what the source code says to do, but 
>> it does silently ignore the bind addresses list it's created if the 
>> -a flag has been used. if it hits a -a flag. If the count of things 
>> added to the list is zero it binds to everything regardless.
>
> thanks for confirming
>
>> Are you sure you set the server flags correctly in rc.conf and 
>> they're the ones being used?
>>
>> nfs_server_enable="YES"
>> nfs_server_flags="-t -n 4 -h 192.168.1.2"
>> (-t and -n 4 being a reasonable choice).
>
> When initially testing it was without flags, so I'm presuming it was 
> running with defaults, which on here are
>
> % cat /etc/defaults/rc.conf | ug nfs_server_flags
>
> 383:  nfs_server_flags="-u -t"  # Flags to nfsd (if enabled)
>
>> IIRC there's a problem binding to an interface if you're using UDP.
>
> That's interesting. That led to a little experiment where I suspected
> setting the flags in /etc/rc.conf was not clearing the default flags in
> the /etc/defaults/rc.conf.
>
> Setting nfs_server_flags="" in /etc/defaults/rc.conf then restarting
> nfsd fixed the broken behaviour.
>
> Is this a bug? Seems like it might be.
>
Looking at source it's pretty normal looking and I don't think it's 
particularly volatile, so I suspect you're on the right lines - it's not 
getting the parameters you're setting for some external reason. Which 
release are you using?

I haven't tried to recreate it yet (I have my own problems to deal with).

One way I've debugged stuff like this is renaming the binary 
(/usr/sbin/nfsd in this case )to something safe and replacing it with:

#!/bin/sh
echo $@

:-)

Happy to cast my eyes on rc.conf if you'd care to send it. It's too easy 
to get wrong in ways the creator will never spot.

Regards, Frank.