aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-24 21:39:32 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-24 21:39:32 +0000
commitf26e3d2e41cc7d2fabcf5c2e777306c36a8d5868 (patch)
tree34f49fcdbd789003bb3cf0cec31030f94ca6ee7e
parentd0cc3f4ade36a651ada0001b18bcd04ada8d44a1 (diff)
downloadbusybox-w32-f26e3d2e41cc7d2fabcf5c2e777306c36a8d5868.tar.gz
busybox-w32-f26e3d2e41cc7d2fabcf5c2e777306c36a8d5868.tar.bz2
busybox-w32-f26e3d2e41cc7d2fabcf5c2e777306c36a8d5868.zip
mount: fix mishandling of proto=tcp/udp
function old new delta singlemount 4729 4695 -34
-rw-r--r--util-linux/mount.c82
1 files changed, 44 insertions, 38 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 61ad23528..3b77af728 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1059,6 +1059,7 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1059 if (filteropts) for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) { 1059 if (filteropts) for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) {
1060 char *opteq = strchr(opt, '='); 1060 char *opteq = strchr(opt, '=');
1061 if (opteq) { 1061 if (opteq) {
1062 int val, idx;
1062 static const char options[] ALIGN1 = 1063 static const char options[] ALIGN1 =
1063 /* 0 */ "rsize\0" 1064 /* 0 */ "rsize\0"
1064 /* 1 */ "wsize\0" 1065 /* 1 */ "wsize\0"
@@ -1081,87 +1082,92 @@ static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
1081 /* 18 */ "proto\0" 1082 /* 18 */ "proto\0"
1082 /* 19 */ "namlen\0" 1083 /* 19 */ "namlen\0"
1083 /* 20 */ "addr\0"; 1084 /* 20 */ "addr\0";
1084 int val = xatoi_u(opteq + 1); 1085
1085 *opteq = '\0'; 1086 *opteq++ = '\0';
1086 switch (index_in_strings(options, opt)) { 1087 idx = index_in_strings(options, opt);
1088 switch (idx) {
1089 case 12: // "mounthost"
1090 mounthost = xstrndup(opteq,
1091 strcspn(opteq, " \t\n\r,"));
1092 continue;
1093 case 18: // "proto"
1094 if (!strncmp(opteq, "tcp", 3))
1095 tcp = 1;
1096 else if (!strncmp(opteq, "udp", 3))
1097 tcp = 0;
1098 else
1099 bb_error_msg("warning: unrecognized proto= option");
1100 continue;
1101 case 20: // "addr" - ignore
1102 continue;
1103 }
1104
1105 val = xatoi_u(opteq);
1106 switch (idx) {
1087 case 0: // "rsize" 1107 case 0: // "rsize"
1088 data.rsize = val; 1108 data.rsize = val;
1089 break; 1109 continue;
1090 case 1: // "wsize" 1110 case 1: // "wsize"
1091 data.wsize = val; 1111 data.wsize = val;
1092 break; 1112 continue;
1093 case 2: // "timeo" 1113 case 2: // "timeo"
1094 data.timeo = val; 1114 data.timeo = val;
1095 break; 1115 continue;
1096 case 3: // "retrans" 1116 case 3: // "retrans"
1097 data.retrans = val; 1117 data.retrans = val;
1098 break; 1118 continue;
1099 case 4: // "acregmin" 1119 case 4: // "acregmin"
1100 data.acregmin = val; 1120 data.acregmin = val;
1101 break; 1121 continue;
1102 case 5: // "acregmax" 1122 case 5: // "acregmax"
1103 data.acregmax = val; 1123 data.acregmax = val;
1104 break; 1124 continue;
1105 case 6: // "acdirmin" 1125 case 6: // "acdirmin"
1106 data.acdirmin = val; 1126 data.acdirmin = val;
1107 break; 1127 continue;
1108 case 7: // "acdirmax" 1128 case 7: // "acdirmax"
1109 data.acdirmax = val; 1129 data.acdirmax = val;
1110 break; 1130 continue;
1111 case 8: // "actimeo" 1131 case 8: // "actimeo"
1112 data.acregmin = val; 1132 data.acregmin = val;
1113 data.acregmax = val; 1133 data.acregmax = val;
1114 data.acdirmin = val; 1134 data.acdirmin = val;
1115 data.acdirmax = val; 1135 data.acdirmax = val;
1116 break; 1136 continue;
1117 case 9: // "retry" 1137 case 9: // "retry"
1118 retry = val; 1138 retry = val;
1119 break; 1139 continue;
1120 case 10: // "port" 1140 case 10: // "port"
1121 port = val; 1141 port = val;
1122 break; 1142 continue;
1123 case 11: // "mountport" 1143 case 11: // "mountport"
1124 mountport = val; 1144 mountport = val;
1125 break; 1145 continue;
1126 case 12: // "mounthost"
1127 mounthost = xstrndup(opteq+1,
1128 strcspn(opteq+1," \t\n\r,"));
1129 break;
1130 case 13: // "mountprog" 1146 case 13: // "mountprog"
1131 mountprog = val; 1147 mountprog = val;
1132 break; 1148 continue;
1133 case 14: // "mountvers" 1149 case 14: // "mountvers"
1134 mountvers = val; 1150 mountvers = val;
1135 break; 1151 continue;
1136 case 15: // "nfsprog" 1152 case 15: // "nfsprog"
1137 nfsprog = val; 1153 nfsprog = val;
1138 break; 1154 continue;
1139 case 16: // "nfsvers" 1155 case 16: // "nfsvers"
1140 case 17: // "vers" 1156 case 17: // "vers"
1141 nfsvers = val; 1157 nfsvers = val;
1142 break; 1158 continue;
1143 case 18: // "proto"
1144 if (!strncmp(opteq+1, "tcp", 3))
1145 tcp = 1;
1146 else if (!strncmp(opteq+1, "udp", 3))
1147 tcp = 0;
1148 else
1149 bb_error_msg("warning: unrecognized proto= option");
1150 break;
1151 case 19: // "namlen" 1159 case 19: // "namlen"
1152 if (nfs_mount_version >= 2) 1160 //if (nfs_mount_version >= 2)
1153 data.namlen = val; 1161 data.namlen = val;
1154 else 1162 //else
1155 bb_error_msg("warning: option namlen is not supported\n"); 1163 // bb_error_msg("warning: option namlen is not supported\n");
1156 break; 1164 continue;
1157 case 20: // "addr" - ignore
1158 break;
1159 default: 1165 default:
1160 bb_error_msg("unknown nfs mount parameter: %s=%d", opt, val); 1166 bb_error_msg("unknown nfs mount parameter: %s=%d", opt, val);
1161 goto fail; 1167 goto fail;
1162 } 1168 }
1163 } 1169 }
1164 else { 1170 else { /* not of the form opt=val */
1165 static const char options[] ALIGN1 = 1171 static const char options[] ALIGN1 =
1166 "bg\0" 1172 "bg\0"
1167 "fg\0" 1173 "fg\0"