3
0
forked from pool/util-linux
util-linux/util-linux-2.12-mount_mountfallback.patch

37 lines
1.2 KiB
Diff

Index: util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c
===================================================================
--- util-linux-ng-2.12r+2.13pre7.orig/mount/nfsmount.c
+++ util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c
@@ -167,8 +167,20 @@ get_mountport(struct sockaddr_in *server
}
if (!p.pm_vers)
p.pm_vers = MOUNTVERS;
- if (!p.pm_prot)
+ if (!p.pm_prot) {
p.pm_prot = IPPROTO_TCP;
+ if (!p.pm_port) {
+ p.pm_port = pmap_getport(server_addr,
+ p.pm_prog, p.pm_vers, p.pm_prot);
+ }
+ /* Fall back to UDP if there's no TCP registration for mount */
+ if (!p.pm_port) {
+ fprintf(stderr, "mount server reported tcp not available, falling back to udp\n");
+ p.pm_prot = IPPROTO_UDP;
+ p.pm_port = pmap_getport(server_addr,
+ p.pm_prog, p.pm_vers, p.pm_prot);
+ }
+ }
#if 0
if (!p.pm_port) {
p.pm_port = pmap_getport(server_addr, p.pm_prog, p.pm_vers,
@@ -582,7 +594,8 @@ retry_udp:
pm_mnt = get_mountport(&mount_server_addr,
mountprog,
mountvers,
- proto,
+ 0, /* TCP or UDP: pick
+ whatever is available */
mountport,
nfs_mount_version);