Bug 162860 - [zfs] Cannot share ZFS filesystem to hosts with a hyphen in hostname
Summary: [zfs] Cannot share ZFS filesystem to hosts with a hyphen in hostname
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-24 22:00 UTC by Sascha Frey
Modified: 2025-03-03 22:17 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sascha Frey 2011-11-24 22:00:23 UTC
Sharing a ZFS filesystem over NFS to hosts with a hyphen (-) in their hostnames using 'zfs set sharenfs' does not work.
'zfs get sharenfs'  does return the correct string as set before, but in /etc/zfs/exports the hyphen in the hostname was replaced with a blank.

How-To-Repeat: # zfs set sharenfs="-maproot=root foo-bar" systempool/export/test
# zfs get sharenfs systempool/export/test
NAME                                 PROPERTY  VALUE                    SOURCE
systempool/export/test     sharenfs  -maproot=root foo-bar  local
# cat /etc/zfs/exports
[...]
/export/test       -maproot=root foo bar
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-11-28 03:27:17 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:22 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 Stéphane D'Alu 2020-04-03 16:19:23 UTC
Any progress on this one?

This is a big problem for us as we have an hyphen in our domain name, not just for a single host.
Comment 4 mark 2025-03-03 21:35:09 UTC
I just hit this old bug too.

As a hack workaround, you can script edit /etc/zfs/exports to fix up any known munged hyphens and send SIGHUP to mountd.

I'm guessing you'd have to hack /etc/rc.d/zfs to re-apply the edit in zfs_start_main() too, since zfs share will keep generating a bogus exports file.

I'm sticking with sharenfs=on for now since it's just my home network...
Comment 5 mark 2025-03-03 22:17:01 UTC
Can anyone confirm this is fixed in -CURRENT?  I only have 14.2 running ZFS at the moment.

https://cgit.freebsd.org/src/commit/sys/contrib/openzfs/lib/libshare/os/freebsd/nfs.c?id=7a7741af18d6c8a804cc643cb7ecda9d730c6aa6

#16529 29c9e6c32 Fix handling of DNS names with '-' in them for sharenfs