summaryrefslogtreecommitdiffstats
path: root/support
Commit message (Collapse)AuthorAgeFilesLines
* nfs-utils: Restore ABI compat with pre-merge libnfsidmapJustin Mitchell2017-11-074-23/+42
| | | | | | | | | Prior to merge libnfsidmap leaked many private symbols that were not defined in its API, creating an accidental ABI. This patch renames and unhides symbols in order to match that ABI until a cleaned up API can be established and released. Signed-off-by: Steve Dickson <steved@redhat.com>
* gitignore: ignore files generated by libnfsidmap compilationSteve Dickson2017-11-021-11/+0
| | | | | | | libnfsidmap.pc is generated during the compiling of libnfsidmap which needed to be ignored. Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: cleanup warnings from merged libnfsidmap codeJustin Mitchell2017-10-265-21/+33
| | | | | | | | | Clean up a bunch of warnings about unused parameters, signedness differences, etc that we inherited from the merged libnfsidmap code. Signed-off-by: Justin Mitchell <jumitche@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: integrate libnfsidmap code with rest of nfs-utilsJustin Mitchell2017-10-267-12/+29
| | | | | | | | | | Modify libnfsidmap to use the now shared conffile code, adjust the build structure to generate everything correctly, and modify the other utils to use the merged version of libnfsidmap instead of testing for an external dependancy. Signed-off-by: Justin Mitchell <jumitche@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Import libnfsidmap codebaseJustin Mitchell2017-10-2616-0/+4827
| | | | | | | | | | Merge the libnfsidmap code tree into nfs-utils. These are the original unmodified files, cherry picked only the necessary files that dont duplicate code, so will not build correctly at this stage. Signed-off-by: Justin Mitchell <jumitche@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: split conffile to a separate convenience libJustin Mitchell2017-10-262-4/+11
| | | | | | | | | To allow better reuse of the code we split conffile and xlog into their own separate convenience library, then merge it back so as to not create extra dependancies for everything Signed-off-by: Justin Mitchell <jumitche@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: Add get_str with default valueJustin Mitchell2017-10-262-0/+13
| | | | | | | | | The similar config code in libnfsidmap had one additional feature of a get_str function with a default value option, include an equivalent function here to maintain compatibility. Signed-off-by: Justin Mitchell <jumitche@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: Merge conf_get_str and conf_get_sectionJustin Mitchell2017-10-261-22/+14
| | | | | | | | | | conf_get_section() started as conf_get_str() with one extra search parameter, subsequent patches have not maintained feature parity, combine the code to make a single more generic function and just call that differently where required. Signed-off-by: Justin Mitchell <jumitche@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: const-ify the config handling functionsJustin Mitchell2017-10-262-30/+30
| | | | | | | | Tighten up the conffile interface by switching to const arguments where appropriate. Signed-off-by: Justin Mitchell <jumitche@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: add missing include of stdint.hMatthew Weber2017-10-051-0/+1
| | | | | | | | | | | | | | Glibc bump to 2.26 exposed this missing header when building with the following combination using an i386 internal toolchain. gcc5.4.0 bin2.28.1 linux4.1.43 Upstream: https://bugzilla.linux-nfs.org/show_bug.cgi?id=312 Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* atomicio: removed a warningSteve Dickson2017-07-261-0/+1
| | | | | | atomicio.c:43:7: warning: this statement may fall through [-Wimplicit-fallthrough=] Signed-off-by: Steve Dickson <steved@redhat.com>
* present_address: Fixed error pathSteve Dickson2017-07-261-0/+1
| | | | | | | When inet_ntop fails do not fall into the AF_INET6 case, instead break out and take the error path out. Signed-off-by: Steve Dickson <steved@redhat.com>
* rpc.c: added include file so UINT16_MAX is defined.Steve Dickson2017-06-221-0/+1
| | | | Signed-off-by: Steve Dickson <steved@redhat.com>
* Reimplement include functionality in nfs.confJustin Mitchell2017-06-211-22/+56
| | | | | | | | | | | | Re-implement include file functionality as documented. Existing implementation had various issues, one of which was it allowed a subordinate file to inadvertently change which section the subsequent tags back in the master config file got assigned to. Acked-by: NeilBrown <neilb@suse.com> Signed-off-by: Justin Mitchell <jumitche@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs.conf: Removed buffer overrunsJustin Mitchell2017-06-061-84/+117
| | | | | | | | | Remove the line length parameter and associated code which led to buffer overruns in the line parsing code. Also drops the undocumented 'include' directive. Signed-off-by: Justin Mitchell <jumitche@rehat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs.conf: Add function to cleanup and free the loaded configJustin Mitchell2017-06-062-7/+45
| | | | | Signed-off-by: Justin Mitchell <jumitche@rehat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs.conf: Remove static variables in parsing routinesJustin Mitchell2017-06-061-18/+21
| | | | | | | | | | | Part of a sequence of attempts to tidy up the nfs.conf code and prepare it for use as part of a configuration API. Remove static vars that prevented memory cleanup and potentially lead to parsing errors if conf_init was called again. Signed-off-by: Justin Mitchell <jumitche@rehat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* config: Remove the conf_path globalJustin Mitchell2017-05-052-22/+26
| | | | | | | | Working towards an nfs.conf library and API for system config tools, first step, replace the conf_path global with a parameter to conf_init Signed-off-by: Justin Mitchell <jumitche@rehat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd: don't enable a UDP socket by defaultJeff Layton2017-04-051-1/+1
| | | | | | | | | | | | | | | | | | | Most major NFS clients have supported TCP for at least a decade now, and v4-only shops are becoming more prevalent. It seems reasonable that serving over UDP should be something that is "opt-in". I've always hesitated to do this in the past, but now that we have nfs.conf, it seems like the time may be right to disable UDP in default configurations. In particular, it would be good to try this in the more bleeding edge distros (Fedora, Ubuntu, SuSE, etc...) and see how problematic it is. Change the default in rpc.nfsd to just open TCP ports by default. Add new -u and -t options that allow users to explicitly override what's in the config file, and update the usage message and manpage. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfsd: Allow the caller to turn off NFSv4.0 without turning off NFSv4.xTrond Myklebust2017-04-051-2/+5
| | | | | | | | | | | | The new semantic is that '-N4' turns off all NFSv4 minor versions, while '-V4' turns them all on. In order to turn off just minor version x (x >= 0), use -N4.x, and to turn it back on. '-V4.x'. Note that on older kernels, attempting to use -N4.0 and -V4.0 is equivalent to specifying -N4 or -V4. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: ignore empty environment variables.NeilBrown2017-02-151-1/+1
| | | | | | | | | | | | | | | | | conf_set() already refuses to set an empty value, so if foo= appears in the config file, it will be ignored. This patch extends the policy to environment variables, so empty environment variables are treated as though they didn't exist. This means that a separate environment file (e.g. /etc/sysconfig/nfs) will be treated the same way whether it is: - included in the [environment] section of /etc/nfs.conf - sourced by the shell before running code - sourced by the systemd EnvironmentFile directive. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd/exportfs: implement the -s/--state-directory-path optionScott Mayhew2017-02-154-23/+105
| | | | | | Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libnsm.a: refactor nsm_setup_pathnames() and nsm_make_pathname()Scott Mayhew2017-02-154-43/+118
| | | | | | | | | | Move the logic in nsm_setup_pathnames() and nsm_make_pathname() to similar generic functions in libmisc.a so that the exportfs and rpc.mountd programs can make use of them later. Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: support "security_label" export optionJ. Bruce Fields2017-01-122-1/+6
| | | | | | | | On recent kernels only exports with NFSEXP_SECURITY_LABEL set will export security labels. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* xlog: Add common support for "debug=??" in /etc/nfs.confNeilBrown2016-12-202-0/+15
| | | | | | | | The value is from the list general, call, auth, parse, all. Most daemons recognise this in their dedicated section. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: fix striping of quotes from values.NeilBrown2016-12-201-8/+8
| | | | | | | There were being stripped from the name instead! Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: allow embedded spaces in values.NeilBrown2016-12-201-2/+6
| | | | | | | | | | | | | | | | The code that said "Skip trailing spaces" actually skipped everything after the first space. Change to to only skip trailing spaces, or comments that start after a space. This is useful for lists: Foo: a, b, c The list handling already allows for internal spaces. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: allow $name expansion of tag values.NeilBrown2016-12-201-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the value for a tag starts with '$', then the remainder of the value is treated as an environment variable name. It is looked up in the environment (getenv) and if not found, it is looked for in the [environment] section of the config file. This lookup is formed as access time e.g. by conf_get_str(), not at parse time. The expected usage is that the config file can contain something like [environment] include = /etc/sysconfig/nfs [other-section] tag = $NAME and conf_get_str("other-section","tag") will report the value of "NAME" in the given file. As different distributions used different environment files, and different variable names with-in them, a distro could provide a static config file which maps from names in that environment file to config tags requires by NFS daemons. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: ignore setting of empty stringNeilBrown2016-12-201-0/+2
| | | | | | | | | | | | A value setting like foo = is now equivalent to not setting "foo" at all. This is likely to be least confusing. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: strip "quotes" from values in conf file.NeilBrown2016-12-201-9/+16
| | | | | | | | | When "include = " is used to read and "environment" file such as /etc/sysconfig/nfs, there might be quotes around values. Stripe those off, just like a 'shell' reading the file would. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: add support for include files.NeilBrown2016-12-201-2/+6
| | | | | | | | | | | | | | | | | | A tag include = filename will be replaced by the content of the file. This must appear after a section heading, and any assignments not in their own section will be included in the section that this directive is in. e.g [environment] include = /etc/sysconfig/nfs Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: split loading of file into a separate function.NeilBrown2016-12-201-21/+26
| | | | | | | This will make support of include files easier. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: free image of config file after parsingNeilBrown2016-12-201-11/+6
| | | | | | | | | | | | | | | | | | | | | conffile allocates memory and reads in the config file. It then parses the file, using strdup() to take a copy of any string that it uses, so after conf_parse() there are no references in to the allocated file image. conffile does not free this image. It keeps a pointer, but never uses it in an interesing way, and never frees it. This is a little clumsy and interfers with a future patch which will support the inclusion of subordinate config files. So free 'new_conf_addr' when finished with it, and discard the 'conf_addr' variable that stored it. This has an insignificant performance consequence in that we node always free everything in the hash table, even when we know it must be empty. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* conffile: add bool supportNeilBrown2016-12-202-0/+34
| | | | | | | | conf_get_bool() interprets various strings as 'true' or 'false'. If no suitable value is found, the default is returned. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove all use of the nfsctl system call.NeilBrown2016-12-0615-800/+4
| | | | | | | | | | | | | | | | | | | | This systemcall was deprecated early in the 2.6 series as it was replaced by an in-kernel cache which was refilled using an upcall. All communication to kernel is now through the nfsd filesystem. The nfsctl systemcall itself was removed in 3.1. It is unlikely to have been used for over a decade. To remove all uses for the nfsctl systemcall, and call code that only runs when "new_cache" is false. We now assume "new_cache" is always true. This allows the removal of several files as well as assorted functions. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: remove redundant exports options outputJianhong Yin2016-11-221-1/+0
| | | | | | | | | | | | before this commit, run 'exportfs -s' will output some options more than one time. for example: /path *(rw,no_root_squash,rw,secure,no_root_squash,no_all_squash) the options rw,no_root_squash,etc will be print twice. the reason is secinfo_show() will show these security options again this patch remove these redundant outputs. Signed-off-by: Jianhong Yin <yin-jianhong@163.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Remove all use of /var/lib/nfs/xtabNeilBrown2016-11-153-41/+3
| | | | | | | | | | | | | | | /var/lib/nfs/xtab is only used to find out what has been exported to the kernel. This is more reliably done by reading /proc/fs/nfs{,d}/export and nfs-utils uses that file if is available. So xtab is only need if you have an incredibly ancient kernel which doesn't have /proc/fs/nfs/export (and so which only supports NFSv2) or if /proc is not mounted. Neither of these are credible contexts to run a modern nfs-utils, so stop creating or reading the xtab file. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-server-generator: avoid using external services.NeilBrown2016-11-072-6/+11
| | | | | | | | | | | | | | | | | | | nfs-server-generator is run very early when a lot of services are not yet started, so it mustn't depend on them. Currently it can try to use hostname lookup and syslog. Using hostname lookup can cause errors and when these are logged via syslog, it can cause the generator to block indefinitely Hostname-lookup is not needed, as we don't use the host issue, and sending message to stderr is sufficient for the generator. Disabling syslog is easy - call a function that sets a static variable. Disabling hostname lookup requires adding an "ignore_hosts" flags to export_read and export_d_read(). Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Move export_d_read() to support/export/export.cNeilBrown2016-08-202-0/+66
| | | | | | | | This places it in the same place as the similar export_read(), and allows it to be called from other programs. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* statd: suppress a benign log message in nsm_delete_host()Scott Mayhew2016-06-212-7/+10
| | | | | | | | | | | | | | | | | | Commit 76f8ce8c (statd: Update existing record if we receive SM_MON with new cookie) added some logic to unconditionally delete some existing on-disk monitor records. That works fine in an HA-NFS setup where there's a good chance of monitor files being left around after service failovers, but in the case where there isn't an existing monitor file statd emits a scary looking message like this: Jun 15 14:14:59 hostname rpc.statd[1368]: Failed to delete: could not stat original file /var/lib/nfs/statd/sm/nfs.smayhew.test: No such file or directory That message can be suppressed. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* exportfs: replace one xlog(D_GENERAL) in host_canonname()Scott Mayhew2016-05-021-1/+1
| | | | | | | | | | If we fall back to using the numeric host then we shouldn't call xlog with D_GENERAL. That can cause 'exportfs -u' to exit with a 1 if, for example, you have exports using ip addresses that can't be resolved to hostnames. Use D_PARSE instead. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* fix building w/newer C librariesMike Frysinger2016-04-272-0/+7
| | | | | | | | | | | | | | Linux C libraries are moving away from implicitly including the header sys/sysmacros.h via sys/types.h. We would like to do this for glibc now, but others (musl/etc...) have been doing it already. This means any code using major/minor/makedevs functions will fail to build when they don't include that header. Leverage the AC_HEADER_MAJOR macro that configure is already using to pull in the right header. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* statd: Don't unregister statd service on failing to execute calloutToshiaki Makita2016-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | statd calls atexit(statd_unregister) to unregister statd service on exit, which actually has a side-effect that ha_callout() unregisters statd service even when the child callout process exits on execl() failure. Certain clustering software's deployment script adds -H option with its specified file non-existent, when it is configured not to use callout. In other words, -H seems to be used no matter if callout is needed or not, but when callout is unnecessary, the specified callout program is not deployed. This causes statd not to work once a lock is requested by its NFS client, as execl() in ha_callout() results in ENOENT and exit() of the child process calls exit-handler statd_unregister(). Eventually, the NFS client gets stuck with messages "lockd: cannot monitor xxx" on the NFS server. Also, execl() could fail for other reasons like ENFILE or EIO as well. A forked child must not unregister the statd RPC server, so use _exit(), which does not call any exit-handlers, instead of exit(). Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> Signed-off-by: Steve Dickson <steved@redhat.com>
* libexport.a: fix missing brace in host_ntop() fallbackStefan Hajnoczi2016-03-161-1/+1
| | | | | | | | | An if statement has been missing a brace since host_ntop() was added in commit 94ce1eb94babb4c587b2826452fb053cba745098 ("libexport.a: Add helpers to manage DNS lookups"). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs_connect_nb: handle EINTR during connection establishmentOlga Kornievskaia2016-01-161-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | both connect() and select() can receive EINTR signals that we need to recover from. In Unix Network Programming, volume 1, section 5.9, W. Richard Stevens states: What we are doing [?] is restarting the interrupted system call ourself. This is fine for accept, along with the functions such as read, write, select and open. But there is one function that we cannot restart ourself: connect. If this function returns EINTR, we cannot call it again, as doing so will return an immediate error. When connect is interrupted by a caught signal and is not automatically restarted, we must call select to wait for the connection to complete, Thus for connect() treat both EINPROGRESS and EINTR the same -- call select(). For select(), it should be re-tried again upon receiving EINTR. Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Set right error after getaddrinfo failsRinku Kothiya2016-01-161-2/+2
| | | | | | | URL: https://bugzilla.redhat.com/show_bug.cgi?id=1287468 Signed-off-by: Rinku Kothiya <rkothiya@redhat.com> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mountd: fix netgroup lookup for short hostnamesFrank Sorenson2015-12-161-10/+7
| | | | | | | | | | | | Commit 9a92ef6f to add netgroup lookup of resolvable IP addresses inadvertently broke the netgroup check for short hostnames. This patch fixes that breakage by changing the IP address lookup to use a separate variable. Signed-off-by: Frank Sorenson <sorenson@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* libnsm.a: do not close file if open failedVivek Trivedi2015-12-112-2/+4
| | | | | | | | If file open failed, no need to issue close system call in nsm_get_state and closeall. Signed-off-by: Vivek Trivedi <t.vivek@samsung.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* svc_create.c: Make sure errors are loggedSteve Dickson2015-11-202-10/+13
| | | | | | | | To help debug rpcbind failures, make sure all errors are logged and log as much info about the error as possible. Signed-off-by: Steve Dickson <steved@redhat.com>
* mydaemon.c: Removed a warningSteve Dickson2015-11-041-0/+1
| | | | | | | | Commit 273b4647 introduced the following warning: mydaemon.c:125:2: warning: implicit declaration of function 'closelog' [-Wimplicit-function-declaration] Signed-off-by: Steve Dickson <steved@redhat.com>