Changeset 33102


Ignore:
Timestamp:
Aug 11, 2017, 11:11:20 AM (12 days ago)
Author:
brainslayer
Message:

move

Location:
src/router/services/sysinit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/router/services/sysinit/init.c

    r33098 r33102  
    3939#define start_services() eval("startservices");
    4040
     41
     42
     43
     44static void set_tcp_params(void)
     45{
     46        eval("/etc/preinit");   // sets default values for ip_conntrack
     47        start_service("conntrack");
     48
     49        FILE *fp = fopen("/proc/sys/net/ipv4/tcp_available_congestion_control", "rb");
     50        if (fp == NULL) {
     51                char *vegas = "1";
     52                char *westwood = "0";
     53                char *bic = "0";
     54                if (nvram_match("tcp_congestion_control", "westwood")) {
     55                        westwood = "1";
     56                        vegas = "0";
     57                }
     58                if (nvram_match("tcp_congestion_control", "bic")) {
     59                        bic = "1";
     60                        vegas = "0";
     61                }
     62                writeprocsysnet("ipv4/tcp_westwood", westwood);
     63                writeprocsysnet("ipv4/tcp_vegas_cong_avoid", vegas);
     64                writeprocsysnet("ipv4/tcp_bic", bic);
     65                writeprocsysnet("ipv4/tcp_vegas_alpha", "3");
     66                writeprocsysnet("ipv4/tcp_vegas_beta", "3");
     67        } else {
     68                fclose(fp);
     69                writeprocsysnet("ipv4/tcp_congestion_control", nvram_default_get("tcp_congestion_control", "westwood"));
     70        }
     71
     72}
     73
     74
     75void start_post_sysinit(void)
     76{
     77        int brand = getRouterBrand();
     78
     79        led_control(LED_POWER, LED_ON);
     80        led_control(LED_SES, LED_OFF);
     81        led_control(LED_SES2, LED_OFF);
     82        led_control(LED_DIAG, LED_OFF);
     83        led_control(LED_BRIDGE, LED_OFF);
     84        led_control(LED_WLAN0, LED_OFF);
     85        led_control(LED_WLAN1, LED_OFF);
     86        led_control(LED_WLAN2, LED_OFF);
     87        led_control(LED_CONNECTED, LED_OFF);
     88        led_control(LED_USB, LED_OFF);
     89        led_control(LED_USB1, LED_OFF);
     90        led_control(USB_POWER, LED_OFF);
     91        led_control(USB_POWER1, LED_OFF);
     92        led_control(LED_DMZ, LED_OFF);
     93        led_control(LED_VPN, LED_OFF);
     94        led_control(LED_SEC0, LED_OFF);
     95        led_control(LED_SEC1, LED_OFF);
     96
     97        start_nvram();
     98
     99        /*
     100         * Restore defaults if necessary
     101         */
     102
     103#ifdef HAVE_SKYTEL
     104        nvram_set("vlan0ports", "0 1 2 3 4 5*");
     105        nvram_set("vlan1ports", "");
     106#else
     107
     108        if (brand == ROUTER_WRT600N || brand == ROUTER_WRT610N) {
     109                nvram_set("vlan2hwname", "et0");
     110        }
     111#endif
     112        start_restore_defaults();
     113
     114        nvram_seti("wanup", 0);
     115        set_ip_forward('1');
     116        set_tcp_params();
     117#ifdef HAVE_JFFS2
     118        start_jffs2();
     119#endif
     120#ifdef HAVE_MMC
     121        start_mmc();
     122#endif
     123
     124        start_mkfiles();
     125        char *hostname;
     126
     127        /*
     128         * set hostname to wan_hostname or router_name
     129         */
     130        if (strlen(nvram_safe_get("wan_hostname")) > 0)
     131                hostname = nvram_safe_get("wan_hostname");
     132        else if (strlen(nvram_safe_get("router_name")) > 0)
     133                hostname = nvram_safe_get("router_name");
     134        else
     135                hostname = "dd-wrt";
     136
     137        sethostname(hostname, strlen(hostname));
     138        stop_httpd();
     139
     140        // create loginprompt
     141        FILE *fp = fopen("/tmp/loginprompt", "wb");
     142
     143#ifndef HAVE_MAKSAT
     144#ifndef HAVE_TRIMAX
     145#ifndef HAVE_WIKINGS
     146#ifndef HAVE_ESPOD
     147#ifndef HAVE_IPR
     148#ifndef HAVE_NEXTMEDIA
     149#ifndef HAVE_ERC
     150#ifndef HAVE_CORENET
     151#ifdef HAVE_TMK
     152        fprintf(fp, "KMT-WAS %s (c) 2017 KMT GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
     153#elif HAVE_SANSFIL
     154        fprintf(fp, "SANSFIL %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
     155#elif HAVE_KORENRON
     156        fprintf(fp, "KORENRON %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
     157#elif HAVE_TESTEM
     158        fprintf(fp, "TESTEM %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
     159#elif HAVE_HOBBIT
     160        fprintf(fp, "HQ-NDS %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
     161#elif HAVE_ONNET
     162#ifdef HAVE_ONNET_BLANK
     163        fprintf(fp, "Enterprise AP %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
     164#elif HAVE_UNFY
     165        //fprintf(fp, "UNIFY %s (c) 2013 \nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
     166        fprintf(fp, "Firmware %s (c) 2017 \nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
     167#else
     168        fprintf(fp, "OTAi %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
     169#endif
     170#elif HAVE_RAYTRONIK
     171        fprintf(fp, "RAYTRONIK %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
     172#elif HAVE_HDWIFI
     173        fprintf(fp, "HDWIFI %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
     174#else
     175#ifdef DIST
     176        if (strlen(DIST) > 0)
     177                fprintf(fp, "DD-WRT v3.0-r%s %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE "\n", SVN_REVISION, DIST);
     178        else
     179                fprintf(fp, "DD-WRT v3.0-r%s custom (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE "\n", SVN_REVISION);
     180#else
     181        fprintf(fp, "DD-WRT v3.0-r%s custom (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE "\n", SVN_REVISION);
     182#endif
     183#endif
     184#endif
     185#endif
     186#endif
     187#endif
     188#endif
     189#endif
     190#endif
     191#endif
     192
     193        fclose(fp);
     194
     195#ifndef HAVE_MADWIFI
     196#ifdef HAVE_QTN
     197        nvram_seti("qtn_ready", 0);
     198#endif
     199#endif
     200
     201
     202}
     203
     204
    41205void start_init_user(void)
    42206{
  • src/router/services/sysinit/sysinit.c

    r32590 r33102  
    31303130}
    31313131
    3132 void start_post_sysinit(void)
    3133 {
    3134         led_control(LED_POWER, LED_ON);
    3135         led_control(LED_SES, LED_OFF);
    3136         led_control(LED_SES2, LED_OFF);
    3137         led_control(LED_DIAG, LED_OFF);
    3138         led_control(LED_BRIDGE, LED_OFF);
    3139         led_control(LED_WLAN0, LED_OFF);
    3140         led_control(LED_WLAN1, LED_OFF);
    3141         led_control(LED_WLAN2, LED_OFF);
    3142         led_control(LED_CONNECTED, LED_OFF);
    3143         led_control(LED_USB, LED_OFF);
    3144         led_control(LED_USB1, LED_OFF);
    3145         led_control(USB_POWER, LED_OFF);
    3146         led_control(USB_POWER1, LED_OFF);
    3147         led_control(LED_DMZ, LED_OFF);
    3148         led_control(LED_VPN, LED_OFF);
    3149         led_control(LED_SEC0, LED_OFF);
    3150         led_control(LED_SEC1, LED_OFF);
    3151 }
    3152 
    31533132/*
    31543133 * States
Note: See TracChangeset for help on using the changeset viewer.