diff options
author | Daniel Stefan Haischt <dsh@pfsense.org> | 2007-01-22 00:24:04 +0000 |
---|---|---|
committer | Daniel Stefan Haischt <dsh@pfsense.org> | 2007-01-22 00:24:04 +0000 |
commit | 0688503f7092a87d31b961eb43e2ff6282bc8930 (patch) | |
tree | d842c612d2ae3a0ffebc541dc98c5a4d4d4ee9c3 /packages/freenas/pkg | |
parent | a4f7ab6ec229d15aa6b7606516090b73ba50ff2a (diff) | |
download | pfsense-packages-0688503f7092a87d31b961eb43e2ff6282bc8930.tar.gz pfsense-packages-0688503f7092a87d31b961eb43e2ff6282bc8930.tar.bz2 pfsense-packages-0688503f7092a87d31b961eb43e2ff6282bc8930.zip |
* allow NFS options per export
* split NFS daemon options and export options into two different tabs
* allow NFS related daemons to bind to a particular IP address
Diffstat (limited to 'packages/freenas/pkg')
-rw-r--r-- | packages/freenas/pkg/freenas_guiconfig.inc | 1 | ||||
-rw-r--r-- | packages/freenas/pkg/freenas_services.inc | 64 |
2 files changed, 33 insertions, 32 deletions
diff --git a/packages/freenas/pkg/freenas_guiconfig.inc b/packages/freenas/pkg/freenas_guiconfig.inc index 1464b147..2dec5a42 100644 --- a/packages/freenas/pkg/freenas_guiconfig.inc +++ b/packages/freenas/pkg/freenas_guiconfig.inc @@ -36,6 +36,7 @@ $d_raidconfdirty_path = $g['varrun_path'] . "/raid.conf.dirty"; $d_userconfdirty_path = $g['varrun_path'] . "/user.conf.dirty"; $d_groupconfdirty_path = $g['varrun_path'] . "/group.conf.dirty"; $d_smbshareconfdirty_path = $g['varrun_path'] . "/smbshare.conf.dirty"; +$d_nfsexportconfdirty_path = $g['varrun_path'] . "/nfsexport.conf.dirty"; $d_upnpconfdirty_path = $g['varrun_path'] . "/upnp.conf.dirty"; /* ============================================================================= */ diff --git a/packages/freenas/pkg/freenas_services.inc b/packages/freenas/pkg/freenas_services.inc index 1bd9b980..e32ff24f 100644 --- a/packages/freenas/pkg/freenas_services.inc +++ b/packages/freenas/pkg/freenas_services.inc @@ -399,6 +399,9 @@ function services_nfs_configure() { if (isset($freenas_config['nfs']['enable'])) { if ($g['booting']) { echo "Starting NFS... "; } + + $nfsconf = ""; + $a_nfsconf = array(); /* If no share configured, exit */ if (!is_array($freenas_config['mounts']['mount'])) { return 1; } @@ -412,47 +415,44 @@ function services_nfs_configure() { } $a_mount = &$freenas_config['mounts']['mount']; - - /* TODO: ATM network authorization does not work on a per mount basis */ - if (is_array($freenas_config['nfs']['nfsnetwork'])) { - $a_nfsnetworks = array(); - $pfnetworks = array(); - - foreach ($freenas_config['nfs']['nfsnetwork'] as $netel) { - list($network,$subnet) = - explode('/', $netel); - $subnet = gen_subnet_mask($subnet); - $a_nfsnetworks[] = "-network {$network} -mask {$subnet}"; - $pfnetworks[] = $network; - } - - $nfsnetworks_str = implode(' ', $a_nfsnetworks); - services_setup_transparency_for("nfs", implode(" ", $pfnetworks)); - } - foreach ($a_mount as $mount) { /* -mapall and -maproot mutually exclusive */ - $mapping = $freenas_config['nfs']['mapall'] == "yes" ? "-mapall=root" : "-maproot=root"; + $mapping = $mount['nfs']['mapall'] == "yes" ? "-mapall=root" : "-maproot=root"; + $networks = isset($mount['nfs']['networks']) ? $mount['nfs']['networks'] : ""; - $nfsconf .= <<<EOD -/mnt/{$mount['sharename']} -alldirs {$mapping} -EOD; - - $nfsconf .= <<<EOD -{$nfsnetworks_str} - -EOD; - - } // end foreach + $nfsconf = "/mnt/{$mount['sharename']} -alldirs {$mapping}"; + + if ($networks <> "") { + $pfnetworks = array(); + + foreach (explode(",", $networks) as $netel) { + list($network,$subnet) = + explode('/', $netel); + + $subnet = gen_subnet_mask($subnet); + $pfnetworks[] = $network; + + $tmp_nfsconf .= "{$nfsconf} -network {$network} -mask {$subnet}\n"; + } + + $nfsconf = $tmp_nfsconf; + } else { + $nfsconf .= "\n"; + } + } - fwrite($fd, $nfsconf); fclose($fd); + $nfsdbindto = $freenas_config['nfs']['bindto'] = "(ANY)" ? " -a" : " -h {$freenas_config['nfs']['bindto']}"; + $rpcbbindto = $freenas_config['nfs']['bindto'] = "(ANY)" ? "" : " -h {$freenas_config['nfs']['bindto']}"; + $servetcp = isset($freenas_config['nfs']['servetcp']) ? " -t" : ""; + $serveudp = isset($freenas_config['nfs']['serveudp']) ? " -u" : ""; + /* run rpcbind, nfsd and mountd */ - mwexec("/usr/sbin/rpcbind -h {$freenas_config['nfs']['bindto']}"); - mwexec("/usr/sbin/nfsd -h {$freenas_config['nfs']['bindto']} -u -t -n 4"); + mwexec("/usr/sbin/rpcbind{$rpcbbindto}"); + mwexec("/usr/sbin/nfsd{$nfsdbindto}{$serveudp}{$servetcp} -n 4"); mwexec("/usr/sbin/mountd -r {$g['varetc_path']}/exports"); mwexec("/usr/sbin/rpc.lockd"); mwexec("/usr/sbin/rpc.statd"); |