diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-11-04 04:10:17 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-11-04 04:10:17 +0000 |
commit | bfc3d82256c45fb1e6e04ca85fac8a65b34b72a1 (patch) | |
tree | efe5bed86f389cec7e7e4f73b12b58783327e4b2 /networking/ifconfig.c | |
parent | 681023650e69f6e4fa959c5c6f0480d4a0edf906 (diff) | |
download | busybox-w32-bfc3d82256c45fb1e6e04ca85fac8a65b34b72a1.tar.gz busybox-w32-bfc3d82256c45fb1e6e04ca85fac8a65b34b72a1.tar.bz2 busybox-w32-bfc3d82256c45fb1e6e04ca85fac8a65b34b72a1.zip |
ifconfig: code shrink
adjtimex: code shrink
libbb: move nth_string function into libbb
hdparm: nth_string was here
text data bss dec hex filename
730013 10334 12032 752379 b7afb busybox_old
730093 10134 12032 752259 b7a83 busybox_unstripped
Diffstat (limited to 'networking/ifconfig.c')
-rw-r--r-- | networking/ifconfig.c | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/networking/ifconfig.c b/networking/ifconfig.c index 3dcb118ee..fff5f5d2e 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c | |||
@@ -164,7 +164,7 @@ struct in6_ifreq { | |||
164 | 164 | ||
165 | struct arg1opt { | 165 | struct arg1opt { |
166 | const char *name; | 166 | const char *name; |
167 | int selector; | 167 | unsigned short selector; |
168 | unsigned short ifr_offset; | 168 | unsigned short ifr_offset; |
169 | }; | 169 | }; |
170 | 170 | ||
@@ -183,70 +183,70 @@ struct options { | |||
183 | #define ifreq_offsetof(x) offsetof(struct ifreq, x) | 183 | #define ifreq_offsetof(x) offsetof(struct ifreq, x) |
184 | 184 | ||
185 | static const struct arg1opt Arg1Opt[] = { | 185 | static const struct arg1opt Arg1Opt[] = { |
186 | {"SIOCSIFMETRIC", SIOCSIFMETRIC, ifreq_offsetof(ifr_metric)}, | 186 | { "SIFMETRIC", SIOCSIFMETRIC, ifreq_offsetof(ifr_metric) }, |
187 | {"SIOCSIFMTU", SIOCSIFMTU, ifreq_offsetof(ifr_mtu)}, | 187 | { "SIFMTU", SIOCSIFMTU, ifreq_offsetof(ifr_mtu) }, |
188 | {"SIOCSIFTXQLEN", SIOCSIFTXQLEN, ifreq_offsetof(ifr_qlen)}, | 188 | { "SIFTXQLEN", SIOCSIFTXQLEN, ifreq_offsetof(ifr_qlen) }, |
189 | {"SIOCSIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr)}, | 189 | { "SIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr) }, |
190 | {"SIOCSIFNETMASK", SIOCSIFNETMASK, ifreq_offsetof(ifr_netmask)}, | 190 | { "SIFNETMASK", SIOCSIFNETMASK, ifreq_offsetof(ifr_netmask) }, |
191 | {"SIOCSIFBRDADDR", SIOCSIFBRDADDR, ifreq_offsetof(ifr_broadaddr)}, | 191 | { "SIFBRDADDR", SIOCSIFBRDADDR, ifreq_offsetof(ifr_broadaddr) }, |
192 | #if ENABLE_FEATURE_IFCONFIG_HW | 192 | #if ENABLE_FEATURE_IFCONFIG_HW |
193 | {"SIOCSIFHWADDR", SIOCSIFHWADDR, ifreq_offsetof(ifr_hwaddr)}, | 193 | { "SIFHWADDR", SIOCSIFHWADDR, ifreq_offsetof(ifr_hwaddr) }, |
194 | #endif | 194 | #endif |
195 | {"SIOCSIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr)}, | 195 | { "SIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr) }, |
196 | #ifdef SIOCSKEEPALIVE | 196 | #ifdef SIOCSKEEPALIVE |
197 | {"SIOCSKEEPALIVE", SIOCSKEEPALIVE, ifreq_offsetof(ifr_data)}, | 197 | { "SKEEPALIVE", SIOCSKEEPALIVE, ifreq_offsetof(ifr_data) }, |
198 | #endif | 198 | #endif |
199 | #ifdef SIOCSOUTFILL | 199 | #ifdef SIOCSOUTFILL |
200 | {"SIOCSOUTFILL", SIOCSOUTFILL, ifreq_offsetof(ifr_data)}, | 200 | { "SOUTFILL", SIOCSOUTFILL, ifreq_offsetof(ifr_data) }, |
201 | #endif | 201 | #endif |
202 | #if ENABLE_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ | 202 | #if ENABLE_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ |
203 | {"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.mem_start)}, | 203 | { "SIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.mem_start) }, |
204 | {"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.base_addr)}, | 204 | { "SIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.base_addr) }, |
205 | {"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.irq)}, | 205 | { "SIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.irq) }, |
206 | #endif | 206 | #endif |
207 | /* Last entry if for unmatched (possibly hostname) arg. */ | 207 | /* Last entry if for unmatched (possibly hostname) arg. */ |
208 | #if ENABLE_FEATURE_IPV6 | 208 | #if ENABLE_FEATURE_IPV6 |
209 | {"SIOCSIFADDR", SIOCSIFADDR, ifreq_offsetof(ifr_addr)}, /* IPv6 version ignores the offset */ | 209 | { "SIFADDR", SIOCSIFADDR, ifreq_offsetof(ifr_addr) }, /* IPv6 version ignores the offset */ |
210 | {"SIOCDIFADDR", SIOCDIFADDR, ifreq_offsetof(ifr_addr)}, /* IPv6 version ignores the offset */ | 210 | { "DIFADDR", SIOCDIFADDR, ifreq_offsetof(ifr_addr) }, /* IPv6 version ignores the offset */ |
211 | #endif | 211 | #endif |
212 | {"SIOCSIFADDR", SIOCSIFADDR, ifreq_offsetof(ifr_addr)}, | 212 | { "SIFADDR", SIOCSIFADDR, ifreq_offsetof(ifr_addr) }, |
213 | }; | 213 | }; |
214 | 214 | ||
215 | static const struct options OptArray[] = { | 215 | static const struct options OptArray[] = { |
216 | {"metric", N_ARG, ARG_METRIC, 0}, | 216 | { "metric", N_ARG, ARG_METRIC, 0 }, |
217 | {"mtu", N_ARG, ARG_MTU, 0}, | 217 | { "mtu", N_ARG, ARG_MTU, 0 }, |
218 | {"txqueuelen", N_ARG, ARG_TXQUEUELEN, 0}, | 218 | { "txqueuelen", N_ARG, ARG_TXQUEUELEN, 0 }, |
219 | {"dstaddr", N_ARG, ARG_DSTADDR, 0}, | 219 | { "dstaddr", N_ARG, ARG_DSTADDR, 0 }, |
220 | {"netmask", N_ARG, ARG_NETMASK, 0}, | 220 | { "netmask", N_ARG, ARG_NETMASK, 0 }, |
221 | {"broadcast", N_ARG | M_CLR, ARG_BROADCAST, IFF_BROADCAST}, | 221 | { "broadcast", N_ARG | M_CLR, ARG_BROADCAST, IFF_BROADCAST }, |
222 | #if ENABLE_FEATURE_IFCONFIG_HW | 222 | #if ENABLE_FEATURE_IFCONFIG_HW |
223 | {"hw", N_ARG, ARG_HW, 0}, | 223 | { "hw", N_ARG, ARG_HW, 0 }, |
224 | #endif | 224 | #endif |
225 | {"pointopoint", N_ARG | M_CLR, ARG_POINTOPOINT, IFF_POINTOPOINT}, | 225 | { "pointopoint", N_ARG | M_CLR, ARG_POINTOPOINT, IFF_POINTOPOINT }, |
226 | #ifdef SIOCSKEEPALIVE | 226 | #ifdef SIOCSKEEPALIVE |
227 | {"keepalive", N_ARG, ARG_KEEPALIVE, 0}, | 227 | { "keepalive", N_ARG, ARG_KEEPALIVE, 0 }, |
228 | #endif | 228 | #endif |
229 | #ifdef SIOCSOUTFILL | 229 | #ifdef SIOCSOUTFILL |
230 | {"outfill", N_ARG, ARG_OUTFILL, 0}, | 230 | { "outfill", N_ARG, ARG_OUTFILL, 0 }, |
231 | #endif | 231 | #endif |
232 | #if ENABLE_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ | 232 | #if ENABLE_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ |
233 | {"mem_start", N_ARG, ARG_MEM_START, 0}, | 233 | { "mem_start", N_ARG, ARG_MEM_START, 0 }, |
234 | {"io_addr", N_ARG, ARG_IO_ADDR, 0}, | 234 | { "io_addr", N_ARG, ARG_IO_ADDR, 0 }, |
235 | {"irq", N_ARG, ARG_IRQ, 0}, | 235 | { "irq", N_ARG, ARG_IRQ, 0 }, |
236 | #endif | 236 | #endif |
237 | #if ENABLE_FEATURE_IPV6 | 237 | #if ENABLE_FEATURE_IPV6 |
238 | {"add", N_ARG, ARG_ADD_DEL, 0}, | 238 | { "add", N_ARG, ARG_ADD_DEL, 0 }, |
239 | {"del", N_ARG, ARG_ADD_DEL, 0}, | 239 | { "del", N_ARG, ARG_ADD_DEL, 0 }, |
240 | #endif | 240 | #endif |
241 | {"arp", N_CLR | M_SET, 0, IFF_NOARP}, | 241 | { "arp", N_CLR | M_SET, 0, IFF_NOARP }, |
242 | {"trailers", N_CLR | M_SET, 0, IFF_NOTRAILERS}, | 242 | { "trailers", N_CLR | M_SET, 0, IFF_NOTRAILERS }, |
243 | {"promisc", N_SET | M_CLR, 0, IFF_PROMISC}, | 243 | { "promisc", N_SET | M_CLR, 0, IFF_PROMISC }, |
244 | {"multicast", N_SET | M_CLR, 0, IFF_MULTICAST}, | 244 | { "multicast", N_SET | M_CLR, 0, IFF_MULTICAST }, |
245 | {"allmulti", N_SET | M_CLR, 0, IFF_ALLMULTI}, | 245 | { "allmulti", N_SET | M_CLR, 0, IFF_ALLMULTI }, |
246 | {"dynamic", N_SET | M_CLR, 0, IFF_DYNAMIC}, | 246 | { "dynamic", N_SET | M_CLR, 0, IFF_DYNAMIC }, |
247 | {"up", N_SET, 0, (IFF_UP | IFF_RUNNING)}, | 247 | { "up", N_SET, 0, (IFF_UP | IFF_RUNNING) }, |
248 | {"down", N_CLR, 0, IFF_UP}, | 248 | { "down", N_CLR, 0, IFF_UP }, |
249 | {NULL, 0, ARG_HOSTNAME, (IFF_UP | IFF_RUNNING)} | 249 | { NULL, 0, ARG_HOSTNAME, (IFF_UP | IFF_RUNNING) } |
250 | }; | 250 | }; |
251 | 251 | ||
252 | /* | 252 | /* |
@@ -405,7 +405,7 @@ int ifconfig_main(int argc, char **argv) | |||
405 | xioctl(sockfd6, SIOGIFINDEX, &ifr); | 405 | xioctl(sockfd6, SIOGIFINDEX, &ifr); |
406 | ifr6.ifr6_ifindex = ifr.ifr_ifindex; | 406 | ifr6.ifr6_ifindex = ifr.ifr_ifindex; |
407 | ifr6.ifr6_prefixlen = prefix_len; | 407 | ifr6.ifr6_prefixlen = prefix_len; |
408 | ioctl_or_perror_and_die(sockfd6, a1op->selector, &ifr6, "%s", a1op->name); | 408 | ioctl_or_perror_and_die(sockfd6, a1op->selector, &ifr6, "SIOC%s", a1op->name); |
409 | if (ENABLE_FEATURE_CLEAN_UP) | 409 | if (ENABLE_FEATURE_CLEAN_UP) |
410 | free(lsa); | 410 | free(lsa); |
411 | continue; | 411 | continue; |
@@ -457,7 +457,7 @@ int ifconfig_main(int argc, char **argv) | |||
457 | *((int *) p) = i; | 457 | *((int *) p) = i; |
458 | } | 458 | } |
459 | 459 | ||
460 | ioctl_or_perror_and_die(sockfd, a1op->selector, &ifr, "%s", a1op->name); | 460 | ioctl_or_perror_and_die(sockfd, a1op->selector, &ifr, "SIOC%s", a1op->name); |
461 | #ifdef QUESTIONABLE_ALIAS_CASE | 461 | #ifdef QUESTIONABLE_ALIAS_CASE |
462 | if (mask & A_COLON_CHK) { | 462 | if (mask & A_COLON_CHK) { |
463 | /* | 463 | /* |