Ignore:
Timestamp:
07/09/07 21:27:18 (6 years ago)
Author:
BrainSlayer
Message:

apply button works now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/rc/services.c

    r7415 r7416  
    6868    if (!metric || !ifname) 
    6969      continue; 
    70        
    71     if (!strcmp(ipaddr,"0.0.0.0")) 
    72         eval("route","del","default","gw",gateway); 
     70 
     71    if (!strcmp (ipaddr, "0.0.0.0")) 
     72      eval ("route", "del", "default", "gw", gateway); 
    7373 
    7474    route_del (ifname, atoi (metric) + 1, ipaddr, gateway, netmask); 
     
    8282{ 
    8383  void *handle = NULL; 
    84   nvram_set("qos_done","0"); 
     84  nvram_set ("qos_done", "0"); 
    8585#ifdef HAVE_CPUTEMP 
    8686  handle = start_service_nofree ("hwmon", handle); 
     
    160160#endif 
    161161#ifdef HAVE_MILKFISH 
    162   handle = start_service_nofree ("milkfish", handle);    
     162  handle = start_service_nofree ("milkfish", handle); 
    163163#endif 
    164164  dlclose (handle); 
     
    267267  char service[80]; 
    268268  char *services = nvram_safe_get ("action_service"); 
    269   sleep(3); 
     269  sleep (3); 
    270270  start_service ("overclocking"); 
    271271  foreach (service, services, next) 
    272272  { 
    273   fprintf (stderr, "Action %s\n", service); 
    274   cprintf ("Restart service=[%s]\n", service); 
    275  
    276   if (!strcmp (service, "dhcp")) 
    277     { 
    278       startstop ("udhcpd"); 
    279     } 
    280   else if (!strcmp (service, "index")) 
    281     { 
    282       unlink ("/tmp/ppp/log"); 
    283 #ifndef HAVE_MADWIFI 
    284       stop_service ("nas"); 
     273    fprintf (stderr, "Action %s\n", service); 
     274    cprintf ("Restart service=[%s]\n", service); 
     275 
     276    if (!strcmp (service, "dhcp")) 
     277      { 
     278        startstop ("udhcpd"); 
     279      } 
     280    else if (!strcmp (service, "index")) 
     281      { 
     282        unlink ("/tmp/ppp/log"); 
     283#ifndef HAVE_MADWIFI 
     284        stop_service ("nas"); 
    285285#endif 
    286286#ifdef HAVE_MADWIFI 
    287       stop_service ("stabridge"); 
    288 #endif 
    289 #ifdef HAVE_VLANTAGGING 
    290       stop_service ("bridgesif"); 
    291       stop_service ("vlantagging"); 
     287        stop_service ("stabridge"); 
     288#endif 
     289#ifdef HAVE_VLANTAGGING 
     290        stop_service ("bridgesif"); 
     291        stop_service ("vlantagging"); 
    292292#endif 
    293293#ifdef HAVE_BONDING 
    294       stop_service ("bonding"); 
    295 #endif 
    296       stop_service ("lan"); 
    297 #ifdef HAVE_VLANTAGGING 
    298       stop_service ("bridging"); 
    299 #endif 
    300       stop_service ("wan"); 
    301 #ifdef HAVE_VLANTAGGING 
    302       start_service ("bridging"); 
    303 #endif 
    304       start_service ("lan"); 
     294        stop_service ("bonding"); 
     295#endif 
     296        stop_service ("lan"); 
     297#ifdef HAVE_VLANTAGGING 
     298        stop_service ("bridging"); 
     299#endif 
     300        stop_service ("wan"); 
     301#ifdef HAVE_VLANTAGGING 
     302        start_service ("bridging"); 
     303#endif 
     304        start_service ("lan"); 
    305305#ifdef HAVE_BONDING 
    306       start_service ("bonding"); 
    307 #endif 
    308 #ifdef HAVE_VLANTAGGING 
    309       start_service ("vlantagging"); 
    310       start_service ("bridgesif"); 
    311 #endif 
    312       start_service ("wan_boot"); 
     306        start_service ("bonding"); 
     307#endif 
     308#ifdef HAVE_VLANTAGGING 
     309        start_service ("vlantagging"); 
     310        start_service ("bridgesif"); 
     311#endif 
     312        start_service ("wan_boot"); 
    313313#ifdef HAVE_MADWIFI 
    314       start_service ("stabridge"); 
    315 #endif 
    316       startstop ("udhcpd"); 
    317       startstop ("dnsmasq"); 
    318 #ifndef HAVE_MADWIFI 
    319       start_service ("nas"); 
     314        start_service ("stabridge"); 
     315#endif 
     316        startstop ("udhcpd"); 
     317        startstop ("dnsmasq"); 
     318#ifndef HAVE_MADWIFI 
     319        start_service ("nas"); 
    320320#ifdef HAVE_MSSID 
    321       start_service ("guest_nas"); 
     321        start_service ("guest_nas"); 
    322322#endif 
    323323#endif 
    324324#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    325       startstop ("zebra"); 
     325        startstop ("zebra"); 
    326326#endif 
    327327#ifdef HAVE_OLSRD 
    328       startstop ("olsrd"); 
    329 #endif 
    330       startstop ("firewall"); 
    331       startstop ("httpd");      //httpd will not accept connection anymore on wan/lan ip changes changes 
    332     } 
     328        startstop ("olsrd"); 
     329#endif 
     330        startstop ("firewall"); 
     331        startstop ("httpd");    //httpd will not accept connection anymore on wan/lan ip changes changes 
     332      } 
    333333/*// moved to filters (Firewall web GUI)     
    334334  else if (!strcmp (service, "logging")) 
     
    339339*/ 
    340340/* Sveasoft addition */ 
    341   else if (!strcmp (service, "router")) 
    342     { 
     341    else if (!strcmp (service, "router")) 
     342      { 
    343343#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    344       startstop ("zebra"); 
     344        startstop ("zebra"); 
    345345#endif 
    346346#ifdef HAVE_OLSRD 
    347       startstop ("olsrd"); 
    348 #endif 
    349     } 
    350   else if (!strcmp (service, "hotspot")) 
    351     { 
     347        startstop ("olsrd"); 
     348#endif 
     349      } 
     350    else if (!strcmp (service, "hotspot")) 
     351      { 
    352352#ifdef HAVE_WIFIDOG 
    353       startstop ("wifidog"); 
     353        startstop ("wifidog"); 
    354354#endif 
    355355#ifdef HAVE_NOCAT 
    356       startstop ("splashd"); 
     356        startstop ("splashd"); 
    357357#endif 
    358358#ifdef HAVE_CHILLI 
    359       startstop ("chilli"); 
     359        startstop ("chilli"); 
    360360#endif 
    361361#ifdef HAVE_SPUTNIK_APD 
    362       startstop ("sputnik"); 
    363 #endif 
    364       eval ("/etc/config/http-redirect.firewall"); 
    365       eval ("/etc/config/smtp-redirect.firewall"); 
    366  
    367     } 
    368   else if (!strcmp (service, "services")) 
    369     { 
     362        startstop ("sputnik"); 
     363#endif 
     364        eval ("/etc/config/http-redirect.firewall"); 
     365        eval ("/etc/config/smtp-redirect.firewall"); 
     366 
     367      } 
     368    else if (!strcmp (service, "services")) 
     369      { 
    370370#ifdef HAVE_PPPOERELAY 
    371       startstop ("pppoerelay"); 
    372 #endif 
    373       startstop ("udhcpd"); 
    374       startstop ("syslog"); 
     371        startstop ("pppoerelay"); 
     372#endif 
     373        startstop ("udhcpd"); 
     374        startstop ("syslog"); 
    375375#ifdef HAVE_RSTATS 
    376       startstop ("rstats"); 
     376        startstop ("rstats"); 
    377377#endif 
    378378#ifdef HAVE_NSTX 
    379       startstop ("nstxd"); 
     379        startstop ("nstxd"); 
    380380#endif 
    381381#ifdef HAVE_PPPOESERVER 
    382       startstop ("firewall"); 
    383       startstop ("pppoeserver"); 
    384 #endif 
    385       startstop ("dnsmasq"); 
    386       startstop ("udhcpd"); 
     382        startstop ("firewall"); 
     383        startstop ("pppoeserver"); 
     384#endif 
     385        startstop ("dnsmasq"); 
     386        startstop ("udhcpd"); 
    387387#ifdef HAVE_CPUTEMP 
    388       start_service ("hwmon"); 
     388        start_service ("hwmon"); 
    389389#endif 
    390390#ifdef HAVE_TELNET 
    391391#ifdef HAVE_REGISTER 
    392       if (isregistered ()) 
    393 #endif 
    394         startstop ("telnetd"); 
     392        if (isregistered ()) 
     393#endif 
     394          startstop ("telnetd"); 
    395395#endif 
    396396#ifdef HAVE_SNMP 
    397       startstop ("snmp"); 
     397        startstop ("snmp"); 
    398398#endif 
    399399#ifdef HAVE_OPENVPN 
    400       startstop ("openvpn"); 
     400        startstop ("openvpn"); 
    401401#endif 
    402402#ifdef HAVE_PPTPD 
    403       startstop ("pptpd"); 
     403        startstop ("pptpd"); 
    404404#endif 
    405405#ifdef HAVE_PPTP 
    406       eval ("/etc/config/pptpd_client.startup"); 
     406        eval ("/etc/config/pptpd_client.startup"); 
    407407#endif 
    408408#ifdef HAVE_RFLOW 
    409       eval ("/etc/config/rflow.startup"); 
     409        eval ("/etc/config/rflow.startup"); 
    410410#endif 
    411411#ifdef HAVE_KAID 
    412       eval ("/etc/config/kaid.startup"); 
     412        eval ("/etc/config/kaid.startup"); 
    413413#endif 
    414414#ifdef HAVE_SSHD 
    415415#ifdef HAVE_REGISTER 
    416       if (isregistered ()) 
    417 #endif 
    418         startstop ("sshd"); 
    419 #endif 
    420       startstop ("firewall"); 
    421       startstop ("syslog"); 
     416        if (isregistered ()) 
     417#endif 
     418          startstop ("sshd"); 
     419#endif 
     420        startstop ("firewall"); 
     421        startstop ("syslog"); 
    422422#ifdef HAVE_NEWMEDIA 
    423       startstop ("openvpnserversys"); 
    424 #endif 
    425     } 
    426   else if (!strcmp (service, "management")) 
    427     { 
    428 #ifndef HAVE_MADWIFI         
     423        startstop ("openvpnserversys"); 
     424#endif 
     425      } 
     426    else if (!strcmp (service, "management")) 
     427      { 
     428#ifndef HAVE_MADWIFI 
    429429        stop_service ("nas"); 
    430430#endif 
    431431#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    432       stop_service ("zebra"); 
    433 #endif 
    434       stop_service ("cron"); 
    435       stop_service ("udhcpd"); 
    436       start_service ("udhcpd"); 
    437       start_service ("cron"); 
     432        stop_service ("zebra"); 
     433#endif 
     434        stop_service ("cron"); 
     435        stop_service ("udhcpd"); 
     436        start_service ("udhcpd"); 
     437        start_service ("cron"); 
    438438#ifdef HAVE_IPV6 
    439       start_service ("ipv6"); 
     439        start_service ("ipv6"); 
    440440#endif 
    441441#ifdef HAVE_RADVD 
    442       startstop ("radvd"); 
     442        startstop ("radvd"); 
    443443#endif 
    444444#ifdef HAVE_PPTPD 
    445       startstop ("pptpd"); 
     445        startstop ("pptpd"); 
    446446#endif 
    447447#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    448       start_service ("zebra"); 
    449 #endif 
    450       startstop ("firewall"); 
    451       startstop ("wshaper"); 
    452       startstop ("httpd"); 
     448        start_service ("zebra"); 
     449#endif 
     450        startstop ("firewall"); 
     451        startstop ("wshaper"); 
     452        startstop ("httpd"); 
    453453 
    454454#ifdef HAVE_WOL 
    455       startstop ("wol"); 
    456 #endif 
    457 #ifndef HAVE_MADWIFI 
    458       start_service ("nas"); 
     455        startstop ("wol"); 
     456#endif 
     457#ifndef HAVE_MADWIFI 
     458        start_service ("nas"); 
    459459#ifdef HAVE_MSSID 
    460       start_service ("guest_nas"); 
    461 #endif 
    462 #endif 
    463  
    464     } 
     460        start_service ("guest_nas"); 
     461#endif 
     462#endif 
     463 
     464      } 
    465465 
    466466/* end Sveasoft additon */ 
    467   else if (!strcmp (service, "start_pppoe") || !strcmp (service, "start_pptp") 
    468            || !strcmp (service, "start_l2tp") 
    469            || !strcmp (service, "start_heartbeat")) 
    470     { 
    471       unlink ("/tmp/ppp/log"); 
    472 #ifndef HAVE_MADWIFI 
    473       stop_service ("nas"); 
     467    else if (!strcmp (service, "start_pppoe") 
     468             || !strcmp (service, "start_pptp") 
     469             || !strcmp (service, "start_l2tp") 
     470             || !strcmp (service, "start_heartbeat")) 
     471      { 
     472        unlink ("/tmp/ppp/log"); 
     473#ifndef HAVE_MADWIFI 
     474        stop_service ("nas"); 
    474475#endif 
    475476#ifdef HAVE_MADWIFI 
    476       stop_service ("stabridge"); 
    477 #endif 
    478 #ifdef HAVE_VLANTAGGING 
    479       stop_service ("bridgesif"); 
    480       stop_service ("vlantagging"); 
    481 #endif 
    482       stop_service ("lan"); 
     477        stop_service ("stabridge"); 
     478#endif 
     479#ifdef HAVE_VLANTAGGING 
     480        stop_service ("bridgesif"); 
     481        stop_service ("vlantagging"); 
     482#endif 
     483        stop_service ("lan"); 
    483484#ifdef HAVE_BONDING 
    484       stop_service ("bonding"); 
    485 #endif 
    486 #ifdef HAVE_VLANTAGGING 
    487       stop_service ("bridging"); 
    488 #endif 
    489       stop_service ("wan"); 
    490 #ifdef HAVE_VLANTAGGING 
    491       start_service ("bridging"); 
    492 #endif 
    493       start_service ("lan"); 
     485        stop_service ("bonding"); 
     486#endif 
     487#ifdef HAVE_VLANTAGGING 
     488        stop_service ("bridging"); 
     489#endif 
     490        stop_service ("wan"); 
     491#ifdef HAVE_VLANTAGGING 
     492        start_service ("bridging"); 
     493#endif 
     494        start_service ("lan"); 
    494495#ifdef HAVE_BONDING 
    495       start_service ("bonding"); 
    496 #endif 
    497 #ifdef HAVE_VLANTAGGING 
    498       start_service ("vlantagging"); 
    499       start_service ("bridgesif"); 
    500 #endif 
    501       start_service ("wan_boot"); 
     496        start_service ("bonding"); 
     497#endif 
     498#ifdef HAVE_VLANTAGGING 
     499        start_service ("vlantagging"); 
     500        start_service ("bridgesif"); 
     501#endif 
     502        start_service ("wan_boot"); 
    502503#ifdef HAVE_MADWIFI 
    503       start_service ("stabridge"); 
    504 #endif 
    505 #ifndef HAVE_MADWIFI 
    506       start_service ("nas"); 
     504        start_service ("stabridge"); 
     505#endif 
     506#ifndef HAVE_MADWIFI 
     507        start_service ("nas"); 
    507508#ifdef HAVE_MSSID 
    508       start_service ("guest_nas"); 
    509 #endif 
    510 #endif 
    511     } 
    512   else if (!strcmp (service, "stop_pppoe") || !strcmp (service, "stop_pptp") 
    513            || !strcmp (service, "stop_l2tp") 
    514            || !strcmp (service, "stop_heartbeat")) 
    515     { 
    516       stop_service ("wan"); 
    517     } 
    518   else if (!strcmp (service, "filters")) 
    519     { 
    520       stop_service ("cron"); 
    521       startstop ("firewall"); 
    522       startstop ("syslog"); 
    523       startstop ("wshaper"); 
    524       start_service ("cron"); 
    525       startstop ("igmp_proxy"); 
    526     } 
    527   else if (!strcmp (service, "routing")) 
    528     { 
     509        start_service ("guest_nas"); 
     510#endif 
     511#endif 
     512      } 
     513    else if (!strcmp (service, "stop_pppoe") || !strcmp (service, "stop_pptp") 
     514             || !strcmp (service, "stop_l2tp") 
     515             || !strcmp (service, "stop_heartbeat")) 
     516      { 
     517        stop_service ("wan"); 
     518      } 
     519    else if (!strcmp (service, "filters")) 
     520      { 
     521        stop_service ("cron"); 
     522        startstop ("firewall"); 
     523        startstop ("syslog"); 
     524        startstop ("wshaper"); 
     525        start_service ("cron"); 
     526        startstop ("igmp_proxy"); 
     527      } 
     528    else if (!strcmp (service, "routing")) 
     529      { 
    529530#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    530       stop_service ("zebra"); 
    531 #endif 
    532       startstop ("firewall"); 
    533       start_service ("set_routes"); 
     531        stop_service ("zebra"); 
     532#endif 
     533        startstop ("firewall"); 
     534        start_service ("set_routes"); 
    534535#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    535       start_service ("zebra"); 
     536        start_service ("zebra"); 
    536537#endif 
    537538#ifdef HAVE_OLSRD 
    538       startstop("olsrd"); 
    539 #endif 
    540     } 
    541   else if (!strcmp (service, "alive")) 
    542     { 
    543       eval ("/etc/config/wdswatchdog.startup"); 
    544       eval ("/etc/config/schedulerb.startup"); 
    545       eval ("/etc/config/proxywatchdog.startup"); 
    546     } 
    547   else if (!strcmp (service, "forward")) 
    548     { 
    549       stop_service ("wshaper"); 
    550       stop_service ("upnp"); 
    551       stop_service ("firewall"); 
    552       start_service ("firewall"); 
    553       start_service ("upnp"); 
    554       start_service ("wshaper"); 
    555     } 
    556   else if (!strcmp (service, "qos")) 
    557     { 
    558       startstop ("wshaper"); 
    559     } 
    560   else if (!strcmp (service, "forward_upnp")) 
    561     { 
     539        startstop ("olsrd"); 
     540#endif 
     541      } 
     542    else if (!strcmp (service, "alive")) 
     543      { 
     544        eval ("/etc/config/wdswatchdog.startup"); 
     545        eval ("/etc/config/schedulerb.startup"); 
     546        eval ("/etc/config/proxywatchdog.startup"); 
     547      } 
     548    else if (!strcmp (service, "forward")) 
     549      { 
     550        stop_service ("wshaper"); 
     551        stop_service ("upnp"); 
     552        stop_service ("firewall"); 
     553        start_service ("firewall"); 
     554        start_service ("upnp"); 
     555        start_service ("wshaper"); 
     556      } 
     557    else if (!strcmp (service, "qos")) 
     558      { 
     559        startstop ("wshaper"); 
     560      } 
     561    else if (!strcmp (service, "forward_upnp")) 
     562      { 
    562563#ifdef HAVE_UPNP 
    563       stop_service ("upnp"); 
    564 #endif 
    565       stop_service ("firewall"); 
     564        stop_service ("upnp"); 
     565#endif 
     566        stop_service ("firewall"); 
    566567#ifdef HAVE_UPNP 
    567       start_service ("upnp"); 
    568 #endif 
    569       start_service ("firewall"); 
    570       startstop ("wshaper"); 
    571     } 
    572   else if (!strcmp (service, "static_route_del")) 
    573     { 
    574       if (nvram_safe_get ("action_service_arg1")) 
    575         { 
    576           del_routes (nvram_safe_get ("action_service_arg1")); 
    577         } 
    578     } 
    579   else if (!strcmp (service, "ddns")) 
    580     { 
    581       startstop ("ddns"); 
    582       nvram_set ("ddns_change", "update"); 
    583     } 
    584   else if (!strcmp (service, "start_ping")) 
    585     { 
    586       char *ip = nvram_safe_get ("ping_ip"); 
    587       // use Ping.asp as a debugging console 
    588       char cmd[256] = { 0 }; 
    589       //snprintf (cmd, sizeof (cmd), "%s > %s 2>&1 &", ip, PING_TMP); 
    590       setenv ("PATH", "/sbin:/bin:/usr/sbin:/usr/bin", 1); 
     568        start_service ("upnp"); 
     569#endif 
     570        start_service ("firewall"); 
     571        startstop ("wshaper"); 
     572      } 
     573    else if (!strcmp (service, "static_route_del")) 
     574      { 
     575        if (nvram_safe_get ("action_service_arg1")) 
     576          { 
     577            del_routes (nvram_safe_get ("action_service_arg1")); 
     578          } 
     579      } 
     580    else if (!strcmp (service, "ddns")) 
     581      { 
     582        startstop ("ddns"); 
     583        nvram_set ("ddns_change", "update"); 
     584      } 
     585    else if (!strcmp (service, "start_ping")) 
     586      { 
     587        char *ip = nvram_safe_get ("ping_ip"); 
     588        // use Ping.asp as a debugging console 
     589        char cmd[256] = { 0 }; 
     590        //snprintf (cmd, sizeof (cmd), "%s > %s 2>&1 &", ip, PING_TMP); 
     591        setenv ("PATH", "/sbin:/bin:/usr/sbin:/usr/bin", 1); 
    591592//      snprintf (cmd, sizeof (cmd), "%s 2>&1 &", ip); 
    592593//      system (cmd); 
    593594 
    594       snprintf (cmd, sizeof (cmd), 
    595                 "alias ping=\'ping -c 3\'; eval \"%s\" > %s 2>&1 &", ip, 
    596                 PING_TMP); 
    597       system (cmd); 
    598  
    599     } 
     595        snprintf (cmd, sizeof (cmd), 
     596                  "alias ping=\'ping -c 3\'; eval \"%s\" > %s 2>&1 &", ip, 
     597                  PING_TMP); 
     598        system (cmd); 
     599 
     600      } 
    600601#ifdef HAVE_TFTP 
    601   else if (!strcmp (service, "tftp_upgrade")) 
    602     { 
    603       stop_service ("wan"); 
    604       stop_service ("httpd"); 
     602    else if (!strcmp (service, "tftp_upgrade")) 
     603      { 
     604        stop_service ("wan"); 
     605        stop_service ("httpd"); 
    605606#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    606       stop_service ("zebra"); 
     607        stop_service ("zebra"); 
    607608#endif 
    608609#ifdef HAVE_UPNP 
    609       stop_service ("upnp"); 
    610 #endif 
    611       stop_service ("cron"); 
    612     } 
    613 #endif 
    614  
    615   else if (!strcmp (service, "http_upgrade")) 
    616     { 
    617       stop_service ("wan"); 
     610        stop_service ("upnp"); 
     611#endif 
     612        stop_service ("cron"); 
     613      } 
     614#endif 
     615 
     616    else if (!strcmp (service, "http_upgrade")) 
     617      { 
     618        stop_service ("wan"); 
    618619#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    619       stop_service ("zebra"); 
     620        stop_service ("zebra"); 
    620621#endif 
    621622#ifdef HAVE_OLSRD 
    622       stop_service ("olsrd"); 
     623        stop_service ("olsrd"); 
    623624#endif 
    624625#ifdef HAVE_UPNP 
    625       stop_service ("upnp"); 
    626 #endif 
    627       stop_service ("cron"); 
    628     } 
     626        stop_service ("upnp"); 
     627#endif 
     628        stop_service ("cron"); 
     629      } 
    629630#ifdef HAVE_MIKLFISH 
    630   else if (!strcmp (service, "milkfish")) 
    631     { 
    632           stop_service ("milkfish"); 
    633           start_service ("milkfish"); 
    634         } 
    635 #endif 
    636   else if (!strcmp (service, "wireless")) 
    637     { 
    638 #ifndef HAVE_MADWIFI 
    639       eval ("wlconf", nvram_safe_get ("wl0_ifname"), "down"); 
    640 #endif 
    641  
    642 #ifndef HAVE_MADWIFI 
    643       stop_service ("nas"); 
     631    else if (!strcmp (service, "milkfish")) 
     632      { 
     633        stop_service ("milkfish"); 
     634        start_service ("milkfish"); 
     635      } 
     636#endif 
     637    else if (!strcmp (service, "wireless")) 
     638      { 
     639#ifndef HAVE_MADWIFI 
     640        eval ("wlconf", nvram_safe_get ("wl0_ifname"), "down"); 
     641#endif 
     642 
     643#ifndef HAVE_MADWIFI 
     644        stop_service ("nas"); 
    644645#endif 
    645646#ifdef HAVE_MADWIFI 
    646       stop_service ("stabridge"); 
    647 #endif 
    648       stop_service ("wan"); 
    649 #ifdef HAVE_VLANTAGGING 
    650       stop_service ("bridgesif"); 
    651       stop_service ("vlantagging"); 
     647        stop_service ("stabridge"); 
     648#endif 
     649        stop_service ("wan"); 
     650#ifdef HAVE_VLANTAGGING 
     651        stop_service ("bridgesif"); 
     652        stop_service ("vlantagging"); 
    652653#endif 
    653654#ifdef HAVE_BONDING 
    654       stop_service ("bonding"); 
    655 #endif 
    656       stop_service ("lan"); 
    657 #ifdef HAVE_VLANTAGGING 
    658       stop_service ("bridging"); 
     655        stop_service ("bonding"); 
     656#endif 
     657        stop_service ("lan"); 
     658#ifdef HAVE_VLANTAGGING 
     659        stop_service ("bridging"); 
    659660#endif 
    660661#ifndef HAVE_MSSID 
    661       if (nvram_match ("wl_akm", "wpa") || 
    662           nvram_match ("wl_akm", "psk") || 
    663           nvram_match ("wl_akm", "psk2") || 
    664           nvram_match ("wl_akm", "wpa2") || 
    665           nvram_match ("wl_akm", "psk psk2") || 
    666           nvram_match ("wl_akm", "wpa wpa2") || 
    667           nvram_match ("wl_akm", "radius")) 
    668         sleep (4); 
    669 #endif 
    670 #ifndef HAVE_MADWIFI 
    671       start_service ("wlconf"); 
    672 #endif 
    673 #ifdef HAVE_VLANTAGGING 
    674       start_service ("bridging"); 
    675 #endif 
    676       start_service ("lan"); 
     662        if (nvram_match ("wl_akm", "wpa") || 
     663            nvram_match ("wl_akm", "psk") || 
     664            nvram_match ("wl_akm", "psk2") || 
     665            nvram_match ("wl_akm", "wpa2") || 
     666            nvram_match ("wl_akm", "psk psk2") || 
     667            nvram_match ("wl_akm", "wpa wpa2") || 
     668            nvram_match ("wl_akm", "radius")) 
     669          sleep (4); 
     670#endif 
     671#ifndef HAVE_MADWIFI 
     672        start_service ("wlconf"); 
     673#endif 
     674#ifdef HAVE_VLANTAGGING 
     675        start_service ("bridging"); 
     676#endif 
     677        start_service ("lan"); 
    677678#ifdef HAVE_BONDING 
    678       start_service ("bonding"); 
    679 #endif 
    680 #ifdef HAVE_VLANTAGGING 
    681       start_service ("vlantagging"); 
    682       start_service ("bridgesif"); 
    683 #endif 
    684       start_service ("wan"); 
     679        start_service ("bonding"); 
     680#endif 
     681#ifdef HAVE_VLANTAGGING 
     682        start_service ("vlantagging"); 
     683        start_service ("bridgesif"); 
     684#endif 
     685        start_service ("wan"); 
    685686#ifdef HAVE_MADWIFI 
    686       start_service ("stabridge"); 
    687 #endif 
    688 #ifndef HAVE_MADWIFI 
    689           start_service ("nas"); 
     687        start_service ("stabridge"); 
     688#endif 
     689#ifndef HAVE_MADWIFI 
     690        start_service ("nas"); 
    690691#ifdef HAVE_MSSID 
    691       start_service ("guest_nas"); 
    692 #endif 
    693 #endif 
    694       startstop ("httpd");      //httpd will not accept connection anymore on wan/lan ip changes changes 
    695  
    696     } 
    697   else if (!strcmp (service, "wireless_2")) 
    698     { 
    699       stop_service ("radio_timer"); 
    700 #ifndef HAVE_MADWIFI 
    701       eval ("wlconf", nvram_safe_get ("wl0_ifname"), "down"); 
    702 #endif 
    703  
    704 #ifndef HAVE_MADWIFI 
    705       stop_service ("nas"); 
     692        start_service ("guest_nas"); 
     693#endif 
     694#endif 
     695        startstop ("httpd");    //httpd will not accept connection anymore on wan/lan ip changes changes 
     696 
     697      } 
     698    else if (!strcmp (service, "wireless_2")) 
     699      { 
     700        stop_service ("radio_timer"); 
     701#ifndef HAVE_MADWIFI 
     702        eval ("wlconf", nvram_safe_get ("wl0_ifname"), "down"); 
     703#endif 
     704 
     705#ifndef HAVE_MADWIFI 
     706        stop_service ("nas"); 
    706707#endif 
    707708#ifdef HAVE_MADWIFI 
    708       stop_service ("stabridge"); 
    709 #endif 
    710       if (nvram_match ("wl0_mode", "sta")  
    711                 || nvram_match ("wl0_mode", "apsta")  
    712                 || nvram_match ("wl0_mode", "apstawet"))  
    713                 stop_service ("wan"); 
    714 #ifdef HAVE_VLANTAGGING 
    715       stop_service ("bridgesif"); 
    716       stop_service ("vlantagging"); 
     709        stop_service ("stabridge"); 
     710#endif 
     711        if (nvram_match ("wl0_mode", "sta") 
     712            || nvram_match ("wl0_mode", "apsta") 
     713            || nvram_match ("wl0_mode", "apstawet")) 
     714          stop_service ("wan"); 
     715#ifdef HAVE_VLANTAGGING 
     716        stop_service ("bridgesif"); 
     717        stop_service ("vlantagging"); 
    717718#endif 
    718719#ifdef HAVE_BONDING 
    719       stop_service ("bonding"); 
    720 #endif 
    721       stop_service ("lan"); 
    722 #ifdef HAVE_VLANTAGGING 
    723       stop_service ("bridging"); 
     720        stop_service ("bonding"); 
     721#endif 
     722        stop_service ("lan"); 
     723#ifdef HAVE_VLANTAGGING 
     724        stop_service ("bridging"); 
    724725#endif 
    725726#ifndef HAVE_MSSID 
    726       if (nvram_match ("wl_akm", "wpa") || 
    727           nvram_match ("wl_akm", "psk") || 
    728           nvram_match ("wl_akm", "psk2") || 
    729           nvram_match ("wl_akm", "wpa2") || 
    730           nvram_match ("wl_akm", "psk psk2") || 
    731           nvram_match ("wl_akm", "wpa wpa2") || 
    732           nvram_match ("wl_akm", "radius")) 
    733         sleep (4); 
    734 #endif 
    735 #ifndef HAVE_MADWIFI 
    736       start_service ("wlconf"); 
    737 #endif 
    738 #ifdef HAVE_VLANTAGGING 
    739       start_service ("bridging"); 
    740 #endif 
    741       start_service ("lan"); 
     727        if (nvram_match ("wl_akm", "wpa") || 
     728            nvram_match ("wl_akm", "psk") || 
     729            nvram_match ("wl_akm", "psk2") || 
     730            nvram_match ("wl_akm", "wpa2") || 
     731            nvram_match ("wl_akm", "psk psk2") || 
     732            nvram_match ("wl_akm", "wpa wpa2") || 
     733            nvram_match ("wl_akm", "radius")) 
     734          sleep (4); 
     735#endif 
     736#ifndef HAVE_MADWIFI 
     737        start_service ("wlconf"); 
     738#endif 
     739#ifdef HAVE_VLANTAGGING 
     740        start_service ("bridging"); 
     741#endif 
     742        start_service ("lan"); 
    742743#ifdef HAVE_BONDING 
    743       start_service ("bonding"); 
    744 #endif 
    745 #ifdef HAVE_VLANTAGGING 
    746       start_service ("vlantagging"); 
    747       start_service ("bridgesif"); 
    748 #endif 
    749       if (nvram_match ("wl0_mode", "sta")  
    750                 || nvram_match ("wl0_mode", "apsta")  
    751                 || nvram_match ("wl0_mode", "apstawet"))  
    752                 start_service ("wan"); 
     744        start_service ("bonding"); 
     745#endif 
     746#ifdef HAVE_VLANTAGGING 
     747        start_service ("vlantagging"); 
     748        start_service ("bridgesif"); 
     749#endif 
     750        if (nvram_match ("wl0_mode", "sta") 
     751            || nvram_match ("wl0_mode", "apsta") 
     752            || nvram_match ("wl0_mode", "apstawet")) 
     753          start_service ("wan"); 
    753754#ifdef HAVE_MADWIFI 
    754       start_service ("stabridge"); 
    755 #endif 
    756 #ifndef HAVE_MADWIFI 
    757           start_service ("nas"); 
     755        start_service ("stabridge"); 
     756#endif 
     757#ifndef HAVE_MADWIFI 
     758        start_service ("nas"); 
    758759#ifdef HAVE_MSSID 
    759       start_service ("guest_nas"); 
    760 #endif 
    761 #endif 
    762       start_service ("radio_timer"); 
    763       if (nvram_match ("wl0_mode", "sta")  
    764                 || nvram_match ("wl0_mode", "apsta")  
    765                 || nvram_match ("wl0_mode", "apstawet"))  
    766                 startstop ("httpd");      //httpd will not accept connection anymore on wan/lan ip changes changes  
    767     } 
    768   else if (!strcmp (service, "dhcp_release")) 
    769     { 
    770       char sigusr[] = "-XX"; 
    771       sprintf (sigusr, "-%d", SIGUSR2); 
    772       //killps("udhcpc",sigusr); 
    773       killall ("udhcpc", sigusr); 
    774       sleep (1); 
    775     } 
     760        start_service ("guest_nas"); 
     761#endif 
     762#endif 
     763        start_service ("radio_timer"); 
     764        if (nvram_match ("wl0_mode", "sta") 
     765            || nvram_match ("wl0_mode", "apsta") 
     766            || nvram_match ("wl0_mode", "apstawet")) 
     767          startstop ("httpd");  //httpd will not accept connection anymore on wan/lan ip changes changes  
     768      } 
     769    else if (!strcmp (service, "dhcp_release")) 
     770      { 
     771        char sigusr[] = "-XX"; 
     772        sprintf (sigusr, "-%d", SIGUSR2); 
     773        //killps("udhcpc",sigusr); 
     774        killall ("udhcpc", sigusr); 
     775        sleep (1); 
     776      } 
    776777#ifdef HAVE_EOP_TUNNEL 
    777   else if (!strcmp (service, "eop")) 
    778     { 
    779       eval ("/etc/config/eop-tunnel.startup"); 
    780       eval ("/etc/config/eop-tunnel.firewall"); 
    781     } 
     778    else if (!strcmp (service, "eop")) 
     779      { 
     780        eval ("/etc/config/eop-tunnel.startup"); 
     781        eval ("/etc/config/eop-tunnel.firewall"); 
     782      } 
    782783#endif 
    783784  } 
Note: See TracChangeset for help on using the changeset viewer.