Changeset 33101


Ignore:
Timestamp:
Aug 11, 2017, 11:11:00 AM (10 days ago)
Author:
brainslayer
Message:

move

File:
1 edited

Legend:

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

    r33096 r33101  
    422422static int noconsole = 0;
    423423
    424 static void set_tcp_params(void)
    425 {
    426         eval("/etc/preinit");   // sets default values for ip_conntrack
    427         start_service("conntrack");
    428 
    429         FILE *fp = fopen("/proc/sys/net/ipv4/tcp_available_congestion_control", "rb");
    430         if (fp == NULL) {
    431                 char *vegas = "1";
    432                 char *westwood = "0";
    433                 char *bic = "0";
    434                 if (nvram_match("tcp_congestion_control", "westwood")) {
    435                         westwood = "1";
    436                         vegas = "0";
    437                 }
    438                 if (nvram_match("tcp_congestion_control", "bic")) {
    439                         bic = "1";
    440                         vegas = "0";
    441                 }
    442                 writeprocsysnet("ipv4/tcp_westwood", westwood);
    443                 writeprocsysnet("ipv4/tcp_vegas_cong_avoid", vegas);
    444                 writeprocsysnet("ipv4/tcp_bic", bic);
    445                 writeprocsysnet("ipv4/tcp_vegas_alpha", "3");
    446                 writeprocsysnet("ipv4/tcp_vegas_beta", "3");
    447         } else {
    448                 fclose(fp);
    449                 writeprocsysnet("ipv4/tcp_congestion_control", nvram_default_get("tcp_congestion_control", "westwood"));
    450         }
    451 
    452 }
    453 
    454424/*
    455425 * Main loop
     
    459429        sigset_t sigset;
    460430        pid_t shell_pid = 0;
    461         uint boardflags;
    462431
    463432        /*
     
    476445        start_service("devinit");       //init /dev /proc etc.
    477446        start_service("sysinit");
    478         start_service("post_sysinit");
    479 #ifdef HAVE_SPEEDCHECKER
    480         start_service("speedchecker_init");
    481 #endif
    482         int brand = getRouterBrand();
    483447#ifndef HAVE_MICRO
    484448        if (console_init())
     
    499463        sigemptyset(&sigset);
    500464
     465        start_service("post_sysinit");
     466#ifdef HAVE_SPEEDCHECKER
     467        start_service("speedchecker_init");
     468#endif
     469
    501470        /*
    502471         * Give user a chance to run a shell before bringing up the rest of the
     
    507476                ddrun_shell(1, 0);
    508477        cprintf("setup nvram\n");
    509 
    510         start_service("nvram");
    511 
    512         /*
    513          * Restore defaults if necessary
    514          */
    515 
    516 #ifdef HAVE_SKYTEL
    517         nvram_set("vlan0ports", "0 1 2 3 4 5*");
    518         nvram_set("vlan1ports", "");
    519 #else
    520 
    521         if (brand == ROUTER_WRT600N || brand == ROUTER_WRT610N) {
    522                 nvram_set("vlan2hwname", "et0");
    523         }
    524 #endif
    525         start_service("restore_defaults");
    526 
    527         /*
    528          * Add vlan
    529          */
    530         boardflags = strtoul(nvram_safe_get("boardflags"), NULL, 0);
    531         nvram_seti("wanup", 0);
    532 
    533         set_ip_forward('1');
    534         set_tcp_params();
    535 #ifdef HAVE_JFFS2
    536         start_service_force("jffs2");
    537 #endif
    538 #ifdef HAVE_MMC
    539         start_service_force("mmc");
    540 #endif
    541 
    542         start_service("mkfiles");
    543         char *hostname;
    544 
    545         /*
    546          * set hostname to wan_hostname or router_name
    547          */
    548         if (strlen(nvram_safe_get("wan_hostname")) > 0)
    549                 hostname = nvram_safe_get("wan_hostname");
    550         else if (strlen(nvram_safe_get("router_name")) > 0)
    551                 hostname = nvram_safe_get("router_name");
    552         else
    553                 hostname = "dd-wrt";
    554 
    555         sethostname(hostname, strlen(hostname));
    556         stop_service("httpd");
    557 
    558         // create loginprompt
    559         FILE *fp = fopen("/tmp/loginprompt", "wb");
    560 
    561 #ifndef HAVE_MAKSAT
    562 #ifndef HAVE_TRIMAX
    563 #ifndef HAVE_WIKINGS
    564 #ifndef HAVE_ESPOD
    565 #ifndef HAVE_IPR
    566 #ifndef HAVE_NEXTMEDIA
    567 #ifndef HAVE_ERC
    568 #ifndef HAVE_CORENET
    569 #ifdef HAVE_TMK
    570         fprintf(fp, "KMT-WAS %s (c) 2017 KMT GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
    571 #elif HAVE_SANSFIL
    572         fprintf(fp, "SANSFIL %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
    573 #elif HAVE_KORENRON
    574         fprintf(fp, "KORENRON %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
    575 #elif HAVE_TESTEM
    576         fprintf(fp, "TESTEM %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
    577 #elif HAVE_HOBBIT
    578         fprintf(fp, "HQ-NDS %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
    579 #elif HAVE_ONNET
    580 #ifdef HAVE_ONNET_BLANK
    581         fprintf(fp, "Enterprise AP %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
    582 #elif HAVE_UNFY
    583         //fprintf(fp, "UNIFY %s (c) 2013 \nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
    584         fprintf(fp, "Firmware %s (c) 2017 \nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
    585 #else
    586         fprintf(fp, "OTAi %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
    587 #endif
    588 #elif HAVE_RAYTRONIK
    589         fprintf(fp, "RAYTRONIK %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
    590 #elif HAVE_HDWIFI
    591         fprintf(fp, "HDWIFI %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE " (SVN revision: %s)\n", DIST, SVN_REVISION);
    592 #else
    593 #ifdef DIST
    594         if (strlen(DIST) > 0)
    595                 fprintf(fp, "DD-WRT v3.0-r%s %s (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE "\n", SVN_REVISION, DIST);
    596         else
    597                 fprintf(fp, "DD-WRT v3.0-r%s custom (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE "\n", SVN_REVISION);
    598 #else
    599         fprintf(fp, "DD-WRT v3.0-r%s custom (c) 2017 NewMedia-NET GmbH\nRelease: " BUILD_DATE "\n", SVN_REVISION);
    600 #endif
    601 #endif
    602 #endif
    603 #endif
    604 #endif
    605 #endif
    606 #endif
    607 #endif
    608 #endif
    609 #endif
    610 
    611         fclose(fp);
    612 
    613 #ifndef HAVE_MADWIFI
    614 #ifdef HAVE_QTN
    615         nvram_seti("qtn_ready", 0);
    616 #endif
    617 #endif
    618         int c;
    619478
    620479        /*
Note: See TracChangeset for help on using the changeset viewer.