@@ -239,6 +239,9 @@ int nfsumount(int argc, char *argv[])
int c, ret;
char *spec;
struct mntentchn *mc;
+ char *opt;
+ struct local_bind_info local_ip;
+ memset(&local_ip, 0, sizeof(local_ip));
if (argc < 2) {
umount_usage();
@@ -314,7 +317,7 @@ int nfsumount(int argc, char *argv[])
return EX_USAGE;
}
if (hasmntopt(&mc->m, "users") == NULL) {
- char *opt = hasmntopt(&mc->m, "user");
+ opt = hasmntopt(&mc->m, "user");
struct passwd *pw;
char *comma;
size_t len;
@@ -334,6 +337,22 @@ int nfsumount(int argc, char *argv[])
}
}
+ if (mc) {
+ opt = hasmntopt(&mc->m, "srcaddr");
+ if ((opt != NULL) && strlen(opt) > strlen("srcaddr=")) {
+ char *sa = xstrdup(opt + strlen("srcaddr="));
+ unsigned int z;
+ for (z = 0; z < strlen(sa); z++) {
+ if (sa[z] == ',') {
+ sa[z] = 0;
+ break;
+ }
+ }
+ parse_local_bind(&local_ip, sa);
+ free(sa);
+ }
+ }
+
ret = EX_SUCCESS;
if (mc) {
if (!lazy) {
@@ -344,7 +363,8 @@ int nfsumount(int argc, char *argv[])
* we don't want to signal an error, as that
* could cause /sbin/mount to retry!
*/
- nfs_umount23(mc->m.mnt_fsname, mc->m.mnt_opts);
+ nfs_umount23(mc->m.mnt_fsname, mc->m.mnt_opts,
+ &local_ip);
break;
case 1:
break;
@@ -355,7 +375,7 @@ int nfsumount(int argc, char *argv[])
ret = del_mtab(mc->m.mnt_fsname, mc->m.mnt_dir);
} else if (*spec != '/') {
if (!lazy)
- ret = nfs_umount23(spec, "tcp,v3");
+ ret = nfs_umount23(spec, "tcp,v3", &local_ip);
} else
ret = del_mtab(NULL, spec);
@@ -153,7 +153,8 @@ int chk_mountpoint(const char *mount_point)
* pmap tuple. If the GETPORT call later fails to disambiguate them,
* then we fail.
*/
-int nfs_umount23(const char *devname, char *string)
+int nfs_umount23(const char *devname, char *string,
+ struct local_bind_info *local_ip)
{
char *hostname = NULL, *dirname = NULL;
struct mount_options *options;
@@ -164,7 +165,8 @@ int nfs_umount23(const char *devname, char *string)
options = po_split(string);
if (options) {
- result = nfs_umount_do_umnt(options, &hostname, &dirname, NULL);
+ result = nfs_umount_do_umnt(options, &hostname, &dirname,
+ local_ip);
po_destroy(options);
} else
nfs_error(_("%s: option parsing error"), progname);
@@ -31,6 +31,8 @@ void mount_usage(void);
void umount_usage(void);
int chk_mountpoint(const char *mount_point);
-int nfs_umount23(const char *devname, char *string);
+struct local_bind_info;
+int nfs_umount23(const char *devname, char *string,
+ struct local_bind_info *local_ip);
#endif /* !_NFS_UTILS_MOUNT_UTILS_H */