diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2002-12-06 08:35:55 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2002-12-06 08:35:55 +0000 |
commit | cdbe5e5d4c79ab1fc47e3f7f05704b11b7945707 (patch) | |
tree | 5472ce9938b79f83db4d3fd5b2f71acaeb6ad192 | |
parent | 9227371b71dfdc9ad52cb952cecd04ddbde83981 (diff) | |
download | busybox-w32-cdbe5e5d4c79ab1fc47e3f7f05704b11b7945707.tar.gz busybox-w32-cdbe5e5d4c79ab1fc47e3f7f05704b11b7945707.tar.bz2 busybox-w32-cdbe5e5d4c79ab1fc47e3f7f05704b11b7945707.zip |
Make mapping a config option again to save space, turn off file locking, do we really need it ?
-rw-r--r-- | networking/Config.in | 8 | ||||
-rw-r--r-- | networking/ifupdown.c | 32 |
2 files changed, 28 insertions, 12 deletions
diff --git a/networking/Config.in b/networking/Config.in index 0ff3f52bc..628178cd3 100644 --- a/networking/Config.in +++ b/networking/Config.in | |||
@@ -85,6 +85,14 @@ config CONFIG_FEATURE_IFUPDOWN_IPX | |||
85 | help | 85 | help |
86 | Please submit a patch to add help text for this item. | 86 | Please submit a patch to add help text for this item. |
87 | 87 | ||
88 | config CONFIG_FEATURE_IFUPDOWN_MAPPING | ||
89 | bool " Enable mapping support" | ||
90 | default n | ||
91 | depends on CONFIG_IFUPDOWN | ||
92 | help | ||
93 | This enables support for the "mapping" stanza, unless you have | ||
94 | a weird network setup you dont need it. | ||
95 | |||
88 | config CONFIG_IP | 96 | config CONFIG_IP |
89 | bool "ip" | 97 | bool "ip" |
90 | default n | 98 | default n |
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 450a50896..36a12d77c 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -680,7 +680,9 @@ static interfaces_file *read_interfaces(char *filename) | |||
680 | { | 680 | { |
681 | interface_defn *currif = NULL; | 681 | interface_defn *currif = NULL; |
682 | interfaces_file *defn; | 682 | interfaces_file *defn; |
683 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING | ||
683 | mapping_defn *currmap = NULL; | 684 | mapping_defn *currmap = NULL; |
685 | #endif | ||
684 | FILE *f; | 686 | FILE *f; |
685 | char firstword[80]; | 687 | char firstword[80]; |
686 | char *buf = NULL; | 688 | char *buf = NULL; |
@@ -708,6 +710,7 @@ static interfaces_file *read_interfaces(char *filename) | |||
708 | } | 710 | } |
709 | 711 | ||
710 | if (strcmp(firstword, "mapping") == 0) { | 712 | if (strcmp(firstword, "mapping") == 0) { |
713 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING | ||
711 | currmap = xmalloc(sizeof(mapping_defn)); | 714 | currmap = xmalloc(sizeof(mapping_defn)); |
712 | currmap->max_matches = 0; | 715 | currmap->max_matches = 0; |
713 | currmap->n_matches = 0; | 716 | currmap->n_matches = 0; |
@@ -733,6 +736,7 @@ static interfaces_file *read_interfaces(char *filename) | |||
733 | *where = currmap; | 736 | *where = currmap; |
734 | currmap->next = NULL; | 737 | currmap->next = NULL; |
735 | } | 738 | } |
739 | #endif | ||
736 | currently_processing = MAPPING; | 740 | currently_processing = MAPPING; |
737 | } else if (strcmp(firstword, "iface") == 0) { | 741 | } else if (strcmp(firstword, "iface") == 0) { |
738 | { | 742 | { |
@@ -871,6 +875,7 @@ static interfaces_file *read_interfaces(char *filename) | |||
871 | currif->n_options++; | 875 | currif->n_options++; |
872 | break; | 876 | break; |
873 | case MAPPING: | 877 | case MAPPING: |
878 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING | ||
874 | if (strcmp(firstword, "script") == 0) { | 879 | if (strcmp(firstword, "script") == 0) { |
875 | if (currmap->script != NULL) { | 880 | if (currmap->script != NULL) { |
876 | error_msg("%s:%d: duplicate script in mapping", filename, line); | 881 | error_msg("%s:%d: duplicate script in mapping", filename, line); |
@@ -889,6 +894,7 @@ static interfaces_file *read_interfaces(char *filename) | |||
889 | error_msg("%s:%d: misplaced option", filename, line); | 894 | error_msg("%s:%d: misplaced option", filename, line); |
890 | return NULL; | 895 | return NULL; |
891 | } | 896 | } |
897 | #endif | ||
892 | break; | 898 | break; |
893 | case NONE: | 899 | case NONE: |
894 | default: | 900 | default: |
@@ -1064,6 +1070,7 @@ static int iface_down(interface_defn *iface) | |||
1064 | return (1); | 1070 | return (1); |
1065 | } | 1071 | } |
1066 | 1072 | ||
1073 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING | ||
1067 | static int popen2(FILE **in, FILE **out, char *command, ...) | 1074 | static int popen2(FILE **in, FILE **out, char *command, ...) |
1068 | { | 1075 | { |
1069 | va_list ap; | 1076 | va_list ap; |
@@ -1145,7 +1152,7 @@ static int run_mapping(char *physical, char *logical, int len, mapping_defn * ma | |||
1145 | 1152 | ||
1146 | return 1; | 1153 | return 1; |
1147 | } | 1154 | } |
1148 | 1155 | #endif /* CONFIG_FEATURE_IFUPDOWN_IPV6 */ | |
1149 | 1156 | ||
1150 | static int lookfor_iface(char **ifaces, int n_ifaces, char *iface) | 1157 | static int lookfor_iface(char **ifaces, int n_ifaces, char *iface) |
1151 | { | 1158 | { |
@@ -1198,7 +1205,11 @@ extern int ifupdown_main(int argc, char **argv) | |||
1198 | cmds = iface_down; | 1205 | cmds = iface_down; |
1199 | } | 1206 | } |
1200 | 1207 | ||
1208 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING | ||
1201 | while ((i = getopt(argc, argv, "i:hvnamf")) != -1) { | 1209 | while ((i = getopt(argc, argv, "i:hvnamf")) != -1) { |
1210 | #else | ||
1211 | while ((i = getopt(argc, argv, "i:hvnaf")) != -1) { | ||
1212 | #endif | ||
1202 | switch (i) { | 1213 | switch (i) { |
1203 | case 'i': /* interfaces */ | 1214 | case 'i': /* interfaces */ |
1204 | interfaces = xstrdup(optarg); | 1215 | interfaces = xstrdup(optarg); |
@@ -1212,9 +1223,11 @@ extern int ifupdown_main(int argc, char **argv) | |||
1212 | case 'n': /* no-act */ | 1223 | case 'n': /* no-act */ |
1213 | no_act = 1; | 1224 | no_act = 1; |
1214 | break; | 1225 | break; |
1226 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING | ||
1215 | case 'm': /* no-mappings */ | 1227 | case 'm': /* no-mappings */ |
1216 | run_mappings = 0; | 1228 | run_mappings = 0; |
1217 | break; | 1229 | break; |
1230 | #endif | ||
1218 | case 'f': /* force */ | 1231 | case 'f': /* force */ |
1219 | force = 1; | 1232 | force = 1; |
1220 | break; | 1233 | break; |
@@ -1247,7 +1260,7 @@ extern int ifupdown_main(int argc, char **argv) | |||
1247 | if (state_fp != NULL) { | 1260 | if (state_fp != NULL) { |
1248 | char buf[80]; | 1261 | char buf[80]; |
1249 | char *p; | 1262 | char *p; |
1250 | 1263 | #if 0 | |
1251 | if (!no_act) { | 1264 | if (!no_act) { |
1252 | int flags; | 1265 | int flags; |
1253 | struct flock lock; | 1266 | struct flock lock; |
@@ -1267,7 +1280,7 @@ extern int ifupdown_main(int argc, char **argv) | |||
1267 | perror_msg_and_die("failed to lock statefile %s", statefile); | 1280 | perror_msg_and_die("failed to lock statefile %s", statefile); |
1268 | } | 1281 | } |
1269 | } | 1282 | } |
1270 | 1283 | #endif | |
1271 | rewind(state_fp); | 1284 | rewind(state_fp); |
1272 | while ((p = fgets(buf, sizeof buf, state_fp)) != NULL) { | 1285 | while ((p = fgets(buf, sizeof buf, state_fp)) != NULL) { |
1273 | char *pch; | 1286 | char *pch; |
@@ -1338,6 +1351,7 @@ extern int ifupdown_main(int argc, char **argv) | |||
1338 | liface[79] = 0; | 1351 | liface[79] = 0; |
1339 | } | 1352 | } |
1340 | } | 1353 | } |
1354 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING | ||
1341 | if ((cmds == iface_up) && run_mappings) { | 1355 | if ((cmds == iface_up) && run_mappings) { |
1342 | mapping_defn *currmap; | 1356 | mapping_defn *currmap; |
1343 | 1357 | ||
@@ -1354,6 +1368,7 @@ extern int ifupdown_main(int argc, char **argv) | |||
1354 | } | 1368 | } |
1355 | } | 1369 | } |
1356 | } | 1370 | } |
1371 | #endif | ||
1357 | 1372 | ||
1358 | for (currif = defn->ifaces; currif; currif = currif->next) { | 1373 | for (currif = defn->ifaces; currif; currif = currif->next) { |
1359 | if (strcmp(liface, currif->iface) == 0) { | 1374 | if (strcmp(liface, currif->iface) == 0) { |
@@ -1367,19 +1382,12 @@ extern int ifupdown_main(int argc, char **argv) | |||
1367 | error_msg("Configuring interface %s=%s (%s)", iface, liface, currif->address_family->name); | 1382 | error_msg("Configuring interface %s=%s (%s)", iface, liface, currif->address_family->name); |
1368 | } | 1383 | } |
1369 | 1384 | ||
1370 | switch (cmds(currif)) { | 1385 | if (cmds(currif) == -1) { |
1371 | case -1: | ||
1372 | printf | 1386 | printf |
1373 | ("Don't seem to be have all the variables for %s/%s.\n", | 1387 | ("Don't seem to be have all the variables for %s/%s.\n", |
1374 | liface, currif->address_family->name); | 1388 | liface, currif->address_family->name); |
1375 | break; | ||
1376 | case 0: | ||
1377 | /* this wasn't entirely successful, should it be added to | ||
1378 | * the state file? | ||
1379 | */ | ||
1380 | case 1: | ||
1381 | /* successful */ | ||
1382 | } | 1389 | } |
1390 | |||
1383 | currif->iface = oldiface; | 1391 | currif->iface = oldiface; |
1384 | } | 1392 | } |
1385 | } | 1393 | } |