aboutsummaryrefslogtreecommitdiff
path: root/networking/ifupdown.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/ifupdown.c')
-rw-r--r--networking/ifupdown.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 604a216d4..6d608105e 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -42,8 +42,8 @@ typedef int execfn(char *command);
42 42
43struct method_t { 43struct method_t {
44 const char *name; 44 const char *name;
45 int (*up)(struct interface_defn_t *ifd, execfn *e); 45 int (*up)(struct interface_defn_t *ifd, execfn *e) FAST_FUNC;
46 int (*down)(struct interface_defn_t *ifd, execfn *e); 46 int (*down)(struct interface_defn_t *ifd, execfn *e) FAST_FUNC;
47}; 47};
48 48
49struct address_family_t { 49struct address_family_t {
@@ -325,7 +325,7 @@ static int execute(const char *command, struct interface_defn_t *ifd, execfn *ex
325#endif 325#endif
326 326
327#if ENABLE_FEATURE_IFUPDOWN_IPV6 327#if ENABLE_FEATURE_IFUPDOWN_IPV6
328static int loopback_up6(struct interface_defn_t *ifd, execfn *exec) 328static int FAST_FUNC loopback_up6(struct interface_defn_t *ifd, execfn *exec)
329{ 329{
330#if ENABLE_FEATURE_IFUPDOWN_IP 330#if ENABLE_FEATURE_IFUPDOWN_IP
331 int result; 331 int result;
@@ -337,7 +337,7 @@ static int loopback_up6(struct interface_defn_t *ifd, execfn *exec)
337#endif 337#endif
338} 338}
339 339
340static int loopback_down6(struct interface_defn_t *ifd, execfn *exec) 340static int FAST_FUNC loopback_down6(struct interface_defn_t *ifd, execfn *exec)
341{ 341{
342#if ENABLE_FEATURE_IFUPDOWN_IP 342#if ENABLE_FEATURE_IFUPDOWN_IP
343 return execute("ip link set %iface% down", ifd, exec); 343 return execute("ip link set %iface% down", ifd, exec);
@@ -346,7 +346,7 @@ static int loopback_down6(struct interface_defn_t *ifd, execfn *exec)
346#endif 346#endif
347} 347}
348 348
349static int static_up6(struct interface_defn_t *ifd, execfn *exec) 349static int FAST_FUNC static_up6(struct interface_defn_t *ifd, execfn *exec)
350{ 350{
351 int result; 351 int result;
352#if ENABLE_FEATURE_IFUPDOWN_IP 352#if ENABLE_FEATURE_IFUPDOWN_IP
@@ -362,7 +362,7 @@ static int static_up6(struct interface_defn_t *ifd, execfn *exec)
362 return ((result == 3) ? 3 : 0); 362 return ((result == 3) ? 3 : 0);
363} 363}
364 364
365static int static_down6(struct interface_defn_t *ifd, execfn *exec) 365static int FAST_FUNC static_down6(struct interface_defn_t *ifd, execfn *exec)
366{ 366{
367#if ENABLE_FEATURE_IFUPDOWN_IP 367#if ENABLE_FEATURE_IFUPDOWN_IP
368 return execute("ip link set %iface% down", ifd, exec); 368 return execute("ip link set %iface% down", ifd, exec);
@@ -372,7 +372,7 @@ static int static_down6(struct interface_defn_t *ifd, execfn *exec)
372} 372}
373 373
374#if ENABLE_FEATURE_IFUPDOWN_IP 374#if ENABLE_FEATURE_IFUPDOWN_IP
375static int v4tunnel_up(struct interface_defn_t *ifd, execfn *exec) 375static int FAST_FUNC v4tunnel_up(struct interface_defn_t *ifd, execfn *exec)
376{ 376{
377 int result; 377 int result;
378 result = execute("ip tunnel add %iface% mode sit remote " 378 result = execute("ip tunnel add %iface% mode sit remote "
@@ -383,7 +383,7 @@ static int v4tunnel_up(struct interface_defn_t *ifd, execfn *exec)
383 return ((result == 4) ? 4 : 0); 383 return ((result == 4) ? 4 : 0);
384} 384}
385 385
386static int v4tunnel_down(struct interface_defn_t * ifd, execfn * exec) 386static int FAST_FUNC v4tunnel_down(struct interface_defn_t * ifd, execfn * exec)
387{ 387{
388 return execute("ip tunnel del %iface%", ifd, exec); 388 return execute("ip tunnel del %iface%", ifd, exec);
389} 389}
@@ -405,7 +405,7 @@ static const struct address_family_t addr_inet6 = {
405#endif /* FEATURE_IFUPDOWN_IPV6 */ 405#endif /* FEATURE_IFUPDOWN_IPV6 */
406 406
407#if ENABLE_FEATURE_IFUPDOWN_IPV4 407#if ENABLE_FEATURE_IFUPDOWN_IPV4
408static int loopback_up(struct interface_defn_t *ifd, execfn *exec) 408static int FAST_FUNC loopback_up(struct interface_defn_t *ifd, execfn *exec)
409{ 409{
410#if ENABLE_FEATURE_IFUPDOWN_IP 410#if ENABLE_FEATURE_IFUPDOWN_IP
411 int result; 411 int result;
@@ -417,7 +417,7 @@ static int loopback_up(struct interface_defn_t *ifd, execfn *exec)
417#endif 417#endif
418} 418}
419 419
420static int loopback_down(struct interface_defn_t *ifd, execfn *exec) 420static int FAST_FUNC loopback_down(struct interface_defn_t *ifd, execfn *exec)
421{ 421{
422#if ENABLE_FEATURE_IFUPDOWN_IP 422#if ENABLE_FEATURE_IFUPDOWN_IP
423 int result; 423 int result;
@@ -429,7 +429,7 @@ static int loopback_down(struct interface_defn_t *ifd, execfn *exec)
429#endif 429#endif
430} 430}
431 431
432static int static_up(struct interface_defn_t *ifd, execfn *exec) 432static int FAST_FUNC static_up(struct interface_defn_t *ifd, execfn *exec)
433{ 433{
434 int result; 434 int result;
435#if ENABLE_FEATURE_IFUPDOWN_IP 435#if ENABLE_FEATURE_IFUPDOWN_IP
@@ -451,7 +451,7 @@ static int static_up(struct interface_defn_t *ifd, execfn *exec)
451#endif 451#endif
452} 452}
453 453
454static int static_down(struct interface_defn_t *ifd, execfn *exec) 454static int FAST_FUNC static_down(struct interface_defn_t *ifd, execfn *exec)
455{ 455{
456 int result; 456 int result;
457#if ENABLE_FEATURE_IFUPDOWN_IP 457#if ENABLE_FEATURE_IFUPDOWN_IP
@@ -468,8 +468,7 @@ static int static_down(struct interface_defn_t *ifd, execfn *exec)
468} 468}
469 469
470#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP 470#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
471struct dhcp_client_t 471struct dhcp_client_t {
472{
473 const char *name; 472 const char *name;
474 const char *startcmd; 473 const char *startcmd;
475 const char *stopcmd; 474 const char *stopcmd;
@@ -497,7 +496,7 @@ static const struct dhcp_client_t ext_dhcp_clients[] = {
497#endif /* ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCPC */ 496#endif /* ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCPC */
498 497
499#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP 498#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
500static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) 499static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec)
501{ 500{
502 unsigned i; 501 unsigned i;
503#if ENABLE_FEATURE_IFUPDOWN_IP 502#if ENABLE_FEATURE_IFUPDOWN_IP
@@ -517,7 +516,7 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
517 return 0; 516 return 0;
518} 517}
519#elif ENABLE_APP_UDHCPC 518#elif ENABLE_APP_UDHCPC
520static int dhcp_up(struct interface_defn_t *ifd, execfn *exec) 519static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec)
521{ 520{
522#if ENABLE_FEATURE_IFUPDOWN_IP 521#if ENABLE_FEATURE_IFUPDOWN_IP
523 /* ip doesn't up iface when it configures it (unlike ifconfig) */ 522 /* ip doesn't up iface when it configures it (unlike ifconfig) */
@@ -533,7 +532,7 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
533 ifd, exec); 532 ifd, exec);
534} 533}
535#else 534#else
536static int dhcp_up(struct interface_defn_t *ifd UNUSED_PARAM, 535static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd UNUSED_PARAM,
537 execfn *exec UNUSED_PARAM) 536 execfn *exec UNUSED_PARAM)
538{ 537{
539 return 0; /* no dhcp support */ 538 return 0; /* no dhcp support */
@@ -541,7 +540,7 @@ static int dhcp_up(struct interface_defn_t *ifd UNUSED_PARAM,
541#endif 540#endif
542 541
543#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP 542#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
544static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) 543static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec)
545{ 544{
546 int result = 0; 545 int result = 0;
547 unsigned i; 546 unsigned i;
@@ -564,7 +563,7 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
564 return ((result == 3) ? 3 : 0); 563 return ((result == 3) ? 3 : 0);
565} 564}
566#elif ENABLE_APP_UDHCPC 565#elif ENABLE_APP_UDHCPC
567static int dhcp_down(struct interface_defn_t *ifd, execfn *exec) 566static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec)
568{ 567{
569 int result; 568 int result;
570 result = execute("kill " 569 result = execute("kill "
@@ -579,42 +578,42 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
579 return ((result == 3) ? 3 : 0); 578 return ((result == 3) ? 3 : 0);
580} 579}
581#else 580#else
582static int dhcp_down(struct interface_defn_t *ifd UNUSED_PARAM, 581static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd UNUSED_PARAM,
583 execfn *exec UNUSED_PARAM) 582 execfn *exec UNUSED_PARAM)
584{ 583{
585 return 0; /* no dhcp support */ 584 return 0; /* no dhcp support */
586} 585}
587#endif 586#endif
588 587
589static int manual_up_down(struct interface_defn_t *ifd UNUSED_PARAM, execfn *exec UNUSED_PARAM) 588static int FAST_FUNC manual_up_down(struct interface_defn_t *ifd UNUSED_PARAM, execfn *exec UNUSED_PARAM)
590{ 589{
591 return 1; 590 return 1;
592} 591}
593 592
594static int bootp_up(struct interface_defn_t *ifd, execfn *exec) 593static int FAST_FUNC bootp_up(struct interface_defn_t *ifd, execfn *exec)
595{ 594{
596 return execute("bootpc[[ --bootfile %bootfile%]] --dev %iface%" 595 return execute("bootpc[[ --bootfile %bootfile%]] --dev %iface%"
597 "[[ --server %server%]][[ --hwaddr %hwaddr%]]" 596 "[[ --server %server%]][[ --hwaddr %hwaddr%]]"
598 " --returniffail --serverbcast", ifd, exec); 597 " --returniffail --serverbcast", ifd, exec);
599} 598}
600 599
601static int ppp_up(struct interface_defn_t *ifd, execfn *exec) 600static int FAST_FUNC ppp_up(struct interface_defn_t *ifd, execfn *exec)
602{ 601{
603 return execute("pon[[ %provider%]]", ifd, exec); 602 return execute("pon[[ %provider%]]", ifd, exec);
604} 603}
605 604
606static int ppp_down(struct interface_defn_t *ifd, execfn *exec) 605static int FAST_FUNC ppp_down(struct interface_defn_t *ifd, execfn *exec)
607{ 606{
608 return execute("poff[[ %provider%]]", ifd, exec); 607 return execute("poff[[ %provider%]]", ifd, exec);
609} 608}
610 609
611static int wvdial_up(struct interface_defn_t *ifd, execfn *exec) 610static int FAST_FUNC wvdial_up(struct interface_defn_t *ifd, execfn *exec)
612{ 611{
613 return execute("start-stop-daemon --start -x wvdial " 612 return execute("start-stop-daemon --start -x wvdial "
614 "-p /var/run/wvdial.%iface% -b -m --[[ %provider%]]", ifd, exec); 613 "-p /var/run/wvdial.%iface% -b -m --[[ %provider%]]", ifd, exec);
615} 614}
616 615
617static int wvdial_down(struct interface_defn_t *ifd, execfn *exec) 616static int FAST_FUNC wvdial_down(struct interface_defn_t *ifd, execfn *exec)
618{ 617{
619 return execute("start-stop-daemon --stop -x wvdial " 618 return execute("start-stop-daemon --stop -x wvdial "
620 "-p /var/run/wvdial.%iface% -s 2", ifd, exec); 619 "-p /var/run/wvdial.%iface% -s 2", ifd, exec);