aboutsummaryrefslogtreecommitdiff
path: root/networking/interface.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-03-05 17:46:17 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-03-05 17:46:17 +0100
commit82ec89480d524a219ad027d1f7c5aa42cc6373d5 (patch)
treead36e295337e149aa170b0d241a0b441d828dd3e /networking/interface.c
parent8a5299fcfd54ae3b895b66249d6d105e956192cb (diff)
downloadbusybox-w32-82ec89480d524a219ad027d1f7c5aa42cc6373d5.tar.gz
busybox-w32-82ec89480d524a219ad027d1f7c5aa42cc6373d5.tar.bz2
busybox-w32-82ec89480d524a219ad027d1f7c5aa42cc6373d5.zip
networking/interface.c: get rid of global "smallint interface_opt_a"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/interface.c')
-rw-r--r--networking/interface.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/networking/interface.c b/networking/interface.c
index 0bbef9879..ff99c2981 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -342,8 +342,6 @@ struct interface {
342}; 342};
343 343
344 344
345smallint interface_opt_a; /* show all interfaces */
346
347static struct interface *int_list, *int_last; 345static struct interface *int_list, *int_last;
348 346
349 347
@@ -1086,13 +1084,13 @@ static void ife_print(struct interface *ptr)
1086 bb_putchar('\n'); 1084 bb_putchar('\n');
1087} 1085}
1088 1086
1089static int do_if_print(struct interface *ife) /*, int *opt_a)*/ 1087static int do_if_print(struct interface *ife, int show_downed_too)
1090{ 1088{
1091 int res; 1089 int res;
1092 1090
1093 res = do_if_fetch(ife); 1091 res = do_if_fetch(ife);
1094 if (res >= 0) { 1092 if (res >= 0) {
1095 if ((ife->flags & IFF_UP) || interface_opt_a) 1093 if ((ife->flags & IFF_UP) || show_downed_too)
1096 ife_print(ife); 1094 ife_print(ife);
1097 } 1095 }
1098 return res; 1096 return res;
@@ -1128,40 +1126,33 @@ static int for_all_interfaces(int (*doit) (struct interface *, void *),
1128} 1126}
1129#endif 1127#endif
1130 1128
1131/* for ipv4 add/del modes */ 1129int FAST_FUNC display_interfaces(char *ifname)
1132static int if_print(char *ifname)
1133{ 1130{
1134 struct interface *ife; 1131 struct interface *ife;
1135 int res; 1132 int res;
1136 1133
1137 if (!ifname) { 1134 if (!ifname || ifname == IFNAME_SHOW_DOWNED_TOO) {
1138 /*res = for_all_interfaces(do_if_print, &interface_opt_a);*/ 1135 /*res = for_all_interfaces(do_if_print, &interface_opt_a);*/
1139 if (!int_list) { 1136 if (!int_list) {
1140 int err = if_readlist(); 1137 res = if_readlist();
1141 if (err < 0) 1138 if (res < 0)
1142 return err; 1139 goto ret;
1143 } 1140 }
1144 for (ife = int_list; ife; ife = ife->next) { 1141 for (ife = int_list; ife; ife = ife->next) {
1145 int err = do_if_print(ife); /*, &interface_opt_a);*/ 1142 BUILD_BUG_ON((int)(intptr_t)IFNAME_SHOW_DOWNED_TOO != 1);
1146 if (err) 1143 res = do_if_print(ife, (int)(intptr_t)ifname);
1147 return err; 1144 if (res < 0)
1145 goto ret;
1148 } 1146 }
1149 return 0; 1147 return 0;
1150 } 1148 }
1149
1151 ife = lookup_interface(ifname); 1150 ife = lookup_interface(ifname);
1152 res = do_if_fetch(ife); 1151 res = do_if_fetch(ife);
1153 if (res >= 0) 1152 if (res >= 0)
1154 ife_print(ife); 1153 ife_print(ife);
1155 return res; 1154 ret:
1156} 1155 return (res < 0); /* status < 0 == 1 -- error */
1157
1158int FAST_FUNC display_interfaces(char *ifname)
1159{
1160 int status;
1161
1162 status = if_print(ifname);
1163
1164 return (status < 0); /* status < 0 == 1 -- error */
1165} 1156}
1166 1157
1167#if ENABLE_FEATURE_HWIB 1158#if ENABLE_FEATURE_HWIB