]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/mount/stropts.c
967fd69531f7a338b13fe7b7775ea3d991bf2af2
[nfs-utils.git] / utils / mount / stropts.c
1 /*
2  * stropts.c -- NFS mount using C string to pass options to kernel
3  *
4  * Copyright (C) 2007 Oracle.  All rights reserved.
5  * Copyright (C) 2007 Chuck Lever <chuck.lever@oracle.com>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public
18  * License along with this program; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 021110-1307, USA.
21  *
22  */
23
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27
28 #include <ctype.h>
29 #include <unistd.h>
30 #include <stdio.h>
31 #include <string.h>
32 #include <stdlib.h>
33 #include <errno.h>
34 #include <netdb.h>
35 #include <time.h>
36 #include <sys/socket.h>
37 #include <sys/mount.h>
38
39 #include "xcommon.h"
40 #include "mount.h"
41 #include "nls.h"
42 #include "nfs_mount.h"
43 #include "mount_constants.h"
44 #include "stropts.h"
45 #include "error.h"
46 #include "network.h"
47 #include "parse_opt.h"
48
49 #ifdef HAVE_RPCSVC_NFS_PROT_H
50 #include <rpcsvc/nfs_prot.h>
51 #else
52 #include <linux/nfs.h>
53 #define nfsstat nfs_stat
54 #endif
55
56 #ifndef NFS_PORT
57 #define NFS_PORT 2049
58 #endif
59
60 #ifndef NFS_MAXHOSTNAME
61 #define NFS_MAXHOSTNAME         (255)
62 #endif
63
64 #ifndef NFS_MAXPATHNAME
65 #define NFS_MAXPATHNAME         (1024)
66 #endif
67
68 #ifndef NFS_DEF_FG_TIMEOUT_MINUTES
69 #define NFS_DEF_FG_TIMEOUT_MINUTES      (2u)
70 #endif
71
72 #ifndef NFS_DEF_BG_TIMEOUT_MINUTES
73 #define NFS_DEF_BG_TIMEOUT_MINUTES      (10000u)
74 #endif
75
76 extern int nfs_mount_data_version;
77 extern char *progname;
78 extern int verbose;
79
80 struct nfsmount_info {
81         const char              *spec,          /* server:/path */
82                                 *node,          /* mounted-on dir */
83                                 *type;          /* "nfs" or "nfs4" */
84         char                    *hostname;      /* server's hostname */
85
86         struct mount_options    *options;       /* parsed mount options */
87         char                    **extra_opts;   /* string for /etc/mtab */
88
89         int                     flags,          /* MS_ flags */
90                                 fake,           /* actually do the mount? */
91                                 child;          /* forked bg child? */
92 };
93
94 static int nfs_parse_devname(struct nfsmount_info *mi)
95 {
96         int ret = 0;
97         char *dev, *pathname, *s;
98
99         dev = xstrdup(mi->spec);
100
101         if (!(pathname = strchr(dev, ':'))) {
102                 nfs_error(_("%s: remote share not in 'host:dir' format"),
103                                 progname);
104                 goto out;
105         }
106         *pathname = '\0';
107         pathname++;
108
109         /*
110          * We don't need a copy of the pathname, but let's
111          * sanity check it anyway.
112          */
113         if (strlen(pathname) > NFS_MAXPATHNAME) {
114                 nfs_error(_("%s: export pathname is too long"),
115                                 progname);
116                 goto out;
117         }
118
119         /*
120          * Ignore all but first hostname in replicated mounts
121          * until they can be fully supported. (mack@sgi.com)
122          */
123         if ((s = strchr(dev, ','))) {
124                 *s = '\0';
125                 nfs_error(_("%s: warning: multiple hostnames not supported"),
126                                 progname);
127                 nfs_error(_("%s: ignoring hostnames that follow the first one"),
128                                 progname);
129         }
130         mi->hostname = xstrdup(dev);
131         if (strlen(mi->hostname) > NFS_MAXHOSTNAME) {
132                 nfs_error(_("%s: server hostname is too long"),
133                                 progname);
134                 free(mi->hostname);
135                 mi->hostname = NULL;
136                 goto out;
137         }
138
139         ret = 1;
140
141 out:
142         free(dev);
143         return ret;
144 }
145
146 static int fill_ipv4_sockaddr(const char *hostname, struct sockaddr_in *addr)
147 {
148         struct hostent *hp;
149         addr->sin_family = AF_INET;
150
151         if (inet_aton(hostname, &addr->sin_addr))
152                 return 1;
153         if ((hp = gethostbyname(hostname)) == NULL) {
154                 nfs_error(_("%s: can't get address for %s\n"),
155                                 progname, hostname);
156                 return 0;
157         }
158         if (hp->h_length > sizeof(struct in_addr)) {
159                 nfs_error(_("%s: got bad hp->h_length"), progname);
160                 hp->h_length = sizeof(struct in_addr);
161         }
162         memcpy(&addr->sin_addr, hp->h_addr, hp->h_length);
163         return 1;
164 }
165
166 /*
167  * Obtain a retry timeout value based on the value of the "retry=" option.
168  *
169  * Returns a time_t timeout timestamp, in seconds.
170  */
171 static time_t nfs_parse_retry_option(struct mount_options *options,
172                                      unsigned int timeout_minutes)
173 {
174         char *retry_option, *endptr;
175
176         retry_option = po_get(options, "retry");
177         if (retry_option) {
178                 long tmp;
179
180                 errno = 0;
181                 tmp = strtol(retry_option, &endptr, 10);
182                 if (errno == 0 && endptr != retry_option && tmp >= 0)
183                         timeout_minutes = tmp;
184                 else if (verbose)
185                         nfs_error(_("%s: invalid retry timeout was specified; "
186                                         "using default timeout"), progname);
187         }
188
189         return time(NULL) + (time_t)(timeout_minutes * 60);
190 }
191
192 /*
193  * Append the 'addr=' option to the options string to pass a resolved
194  * server address to the kernel.  After a successful mount, this address
195  * is also added to /etc/mtab for use when unmounting.
196  *
197  * If 'addr=' is already present, we strip it out.  This prevents users
198  * from setting a bogus 'addr=' option themselves, and also allows bg
199  * retries to recompute the server's address, in case it has changed.
200  *
201  * Returns 1 if 'addr=' option appended successfully;
202  * otherwise zero.
203  */
204 static int append_addr_option(struct sockaddr_in *saddr,
205                            struct mount_options *options)
206 {
207         char new_option[24];
208
209         po_remove_all(options, "addr");
210
211         snprintf(new_option, sizeof(new_option) - 1,
212                         "addr=%s", inet_ntoa(saddr->sin_addr));
213
214         if (po_append(options, new_option) == PO_SUCCEEDED)
215                 return 1;
216         return 0;
217 }
218
219 /*
220  * Called to discover our address and append an appropriate 'clientaddr='
221  * option to the options string.
222  *
223  * Returns 1 if 'clientaddr=' option created successfully or if
224  * 'clientaddr=' option is already present; otherwise zero.
225  */
226 static int append_clientaddr_option(struct sockaddr_in *saddr,
227                                     struct mount_options *options)
228 {
229         struct sockaddr_in my_addr;
230         char new_option[32];
231
232         if (po_contains(options, "clientaddr") == PO_SUCCEEDED)
233                 return 1;
234
235         if (!get_client_address(saddr, &my_addr))
236                 return 0;
237
238         snprintf(new_option, sizeof(new_option) - 1,
239                         "clientaddr=%s", inet_ntoa(my_addr.sin_addr));
240
241         if (po_append(options, new_option) == PO_SUCCEEDED)
242                 return 1;
243         return 0;
244 }
245
246 /*
247  * Resolve the 'mounthost=' hostname and append a new option using
248  * the resulting IPv4 address.
249  */
250 static int fix_mounthost_option(struct mount_options *options)
251 {
252         struct sockaddr_in maddr;
253         char *mounthost, new_option[32];
254
255         mounthost = po_get(options, "mounthost");
256         if (!mounthost)
257                 return 1;
258
259         if (!fill_ipv4_sockaddr(mounthost, &maddr))
260                 return 0;
261
262         snprintf(new_option, sizeof(new_option) - 1,
263                         "mountaddr=%s", inet_ntoa(maddr.sin_addr));
264
265         if (po_append(options, new_option) == PO_SUCCEEDED)
266                 return 1;
267         return 0;
268 }
269
270 /*
271  * Returns zero if the "lock" option is in effect, but statd
272  * can't be started.  Otherwise, returns 1.
273  */
274 static int verify_lock_option(struct mount_options *options)
275 {
276         if (po_rightmost(options, "nolock", "lock") == PO_KEY1_RIGHTMOST)
277                 return 1;
278
279         if (!start_statd()) {
280                 nfs_error(_("%s: rpc.statd is not running but is "
281                             "required for remote locking."), progname);
282                 nfs_error(_("%s: Either use '-o nolock' to keep "
283                             "locks local, or start statd."), progname);
284                 return 0;
285         }
286
287         return 1;
288 }
289
290 /*
291  * Set up mandatory NFS mount options.
292  *
293  * Returns 1 if successful; otherwise zero.
294  */
295 static int nfs_validate_options(struct nfsmount_info *mi)
296 {
297         struct sockaddr_in saddr;
298
299         if (!fill_ipv4_sockaddr(mi->hostname, &saddr))
300                 return 0;
301
302         if (strncmp(mi->type, "nfs4", 4) == 0) {
303                 if (!append_clientaddr_option(&saddr, mi->options))
304                         return 0;
305         } else {
306                 if (!fix_mounthost_option(mi->options))
307                         return 0;
308                 if (!mi->fake && !verify_lock_option(mi->options))
309                         return 0;
310         }
311
312         if (!append_addr_option(&saddr, mi->options))
313                 return 0;
314
315         return 1;
316 }
317
318 /*
319  * Distinguish between permanent and temporary errors.
320  *
321  * Returns 0 if the passed-in error is temporary, thus the
322  * mount system call should be retried; returns one if the
323  * passed-in error is permanent, thus the mount system call
324  * should not be retried.
325  */
326 static int is_permanent_error(int error)
327 {
328         switch (error) {
329         case ESTALE:
330         case ETIMEDOUT:
331         case ECONNREFUSED:
332                 return 0;       /* temporary */
333         default:
334                 return 1;       /* permanent */
335         }
336 }
337
338 /*
339  * Reconstruct the mount option string based on a portmapper probe
340  * of the server.  Returns one if the server's portmapper returned
341  * something we can use, otherwise zero.
342  *
343  * To handle version and transport protocol fallback properly, we
344  * need to parse some of the mount options in order to set up a
345  * portmap probe.  Mount options that rewrite_mount_options()
346  * doesn't recognize are left alone.
347  *
348  * Returns a new group of mount options if successful; otherwise
349  * NULL is returned if some failure occurred.
350  */
351 static struct mount_options *rewrite_mount_options(char *str)
352 {
353         struct mount_options *options;
354         char *option, new_option[64];
355         clnt_addr_t mnt_server = { };
356         clnt_addr_t nfs_server = { };
357         int p;
358
359         errno = EIO;
360
361         options = po_split(str);
362         if (!options)
363                 return NULL;
364
365         option = po_get(options, "addr");
366         if (option) {
367                 nfs_server.saddr.sin_family = AF_INET;
368                 if (!inet_aton((const char *)option, &nfs_server.saddr.sin_addr))
369                         goto err;
370         } else
371                 goto err;
372
373         option = po_get(options, "mountaddr");
374         if (option) {
375                 mnt_server.saddr.sin_family = AF_INET;
376                 if (!inet_aton((const char *)option, &mnt_server.saddr.sin_addr))
377                         goto err;
378         } else
379                 memcpy(&mnt_server.saddr, &nfs_server.saddr,
380                                 sizeof(mnt_server.saddr));
381
382         option = po_get(options, "mountport");
383         if (option)
384                 mnt_server.pmap.pm_port = atoi(option);
385         mnt_server.pmap.pm_prog = MOUNTPROG;
386         option = po_get(options, "mountvers");
387         if (option)
388                 mnt_server.pmap.pm_vers = atoi(option);
389
390         option = po_get(options, "port");
391         if (option) {
392                 nfs_server.pmap.pm_port = atoi(option);
393                 po_remove_all(options, "port");
394         }
395         nfs_server.pmap.pm_prog = NFS_PROGRAM;
396
397         option = po_get(options, "nfsvers");
398         if (option) {
399                 nfs_server.pmap.pm_vers = atoi(option);
400                 po_remove_all(options, "nfsvers");
401         }
402         option = po_get(options, "vers");
403         if (option) {
404                 nfs_server.pmap.pm_vers = atoi(option);
405                 po_remove_all(options, "vers");
406         }
407         option = po_get(options, "proto");
408         if (option) {
409                 if (strcmp(option, "tcp") == 0) {
410                         nfs_server.pmap.pm_prot = IPPROTO_TCP;
411                         po_remove_all(options, "proto");
412                 }
413                 if (strcmp(option, "udp") == 0) {
414                         nfs_server.pmap.pm_prot = IPPROTO_UDP;
415                         po_remove_all(options, "proto");
416                 }
417         }
418         p = po_rightmost(options, "tcp", "udp");
419         switch (p) {
420         case PO_KEY2_RIGHTMOST:
421                 nfs_server.pmap.pm_prot = IPPROTO_UDP;
422                 break;
423         case PO_KEY1_RIGHTMOST:
424                 nfs_server.pmap.pm_prot = IPPROTO_TCP;
425                 break;
426         }
427         po_remove_all(options, "tcp");
428         po_remove_all(options, "udp");
429
430         if (!probe_bothports(&mnt_server, &nfs_server)) {
431                 errno = ESPIPE;
432                 goto err;
433         }
434
435         snprintf(new_option, sizeof(new_option) - 1,
436                  "nfsvers=%lu", nfs_server.pmap.pm_vers);
437         if (po_append(options, new_option) == PO_FAILED)
438                 goto err;
439
440         if (nfs_server.pmap.pm_prot == IPPROTO_TCP)
441                 snprintf(new_option, sizeof(new_option) - 1,
442                          "proto=tcp");
443         else
444                 snprintf(new_option, sizeof(new_option) - 1,
445                          "proto=udp");
446         if (po_append(options, new_option) == PO_FAILED)
447                 goto err;
448
449         if (nfs_server.pmap.pm_port != NFS_PORT) {
450                 snprintf(new_option, sizeof(new_option) - 1,
451                          "port=%lu", nfs_server.pmap.pm_port);
452                 if (po_append(options, new_option) == PO_FAILED)
453                         goto err;
454
455         }
456
457         errno = 0;
458         return options;
459
460 err:
461         po_destroy(options);
462         return NULL;
463 }
464
465 /*
466  * Do the mount(2) system call.
467  *
468  * Returns 1 if successful, otherwise zero.
469  * "errno" is set to reflect the individual error.
470  */
471 static int nfs_sys_mount(const struct nfsmount_info *mi, const char *type,
472                          const char *options)
473 {
474         int result;
475
476         result = mount(mi->spec, mi->node, type,
477                                 mi->flags & ~(MS_USER|MS_USERS), options);
478         if (verbose && result) {
479                 int save = errno;
480                 nfs_error(_("%s: mount(2): %s"), progname, strerror(save));
481                 errno = save;
482         }
483         return !result;
484 }
485
486 /*
487  * Retry an NFS mount that failed because the requested service isn't
488  * available on the server.
489  *
490  * Returns 1 if successful.  Otherwise, returns zero.
491  * "errno" is set to reflect the individual error.
492  *
493  * Side effect: If the retry is successful, both 'options' and
494  * 'extra_opts' are updated to reflect the mount options that worked.
495  * If the retry fails, 'options' and 'extra_opts' are left unchanged.
496  */
497 static int nfs_retry_nfs23mount(struct nfsmount_info *mi)
498 {
499         struct mount_options *retry_options;
500         char *retry_str = NULL;
501         char **extra_opts = mi->extra_opts;
502
503         retry_options = rewrite_mount_options(*extra_opts);
504         if (!retry_options)
505                 return 0;
506
507         if (po_join(retry_options, &retry_str) == PO_FAILED) {
508                 po_destroy(retry_options);
509                 errno = EIO;
510                 return 0;
511         }
512
513         if (verbose)
514                 printf(_("%s: text-based options (retry): '%s'\n"),
515                         progname, retry_str);
516
517         if (!nfs_sys_mount(mi, "nfs", retry_str)) {
518                 po_destroy(retry_options);
519                 free(retry_str);
520                 return 0;
521         }
522
523         free(*extra_opts);
524         *extra_opts = retry_str;
525         po_replace(mi->options, retry_options);
526         return 1;
527 }
528
529 /*
530  * Attempt an NFSv2/3 mount via a mount(2) system call.  If the kernel
531  * claims the requested service isn't supported on the server, probe
532  * the server to see what's supported, rewrite the mount options,
533  * and retry the request.
534  *
535  * Returns 1 if successful.  Otherwise, returns zero.
536  * "errno" is set to reflect the individual error.
537  *
538  * Side effect: If the retry is successful, both 'options' and
539  * 'extra_opts' are updated to reflect the mount options that worked.
540  * If the retry fails, 'options' and 'extra_opts' are left unchanged.
541  */
542 static int nfs_try_nfs23mount(struct nfsmount_info *mi)
543 {
544         char **extra_opts = mi->extra_opts;
545
546         if (po_join(mi->options, extra_opts) == PO_FAILED) {
547                 errno = EIO;
548                 return 0;
549         }
550
551         if (verbose)
552                 printf(_("%s: text-based options: '%s'\n"),
553                         progname, *extra_opts);
554
555         if (mi->fake)
556                 return 1;
557
558         if (nfs_sys_mount(mi, "nfs", *extra_opts))
559                 return 1;
560
561         /*
562          * The kernel returns EOPNOTSUPP if the RPC bind failed,
563          * and EPROTONOSUPPORT if the version isn't supported.
564          */
565         if (errno != EOPNOTSUPP && errno != EPROTONOSUPPORT)
566                 return 0;
567
568         return nfs_retry_nfs23mount(mi);
569 }
570
571 /*
572  * Attempt an NFS v4 mount via a mount(2) system call.
573  *
574  * Returns 1 if successful.  Otherwise, returns zero.
575  * "errno" is set to reflect the individual error.
576  */
577 static int nfs_try_nfs4mount(struct nfsmount_info *mi)
578 {
579         char **extra_opts = mi->extra_opts;
580
581         if (po_join(mi->options, extra_opts) == PO_FAILED) {
582                 errno = EIO;
583                 return 0;
584         }
585
586         if (verbose)
587                 printf(_("%s: text-based options: '%s'\n"),
588                         progname, *extra_opts);
589
590         if (mi->fake)
591                 return 1;
592
593         return nfs_sys_mount(mi, "nfs4", *extra_opts);
594 }
595
596 /*
597  * Perform either an NFSv2/3 mount, or an NFSv4 mount system call.
598  *
599  * Returns 1 if successful.  Otherwise, returns zero.
600  * "errno" is set to reflect the individual error.
601  */
602 static int nfs_try_mount(struct nfsmount_info *mi)
603 {
604         if (strncmp(mi->type, "nfs4", 4) == 0)
605                 return nfs_try_nfs4mount(mi);
606         else
607                 return nfs_try_nfs23mount(mi);
608 }
609
610 /*
611  * Handle "foreground" NFS mounts.
612  *
613  * Retry the mount request for as long as the 'retry=' option says.
614  *
615  * Returns a valid mount command exit code.
616  */
617 static int nfsmount_fg(struct nfsmount_info *mi)
618 {
619         unsigned int secs = 1;
620         time_t timeout;
621
622         timeout = nfs_parse_retry_option(mi->options,
623                                          NFS_DEF_FG_TIMEOUT_MINUTES);
624         if (verbose)
625                 printf(_("%s: timeout set for %s"),
626                         progname, ctime(&timeout));
627
628         for (;;) {
629                 if (nfs_try_mount(mi))
630                         return EX_SUCCESS;
631
632                 if (is_permanent_error(errno))
633                         break;
634
635                 if (time(NULL) > timeout) {
636                         errno = ETIMEDOUT;
637                         break;
638                 }
639
640                 if (errno != ETIMEDOUT) {
641                         if (sleep(secs))
642                                 break;
643                         secs <<= 1;
644                         if (secs > 10)
645                                 secs = 10;
646                 }
647         };
648
649         mount_error(mi->spec, mi->node, errno);
650         return EX_FAIL;
651 }
652
653 /*
654  * Handle "background" NFS mount [first try]
655  *
656  * Returns a valid mount command exit code.
657  *
658  * EX_BG should cause the caller to fork and invoke nfsmount_child.
659  */
660 static int nfsmount_parent(struct nfsmount_info *mi)
661 {
662         if (nfs_try_mount(mi))
663                 return EX_SUCCESS;
664
665         if (is_permanent_error(errno)) {
666                 mount_error(mi->spec, mi->node, errno);
667                 return EX_FAIL;
668         }
669
670         sys_mount_errors(mi->hostname, errno, 1, 1);
671         return EX_BG;
672 }
673
674 /*
675  * Handle "background" NFS mount [retry daemon]
676  *
677  * Returns a valid mount command exit code: EX_SUCCESS if successful,
678  * EX_FAIL if a failure occurred.  There's nothing to catch the
679  * error return, though, so we use sys_mount_errors to log the
680  * failure.
681  */
682 static int nfsmount_child(struct nfsmount_info *mi)
683 {
684         unsigned int secs = 1;
685         time_t timeout;
686
687         timeout = nfs_parse_retry_option(mi->options,
688                                          NFS_DEF_BG_TIMEOUT_MINUTES);
689
690         for (;;) {
691                 if (sleep(secs))
692                         break;
693                 secs <<= 1;
694                 if (secs > 120)
695                         secs = 120;
696
697                 if (nfs_try_mount(mi))
698                         return EX_SUCCESS;
699
700                 if (is_permanent_error(errno))
701                         break;
702
703                 if (time(NULL) > timeout)
704                         break;
705
706                 sys_mount_errors(mi->hostname, errno, 1, 1);
707         };
708
709         sys_mount_errors(mi->hostname, errno, 1, 0);
710         return EX_FAIL;
711 }
712
713 /*
714  * Handle "background" NFS mount
715  *
716  * Returns a valid mount command exit code.
717  */
718 static int nfsmount_bg(struct nfsmount_info *mi)
719 {
720         if (!mi->child)
721                 return nfsmount_parent(mi);
722         else
723                 return nfsmount_child(mi);
724 }
725
726 /*
727  * Process mount options and try a mount system call.
728  *
729  * Returns a valid mount command exit code.
730  */
731 static int nfsmount_start(struct nfsmount_info *mi)
732 {
733         if (!nfs_validate_options(mi))
734                 return EX_FAIL;
735
736         if (po_rightmost(mi->options, "bg", "fg") == PO_KEY1_RIGHTMOST)
737                 return nfsmount_bg(mi);
738         else
739                 return nfsmount_fg(mi);
740 }
741
742 /**
743  * nfsmount_string - Mount an NFS file system using C string options
744  * @spec: C string specifying remote share to mount ("hostname:path")
745  * @node: C string pathname of local mounted-on directory
746  * @type: C string that represents file system type ("nfs" or "nfs4")
747  * @flags: MS_ style mount flags
748  * @extra_opts: pointer to C string containing fs-specific mount options
749  *              (input and output argument)
750  * @fake: flag indicating whether to carry out the whole operation
751  * @child: one if this is a mount daemon (bg)
752  */
753 int nfsmount_string(const char *spec, const char *node, const char *type,
754                     int flags, char **extra_opts, int fake, int child)
755 {
756         struct nfsmount_info mi = {
757                 .spec           = spec,
758                 .node           = node,
759                 .type           = type,
760                 .extra_opts     = extra_opts,
761                 .flags          = flags,
762                 .fake           = fake,
763                 .child          = child,
764         };
765         int retval = EX_FAIL;
766
767         if (!nfs_parse_devname(&mi))
768                 return retval;
769
770         mi.options = po_split(*extra_opts);
771         if (mi.options) {
772                 retval = nfsmount_start(&mi);
773                 po_destroy(mi.options);
774         } else
775                 nfs_error(_("%s: internal option parsing error"), progname);
776
777         free(mi.hostname);
778         return retval;
779 }