diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2002-12-07 07:45:42 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2002-12-07 07:45:42 +0000 |
commit | 0325a1c9e3ef37017d4eeac7f61300a28fe4dc5b (patch) | |
tree | 14c3a2670eb19c882ade6c68a60b3320d87fc772 /networking/ifupdown.c | |
parent | 1d658263e8d0ad30ee15f028bc267170353b3599 (diff) | |
download | busybox-w32-0325a1c9e3ef37017d4eeac7f61300a28fe4dc5b.tar.gz busybox-w32-0325a1c9e3ef37017d4eeac7f61300a28fe4dc5b.tar.bz2 busybox-w32-0325a1c9e3ef37017d4eeac7f61300a28fe4dc5b.zip |
Differentiate struct and type names
Diffstat (limited to 'networking/ifupdown.c')
-rw-r--r-- | networking/ifupdown.c | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 301ef67a3..3e18df19e 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -44,25 +44,25 @@ | |||
44 | 44 | ||
45 | #define IFUPDOWN_VERSION "0.6.4" | 45 | #define IFUPDOWN_VERSION "0.6.4" |
46 | 46 | ||
47 | typedef struct interface_defn interface_defn; | 47 | typedef struct interface_defn_s interface_defn_t; |
48 | 48 | ||
49 | typedef int (execfn)(char *command); | 49 | typedef int (execfn)(char *command); |
50 | typedef int (command_set)(interface_defn *ifd, execfn *e); | 50 | typedef int (command_set)(interface_defn_t *ifd, execfn *e); |
51 | 51 | ||
52 | typedef struct method { | 52 | typedef struct method_s { |
53 | char *name; | 53 | char *name; |
54 | command_set *up; | 54 | command_set *up; |
55 | command_set *down; | 55 | command_set *down; |
56 | } method; | 56 | } method_t; |
57 | 57 | ||
58 | typedef struct address_family { | 58 | typedef struct address_family_s { |
59 | char *name; | 59 | char *name; |
60 | int n_methods; | 60 | int n_methods; |
61 | method *method; | 61 | method_t *method; |
62 | } address_family; | 62 | } address_family_t; |
63 | 63 | ||
64 | typedef struct mapping_defn { | 64 | typedef struct mapping_defn_s { |
65 | struct mapping_defn *next; | 65 | struct mapping_defn_s *next; |
66 | 66 | ||
67 | int max_matches; | 67 | int max_matches; |
68 | int n_matches; | 68 | int n_matches; |
@@ -73,35 +73,35 @@ typedef struct mapping_defn { | |||
73 | int max_mappings; | 73 | int max_mappings; |
74 | int n_mappings; | 74 | int n_mappings; |
75 | char **mapping; | 75 | char **mapping; |
76 | } mapping_defn; | 76 | } mapping_defn_t; |
77 | 77 | ||
78 | typedef struct variable { | 78 | typedef struct variable_s { |
79 | char *name; | 79 | char *name; |
80 | char *value; | 80 | char *value; |
81 | } variable; | 81 | } variable_t; |
82 | 82 | ||
83 | struct interface_defn { | 83 | struct interface_defn_s { |
84 | struct interface_defn *next; | 84 | struct interface_defn_s *next; |
85 | 85 | ||
86 | char *iface; | 86 | char *iface; |
87 | address_family *address_family; | 87 | address_family_t *address_family; |
88 | method *method; | 88 | method_t *method; |
89 | 89 | ||
90 | int automatic; | 90 | int automatic; |
91 | 91 | ||
92 | int max_options; | 92 | int max_options; |
93 | int n_options; | 93 | int n_options; |
94 | variable *option; | 94 | variable_t *option; |
95 | }; | 95 | }; |
96 | 96 | ||
97 | typedef struct interfaces_file { | 97 | typedef struct interfaces_file_s { |
98 | int max_autointerfaces; | 98 | int max_autointerfaces; |
99 | int n_autointerfaces; | 99 | int n_autointerfaces; |
100 | char **autointerfaces; | 100 | char **autointerfaces; |
101 | 101 | ||
102 | interface_defn *ifaces; | 102 | interface_defn_t *ifaces; |
103 | mapping_defn *mappings; | 103 | mapping_defn_t *mappings; |
104 | } interfaces_file; | 104 | } interfaces_file_t; |
105 | 105 | ||
106 | #define MAX_OPT_DEPTH 10 | 106 | #define MAX_OPT_DEPTH 10 |
107 | #define EUNBALBRACK 10001 | 107 | #define EUNBALBRACK 10001 |
@@ -141,7 +141,7 @@ static int strncmpz(char *l, char *r, size_t llen) | |||
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | static char *get_var(char *id, size_t idlen, interface_defn *ifd) | 144 | static char *get_var(char *id, size_t idlen, interface_defn_t *ifd) |
145 | { | 145 | { |
146 | int i; | 146 | int i; |
147 | 147 | ||
@@ -158,7 +158,7 @@ static char *get_var(char *id, size_t idlen, interface_defn *ifd) | |||
158 | return(NULL); | 158 | return(NULL); |
159 | } | 159 | } |
160 | 160 | ||
161 | static char *parse(char *command, interface_defn *ifd) | 161 | static char *parse(char *command, interface_defn_t *ifd) |
162 | { | 162 | { |
163 | 163 | ||
164 | char *result = NULL; | 164 | char *result = NULL; |
@@ -249,7 +249,7 @@ static char *parse(char *command, interface_defn *ifd) | |||
249 | return(result); | 249 | return(result); |
250 | } | 250 | } |
251 | 251 | ||
252 | static int execute(char *command, interface_defn *ifd, execfn *exec) | 252 | static int execute(char *command, interface_defn_t *ifd, execfn *exec) |
253 | { | 253 | { |
254 | char *out; | 254 | char *out; |
255 | int ret; | 255 | int ret; |
@@ -266,7 +266,7 @@ static int execute(char *command, interface_defn *ifd, execfn *exec) | |||
266 | } | 266 | } |
267 | 267 | ||
268 | #ifdef CONFIG_FEATURE_IFUPDOWN_IPX | 268 | #ifdef CONFIG_FEATURE_IFUPDOWN_IPX |
269 | static int static_up_ipx(interface_defn *ifd, execfn *exec) | 269 | static int static_up_ipx(interface_defn_t *ifd, execfn *exec) |
270 | { | 270 | { |
271 | if (!execute("ipx_interface add %iface% %frame% %netnum%", ifd, exec)) { | 271 | if (!execute("ipx_interface add %iface% %frame% %netnum%", ifd, exec)) { |
272 | return(0); | 272 | return(0); |
@@ -274,7 +274,7 @@ static int static_up_ipx(interface_defn *ifd, execfn *exec) | |||
274 | return(1); | 274 | return(1); |
275 | } | 275 | } |
276 | 276 | ||
277 | static int static_down_ipx(interface_defn *ifd, execfn *exec) | 277 | static int static_down_ipx(interface_defn_t *ifd, execfn *exec) |
278 | { | 278 | { |
279 | if (!execute("ipx_interface del %iface% %frame%", ifd, exec)) { | 279 | if (!execute("ipx_interface del %iface% %frame%", ifd, exec)) { |
280 | return(0); | 280 | return(0); |
@@ -282,7 +282,7 @@ static int static_down_ipx(interface_defn *ifd, execfn *exec) | |||
282 | return(1); | 282 | return(1); |
283 | } | 283 | } |
284 | 284 | ||
285 | static int dynamic_up(interface_defn *ifd, execfn *exec) | 285 | static int dynamic_up(interface_defn_t *ifd, execfn *exec) |
286 | { | 286 | { |
287 | if (!execute("ipx_interface add %iface% %frame%", ifd, exec)) { | 287 | if (!execute("ipx_interface add %iface% %frame%", ifd, exec)) { |
288 | return(0); | 288 | return(0); |
@@ -290,7 +290,7 @@ static int dynamic_up(interface_defn *ifd, execfn *exec) | |||
290 | return(1); | 290 | return(1); |
291 | } | 291 | } |
292 | 292 | ||
293 | static int dynamic_down(interface_defn *ifd, execfn *exec) | 293 | static int dynamic_down(interface_defn_t *ifd, execfn *exec) |
294 | { | 294 | { |
295 | if (!execute("ipx_interface del %iface% %frame%", ifd, exec)) { | 295 | if (!execute("ipx_interface del %iface% %frame%", ifd, exec)) { |
296 | return(0); | 296 | return(0); |
@@ -298,20 +298,20 @@ static int dynamic_down(interface_defn *ifd, execfn *exec) | |||
298 | return(1); | 298 | return(1); |
299 | } | 299 | } |
300 | 300 | ||
301 | static method methods_ipx[] = { | 301 | static method_t methods_ipx[] = { |
302 | { "dynamic", dynamic_up, dynamic_down, }, | 302 | { "dynamic", dynamic_up, dynamic_down, }, |
303 | { "static", static_up_ipx, static_down_ipx, }, | 303 | { "static", static_up_ipx, static_down_ipx, }, |
304 | }; | 304 | }; |
305 | 305 | ||
306 | address_family addr_ipx = { | 306 | address_family_t addr_ipx = { |
307 | "ipx", | 307 | "ipx", |
308 | sizeof(methods_ipx) / sizeof(struct method), | 308 | sizeof(methods_ipx) / sizeof(method_t), |
309 | methods_ipx | 309 | methods_ipx |
310 | }; | 310 | }; |
311 | #endif /* IFUP_FEATURE_IPX */ | 311 | #endif /* IFUP_FEATURE_IPX */ |
312 | 312 | ||
313 | #ifdef CONFIG_FEATURE_IFUPDOWN_IPV6 | 313 | #ifdef CONFIG_FEATURE_IFUPDOWN_IPV6 |
314 | static int loopback_up6(interface_defn *ifd, execfn *exec) | 314 | static int loopback_up6(interface_defn_t *ifd, execfn *exec) |
315 | { | 315 | { |
316 | if (!execute("ifconfig %iface% add ::1", ifd, exec)) { | 316 | if (!execute("ifconfig %iface% add ::1", ifd, exec)) { |
317 | return(0); | 317 | return(0); |
@@ -319,7 +319,7 @@ static int loopback_up6(interface_defn *ifd, execfn *exec) | |||
319 | return(1); | 319 | return(1); |
320 | } | 320 | } |
321 | 321 | ||
322 | static int loopback_down6(interface_defn *ifd, execfn *exec) | 322 | static int loopback_down6(interface_defn_t *ifd, execfn *exec) |
323 | { | 323 | { |
324 | if (!execute("ifconfig %iface% del ::1", ifd, exec)) { | 324 | if (!execute("ifconfig %iface% del ::1", ifd, exec)) { |
325 | return(0); | 325 | return(0); |
@@ -327,7 +327,7 @@ static int loopback_down6(interface_defn *ifd, execfn *exec) | |||
327 | return(1); | 327 | return(1); |
328 | } | 328 | } |
329 | 329 | ||
330 | static int static_up6(interface_defn *ifd, execfn *exec) | 330 | static int static_up6(interface_defn_t *ifd, execfn *exec) |
331 | { | 331 | { |
332 | if (!execute("ifconfig %iface% [[media %media%]] [[hw %hwaddress%]] [[mtu %mtu%]] up", ifd, exec)) { | 332 | if (!execute("ifconfig %iface% [[media %media%]] [[hw %hwaddress%]] [[mtu %mtu%]] up", ifd, exec)) { |
333 | return(0); | 333 | return(0); |
@@ -341,7 +341,7 @@ static int static_up6(interface_defn *ifd, execfn *exec) | |||
341 | return(1); | 341 | return(1); |
342 | } | 342 | } |
343 | 343 | ||
344 | static int static_down6(interface_defn *ifd, execfn *exec) | 344 | static int static_down6(interface_defn_t *ifd, execfn *exec) |
345 | { | 345 | { |
346 | if (!execute("ifconfig %iface% down", ifd, exec)) { | 346 | if (!execute("ifconfig %iface% down", ifd, exec)) { |
347 | return(0); | 347 | return(0); |
@@ -349,7 +349,7 @@ static int static_down6(interface_defn *ifd, execfn *exec) | |||
349 | return(1); | 349 | return(1); |
350 | } | 350 | } |
351 | 351 | ||
352 | static int v4tunnel_up(interface_defn *ifd, execfn *exec) | 352 | static int v4tunnel_up(interface_defn_t *ifd, execfn *exec) |
353 | { | 353 | { |
354 | if (!execute("ip tunnel add %iface% mode sit remote %endpoint% [[local %local%]] [[ttl %ttl%]]", ifd, exec)) { | 354 | if (!execute("ip tunnel add %iface% mode sit remote %endpoint% [[local %local%]] [[ttl %ttl%]]", ifd, exec)) { |
355 | return(0); | 355 | return(0); |
@@ -366,7 +366,7 @@ static int v4tunnel_up(interface_defn *ifd, execfn *exec) | |||
366 | return(1); | 366 | return(1); |
367 | } | 367 | } |
368 | 368 | ||
369 | static int v4tunnel_down(interface_defn * ifd, execfn * exec) | 369 | static int v4tunnel_down(interface_defn_t * ifd, execfn * exec) |
370 | { | 370 | { |
371 | if (!execute("ip tunnel del %iface%", ifd, exec)) { | 371 | if (!execute("ip tunnel del %iface%", ifd, exec)) { |
372 | return(0); | 372 | return(0); |
@@ -374,21 +374,21 @@ static int v4tunnel_down(interface_defn * ifd, execfn * exec) | |||
374 | return(1); | 374 | return(1); |
375 | } | 375 | } |
376 | 376 | ||
377 | static method methods6[] = { | 377 | static method_t methods6[] = { |
378 | { "v4tunnel", v4tunnel_up, v4tunnel_down, }, | 378 | { "v4tunnel", v4tunnel_up, v4tunnel_down, }, |
379 | { "static", static_up6, static_down6, }, | 379 | { "static", static_up6, static_down6, }, |
380 | { "loopback", loopback_up6, loopback_down6, }, | 380 | { "loopback", loopback_up6, loopback_down6, }, |
381 | }; | 381 | }; |
382 | 382 | ||
383 | address_family addr_inet6 = { | 383 | address_family_t addr_inet6 = { |
384 | "inet6", | 384 | "inet6", |
385 | sizeof(methods6) / sizeof(struct method), | 385 | sizeof(methods6) / sizeof(method_t), |
386 | methods6 | 386 | methods6 |
387 | }; | 387 | }; |
388 | #endif /* CONFIG_FEATURE_IFUPDOWN_IPV6 */ | 388 | #endif /* CONFIG_FEATURE_IFUPDOWN_IPV6 */ |
389 | 389 | ||
390 | #ifdef CONFIG_FEATURE_IFUPDOWN_IPV4 | 390 | #ifdef CONFIG_FEATURE_IFUPDOWN_IPV4 |
391 | static int loopback_up(interface_defn *ifd, execfn *exec) | 391 | static int loopback_up(interface_defn_t *ifd, execfn *exec) |
392 | { | 392 | { |
393 | if (!execute("ifconfig %iface% 127.0.0.1 up", ifd, exec)) { | 393 | if (!execute("ifconfig %iface% 127.0.0.1 up", ifd, exec)) { |
394 | return(0); | 394 | return(0); |
@@ -396,7 +396,7 @@ static int loopback_up(interface_defn *ifd, execfn *exec) | |||
396 | return(1); | 396 | return(1); |
397 | } | 397 | } |
398 | 398 | ||
399 | static int loopback_down(interface_defn *ifd, execfn *exec) | 399 | static int loopback_down(interface_defn_t *ifd, execfn *exec) |
400 | { | 400 | { |
401 | if (!execute("ifconfig %iface% 127.0.0.1 down", ifd, exec)) { | 401 | if (!execute("ifconfig %iface% 127.0.0.1 down", ifd, exec)) { |
402 | return(0); | 402 | return(0); |
@@ -404,7 +404,7 @@ static int loopback_down(interface_defn *ifd, execfn *exec) | |||
404 | return(1); | 404 | return(1); |
405 | } | 405 | } |
406 | 406 | ||
407 | static int static_up(interface_defn *ifd, execfn *exec) | 407 | static int static_up(interface_defn_t *ifd, execfn *exec) |
408 | { | 408 | { |
409 | if (!execute("ifconfig %iface% %address% netmask %netmask% [[broadcast %broadcast%]] [[pointopoint %pointopoint%]] [[media %media%]] [[mtu %mtu%]] [[hw %hwaddress%]] up", | 409 | if (!execute("ifconfig %iface% %address% netmask %netmask% [[broadcast %broadcast%]] [[pointopoint %pointopoint%]] [[media %media%]] [[mtu %mtu%]] [[hw %hwaddress%]] up", |
410 | ifd, exec)) { | 410 | ifd, exec)) { |
@@ -416,7 +416,7 @@ static int static_up(interface_defn *ifd, execfn *exec) | |||
416 | return(1); | 416 | return(1); |
417 | } | 417 | } |
418 | 418 | ||
419 | static int static_down(interface_defn *ifd, execfn *exec) | 419 | static int static_down(interface_defn_t *ifd, execfn *exec) |
420 | { | 420 | { |
421 | if (!execute("[[ route del default gw %gateway% %iface% ]]", ifd, exec)) { | 421 | if (!execute("[[ route del default gw %gateway% %iface% ]]", ifd, exec)) { |
422 | return(0); | 422 | return(0); |
@@ -438,7 +438,7 @@ static int execable(char *program) | |||
438 | return(0); | 438 | return(0); |
439 | } | 439 | } |
440 | 440 | ||
441 | static int dhcp_up(interface_defn *ifd, execfn *exec) | 441 | static int dhcp_up(interface_defn_t *ifd, execfn *exec) |
442 | { | 442 | { |
443 | if (execable("/sbin/dhclient")) { | 443 | if (execable("/sbin/dhclient")) { |
444 | if (!execute("dhclient -pf /var/run/dhclient.%iface%.pid %iface%", ifd, exec)) { | 444 | if (!execute("dhclient -pf /var/run/dhclient.%iface%.pid %iface%", ifd, exec)) { |
@@ -460,7 +460,7 @@ static int dhcp_up(interface_defn *ifd, execfn *exec) | |||
460 | return(1); | 460 | return(1); |
461 | } | 461 | } |
462 | 462 | ||
463 | static int dhcp_down(interface_defn *ifd, execfn *exec) | 463 | static int dhcp_down(interface_defn_t *ifd, execfn *exec) |
464 | { | 464 | { |
465 | if (execable("/sbin/dhclient")) { | 465 | if (execable("/sbin/dhclient")) { |
466 | if (!execute("kill -9 `cat /var/run/udhcpc.%iface%.pid`", ifd, exec)) { | 466 | if (!execute("kill -9 `cat /var/run/udhcpc.%iface%.pid`", ifd, exec)) { |
@@ -485,7 +485,7 @@ static int dhcp_down(interface_defn *ifd, execfn *exec) | |||
485 | return(1); | 485 | return(1); |
486 | } | 486 | } |
487 | 487 | ||
488 | static int bootp_up(interface_defn *ifd, execfn *exec) | 488 | static int bootp_up(interface_defn_t *ifd, execfn *exec) |
489 | { | 489 | { |
490 | if (!execute("bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] [[--hwaddr %hwaddr%]] --returniffail --serverbcast", ifd, exec)) { | 490 | if (!execute("bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] [[--hwaddr %hwaddr%]] --returniffail --serverbcast", ifd, exec)) { |
491 | return 0; | 491 | return 0; |
@@ -493,7 +493,7 @@ static int bootp_up(interface_defn *ifd, execfn *exec) | |||
493 | return 1; | 493 | return 1; |
494 | } | 494 | } |
495 | 495 | ||
496 | static int bootp_down(interface_defn *ifd, execfn *exec) | 496 | static int bootp_down(interface_defn_t *ifd, execfn *exec) |
497 | { | 497 | { |
498 | if (!execute("ifconfig down %iface%", ifd, exec)) { | 498 | if (!execute("ifconfig down %iface%", ifd, exec)) { |
499 | return 0; | 499 | return 0; |
@@ -501,7 +501,7 @@ static int bootp_down(interface_defn *ifd, execfn *exec) | |||
501 | return 1; | 501 | return 1; |
502 | } | 502 | } |
503 | 503 | ||
504 | static int ppp_up(interface_defn *ifd, execfn *exec) | 504 | static int ppp_up(interface_defn_t *ifd, execfn *exec) |
505 | { | 505 | { |
506 | if (!execute("pon [[%provider%]]", ifd, exec)) { | 506 | if (!execute("pon [[%provider%]]", ifd, exec)) { |
507 | return 0; | 507 | return 0; |
@@ -509,7 +509,7 @@ static int ppp_up(interface_defn *ifd, execfn *exec) | |||
509 | return 1; | 509 | return 1; |
510 | } | 510 | } |
511 | 511 | ||
512 | static int ppp_down(interface_defn *ifd, execfn *exec) | 512 | static int ppp_down(interface_defn_t *ifd, execfn *exec) |
513 | { | 513 | { |
514 | if (!execute("poff [[%provider%]]", ifd, exec)) { | 514 | if (!execute("poff [[%provider%]]", ifd, exec)) { |
515 | return 0; | 515 | return 0; |
@@ -517,7 +517,7 @@ static int ppp_down(interface_defn *ifd, execfn *exec) | |||
517 | return 1; | 517 | return 1; |
518 | } | 518 | } |
519 | 519 | ||
520 | static int wvdial_up(interface_defn *ifd, execfn *exec) | 520 | static int wvdial_up(interface_defn_t *ifd, execfn *exec) |
521 | { | 521 | { |
522 | if (!execute("/sbin/start-stop-daemon --start -x /usr/bin/wvdial -p /var/run/wvdial.%iface% -b -m -- [[ %provider% ]]", ifd, exec)) { | 522 | if (!execute("/sbin/start-stop-daemon --start -x /usr/bin/wvdial -p /var/run/wvdial.%iface% -b -m -- [[ %provider% ]]", ifd, exec)) { |
523 | return 0; | 523 | return 0; |
@@ -525,7 +525,7 @@ static int wvdial_up(interface_defn *ifd, execfn *exec) | |||
525 | return 1; | 525 | return 1; |
526 | } | 526 | } |
527 | 527 | ||
528 | static int wvdial_down(interface_defn *ifd, execfn *exec) | 528 | static int wvdial_down(interface_defn_t *ifd, execfn *exec) |
529 | { | 529 | { |
530 | if (!execute ("/sbin/start-stop-daemon --stop -x /usr/bin/wvdial -p /var/run/wvdial.%iface% -s 2", ifd, exec)) { | 530 | if (!execute ("/sbin/start-stop-daemon --stop -x /usr/bin/wvdial -p /var/run/wvdial.%iface% -s 2", ifd, exec)) { |
531 | return 0; | 531 | return 0; |
@@ -533,7 +533,7 @@ static int wvdial_down(interface_defn *ifd, execfn *exec) | |||
533 | return 1; | 533 | return 1; |
534 | } | 534 | } |
535 | 535 | ||
536 | static method methods[] = { | 536 | static method_t methods[] = { |
537 | { "wvdial", wvdial_up, wvdial_down, }, | 537 | { "wvdial", wvdial_up, wvdial_down, }, |
538 | { "ppp", ppp_up, ppp_down, }, | 538 | { "ppp", ppp_up, ppp_down, }, |
539 | { "static", static_up, static_down, }, | 539 | { "static", static_up, static_down, }, |
@@ -542,9 +542,9 @@ static method methods[] = { | |||
542 | { "loopback", loopback_up, loopback_down, }, | 542 | { "loopback", loopback_up, loopback_down, }, |
543 | }; | 543 | }; |
544 | 544 | ||
545 | address_family addr_inet = { | 545 | address_family_t addr_inet = { |
546 | "inet", | 546 | "inet", |
547 | sizeof(methods) / sizeof(struct method), | 547 | sizeof(methods) / sizeof(method_t), |
548 | methods | 548 | methods |
549 | }; | 549 | }; |
550 | 550 | ||
@@ -573,7 +573,7 @@ static char *next_word(char *buf, char *word, int maxlen) | |||
573 | return buf; | 573 | return buf; |
574 | } | 574 | } |
575 | 575 | ||
576 | static address_family *get_address_family(address_family *af[], char *name) | 576 | static address_family_t *get_address_family(address_family_t *af[], char *name) |
577 | { | 577 | { |
578 | int i; | 578 | int i; |
579 | 579 | ||
@@ -585,7 +585,7 @@ static address_family *get_address_family(address_family *af[], char *name) | |||
585 | return NULL; | 585 | return NULL; |
586 | } | 586 | } |
587 | 587 | ||
588 | static method *get_method(address_family *af, char *name) | 588 | static method_t *get_method(address_family_t *af, char *name) |
589 | { | 589 | { |
590 | int i; | 590 | int i; |
591 | 591 | ||
@@ -597,7 +597,7 @@ static method *get_method(address_family *af, char *name) | |||
597 | return(NULL); | 597 | return(NULL); |
598 | } | 598 | } |
599 | 599 | ||
600 | static int duplicate_if(interface_defn *ifa, interface_defn *ifb) | 600 | static int duplicate_if(interface_defn_t *ifa, interface_defn_t *ifb) |
601 | { | 601 | { |
602 | if (strcmp(ifa->iface, ifb->iface) != 0) { | 602 | if (strcmp(ifa->iface, ifb->iface) != 0) { |
603 | return(0); | 603 | return(0); |
@@ -608,12 +608,12 @@ static int duplicate_if(interface_defn *ifa, interface_defn *ifb) | |||
608 | return(1); | 608 | return(1); |
609 | } | 609 | } |
610 | 610 | ||
611 | static interfaces_file *read_interfaces(char *filename) | 611 | static interfaces_file_t *read_interfaces(char *filename) |
612 | { | 612 | { |
613 | interface_defn *currif = NULL; | 613 | interface_defn_t *currif = NULL; |
614 | interfaces_file *defn; | 614 | interfaces_file_t *defn; |
615 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING | 615 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING |
616 | mapping_defn *currmap = NULL; | 616 | mapping_defn_t *currmap = NULL; |
617 | #endif | 617 | #endif |
618 | FILE *f; | 618 | FILE *f; |
619 | char firstword[80]; | 619 | char firstword[80]; |
@@ -623,7 +623,7 @@ static interfaces_file *read_interfaces(char *filename) | |||
623 | 623 | ||
624 | enum { NONE, IFACE, MAPPING } currently_processing = NONE; | 624 | enum { NONE, IFACE, MAPPING } currently_processing = NONE; |
625 | 625 | ||
626 | defn = xmalloc(sizeof(interfaces_file)); | 626 | defn = xmalloc(sizeof(interfaces_file_t)); |
627 | defn->max_autointerfaces = defn->n_autointerfaces = 0; | 627 | defn->max_autointerfaces = defn->n_autointerfaces = 0; |
628 | defn->autointerfaces = NULL; | 628 | defn->autointerfaces = NULL; |
629 | defn->mappings = NULL; | 629 | defn->mappings = NULL; |
@@ -653,7 +653,7 @@ static interfaces_file *read_interfaces(char *filename) | |||
653 | 653 | ||
654 | if (strcmp(firstword, "mapping") == 0) { | 654 | if (strcmp(firstword, "mapping") == 0) { |
655 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING | 655 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING |
656 | currmap = xmalloc(sizeof(mapping_defn)); | 656 | currmap = xmalloc(sizeof(mapping_defn_t)); |
657 | currmap->max_matches = 0; | 657 | currmap->max_matches = 0; |
658 | currmap->n_matches = 0; | 658 | currmap->n_matches = 0; |
659 | currmap->match = NULL; | 659 | currmap->match = NULL; |
@@ -671,7 +671,7 @@ static interfaces_file *read_interfaces(char *filename) | |||
671 | currmap->mapping = NULL; | 671 | currmap->mapping = NULL; |
672 | currmap->script = NULL; | 672 | currmap->script = NULL; |
673 | { | 673 | { |
674 | mapping_defn **where = &defn->mappings; | 674 | mapping_defn_t **where = &defn->mappings; |
675 | while (*where != NULL) { | 675 | while (*where != NULL) { |
676 | where = &(*where)->next; | 676 | where = &(*where)->next; |
677 | } | 677 | } |
@@ -685,7 +685,7 @@ static interfaces_file *read_interfaces(char *filename) | |||
685 | char iface_name[80]; | 685 | char iface_name[80]; |
686 | char address_family_name[80]; | 686 | char address_family_name[80]; |
687 | char method_name[80]; | 687 | char method_name[80]; |
688 | address_family *addr_fams[] = { | 688 | address_family_t *addr_fams[] = { |
689 | #ifdef CONFIG_FEATURE_IFUPDOWN_IPV4 | 689 | #ifdef CONFIG_FEATURE_IFUPDOWN_IPV4 |
690 | &addr_inet, | 690 | &addr_inet, |
691 | #endif | 691 | #endif |
@@ -698,7 +698,7 @@ static interfaces_file *read_interfaces(char *filename) | |||
698 | NULL | 698 | NULL |
699 | }; | 699 | }; |
700 | 700 | ||
701 | currif = xmalloc(sizeof(interface_defn)); | 701 | currif = xmalloc(sizeof(interface_defn_t)); |
702 | 702 | ||
703 | rest = next_word(rest, iface_name, 80); | 703 | rest = next_word(rest, iface_name, 80); |
704 | rest = next_word(rest, address_family_name, 80); | 704 | rest = next_word(rest, address_family_name, 80); |
@@ -735,7 +735,7 @@ static interfaces_file *read_interfaces(char *filename) | |||
735 | 735 | ||
736 | 736 | ||
737 | { | 737 | { |
738 | interface_defn **where = &defn->ifaces; | 738 | interface_defn_t **where = &defn->ifaces; |
739 | 739 | ||
740 | while (*where != NULL) { | 740 | while (*where != NULL) { |
741 | if (duplicate_if(*where, currif)) { | 741 | if (duplicate_if(*where, currif)) { |
@@ -798,7 +798,7 @@ static interfaces_file *read_interfaces(char *filename) | |||
798 | } | 798 | } |
799 | } | 799 | } |
800 | if (currif->n_options >= currif->max_options) { | 800 | if (currif->n_options >= currif->max_options) { |
801 | variable *opt; | 801 | variable_t *opt; |
802 | 802 | ||
803 | currif->max_options = currif->max_options + 10; | 803 | currif->max_options = currif->max_options + 10; |
804 | opt = xrealloc(currif->option, sizeof(*opt) * currif->max_options); | 804 | opt = xrealloc(currif->option, sizeof(*opt) * currif->max_options); |
@@ -885,7 +885,7 @@ static char *setlocalenv(char *format, char *name, char *value) | |||
885 | return result; | 885 | return result; |
886 | } | 886 | } |
887 | 887 | ||
888 | static void set_environ(interface_defn *iface, char *mode) | 888 | static void set_environ(interface_defn_t *iface, char *mode) |
889 | { | 889 | { |
890 | char **environend; | 890 | char **environend; |
891 | int i; | 891 | int i; |
@@ -953,7 +953,7 @@ static int doit(char *str) | |||
953 | return (1); | 953 | return (1); |
954 | } | 954 | } |
955 | 955 | ||
956 | static int execute_all(interface_defn *ifd, execfn *exec, const char *opt) | 956 | static int execute_all(interface_defn_t *ifd, execfn *exec, const char *opt) |
957 | { | 957 | { |
958 | int i; | 958 | int i; |
959 | char *buf; | 959 | char *buf; |
@@ -973,7 +973,7 @@ static int execute_all(interface_defn *ifd, execfn *exec, const char *opt) | |||
973 | return (1); | 973 | return (1); |
974 | } | 974 | } |
975 | 975 | ||
976 | static int iface_up(interface_defn *iface) | 976 | static int iface_up(interface_defn_t *iface) |
977 | { | 977 | { |
978 | if (!iface->method->up(iface, check)) { | 978 | if (!iface->method->up(iface, check)) { |
979 | return (-1); | 979 | return (-1); |
@@ -993,7 +993,7 @@ static int iface_up(interface_defn *iface) | |||
993 | return (1); | 993 | return (1); |
994 | } | 994 | } |
995 | 995 | ||
996 | static int iface_down(interface_defn *iface) | 996 | static int iface_down(interface_defn_t *iface) |
997 | { | 997 | { |
998 | if (!iface->method->down(iface, check)) { | 998 | if (!iface->method->down(iface, check)) { |
999 | return (-1); | 999 | return (-1); |
@@ -1065,7 +1065,7 @@ static int popen2(FILE **in, FILE **out, char *command, ...) | |||
1065 | /* unreached */ | 1065 | /* unreached */ |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | static int run_mapping(char *physical, char *logical, int len, mapping_defn * map) | 1068 | static int run_mapping(char *physical, char *logical, int len, mapping_defn_t * map) |
1069 | { | 1069 | { |
1070 | FILE *in, *out; | 1070 | FILE *in, *out; |
1071 | int i, status; | 1071 | int i, status; |
@@ -1122,8 +1122,8 @@ static void add_to_state(char ***ifaces, int *n_ifaces, int *max_ifaces, char *n | |||
1122 | 1122 | ||
1123 | extern int ifupdown_main(int argc, char **argv) | 1123 | extern int ifupdown_main(int argc, char **argv) |
1124 | { | 1124 | { |
1125 | int (*cmds) (interface_defn *) = NULL; | 1125 | int (*cmds) (interface_defn_t *) = NULL; |
1126 | interfaces_file *defn; | 1126 | interfaces_file_t *defn; |
1127 | FILE *state_fp = NULL; | 1127 | FILE *state_fp = NULL; |
1128 | char **target_iface = NULL; | 1128 | char **target_iface = NULL; |
1129 | char **state = NULL; /* list of iface=liface */ | 1129 | char **state = NULL; /* list of iface=liface */ |
@@ -1226,7 +1226,7 @@ extern int ifupdown_main(int argc, char **argv) | |||
1226 | 1226 | ||
1227 | 1227 | ||
1228 | for (i = 0; i < n_target_ifaces; i++) { | 1228 | for (i = 0; i < n_target_ifaces; i++) { |
1229 | interface_defn *currif; | 1229 | interface_defn_t *currif; |
1230 | char iface[80]; | 1230 | char iface[80]; |
1231 | char liface[80]; | 1231 | char liface[80]; |
1232 | char *pch; | 1232 | char *pch; |
@@ -1264,7 +1264,7 @@ extern int ifupdown_main(int argc, char **argv) | |||
1264 | } | 1264 | } |
1265 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING | 1265 | #ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING |
1266 | if ((cmds == iface_up) && run_mappings) { | 1266 | if ((cmds == iface_up) && run_mappings) { |
1267 | mapping_defn *currmap; | 1267 | mapping_defn_t *currmap; |
1268 | 1268 | ||
1269 | for (currmap = defn->mappings; currmap; currmap = currmap->next) { | 1269 | for (currmap = defn->mappings; currmap; currmap = currmap->next) { |
1270 | 1270 | ||