void start_upnpd(int isgateway, int sys_op) { #ifdef HOME_GATEWAY int intValue=0, intValue1=0; if(SetWlan_idx("wlan0")){ apmib_get(MIB_WLAN_WSC_DISABLE, (void *)&intValue); } if(isgateway==1 && sys_op !=1) apmib_get(MIB_UPNP_ENABLED, (void *)&intValue1); else intValue1=0; if(intValue==0 && intValue1==0){//wps enabled and upnp igd is disabled RunSystemCmd(NULL_FILE, "mini_upnpd", "-wsc", "/tmp/wscd_config", "-daemon", NULL_STR); //system("mini_upnpd -wsc /tmp/wscd_config &"); }else if(intValue==1 && intValue1==1){//wps is disabled, and upnp igd is enabled RunSystemCmd(NULL_FILE, "mini_upnpd", "-igd", "/tmp/igd_config", "-daemon", NULL_STR); //system("mini_upnpd -igd /tmp/igd_config &"); }else if(intValue==0 && intValue1==1){//both wps and upnp igd are enabled RunSystemCmd(NULL_FILE, "mini_upnpd", "-wsc", "/tmp/wscd_config", "-igd", "/tmp/igd_config","-daemon", NULL_STR); //system("mini_upnpd -wsc /tmp/wscd_config -igd /tmp/igd_config &"); }else if(intValue==1 && intValue1==0){//both wps and upnp igd are disabled /*do nothing*/ } #endif }
int init_mac() { char tmpBuff[200], cmdBuffer[100]; // set mac address for eth apmib_get(MIB_HW_NIC0_ADDR, (void *)tmpBuff); sprintf(cmdBuffer, "%02x%02x%02x%02x%02x%02x", (unsigned char)tmpBuff[0], (unsigned char)tmpBuff[1], (unsigned char)tmpBuff[2], (unsigned char)tmpBuff[3], (unsigned char)tmpBuff[4], (unsigned char)tmpBuff[5]); RunSystemCmd(NULL_FILE, "ifconfig", "eth0", "hw", "ether",cmdBuffer, NULL_STR); //printf( "JBB AEI MAC: %s - %s\n", "eth0", cmdBuffer ); // set mac address for wifi char wlan_name[16] = {0}; int para_id; for( wlan_idx=0; wlan_idx<2; wlan_idx++ ) { for( vwlan_idx=0; vwlan_idx<=4; vwlan_idx++ ) { switch(vwlan_idx) { case 0: para_id = MIB_HW_WLAN_ADDR; break; case 1: para_id = MIB_HW_WLAN_ADDR1; break; case 2: para_id = MIB_HW_WLAN_ADDR2; break; case 3: para_id = MIB_HW_WLAN_ADDR3; break; case 4: para_id = MIB_HW_WLAN_ADDR4; break; } apmib_get(para_id, (void *)tmpBuff); sprintf(cmdBuffer, "%02x%02x%02x%02x%02x%02x", (unsigned char)tmpBuff[0], (unsigned char)tmpBuff[1], (unsigned char)tmpBuff[2], (unsigned char)tmpBuff[3], (unsigned char)tmpBuff[4], (unsigned char)tmpBuff[5]); if(vwlan_idx) snprintf(wlan_name, sizeof(wlan_name), "wlan%d-va%d", wlan_idx, vwlan_idx-1 ); else snprintf(wlan_name, sizeof(wlan_name), "wlan%d", wlan_idx); //printf( "JBB AEI MAC: %s - %s\n", wlan_name, cmdBuffer ); RunSystemCmd(NULL_FILE, "ifconfig", wlan_name, "down", NULL_STR); RunSystemCmd(NULL_FILE, "ifconfig", wlan_name, "hw", "ether", cmdBuffer, NULL_STR); } } }
void set_log(void) { int intValue=0, intValue1=0; char tmpBuffer[32]; char syslog_para[32]; char localServer[32]; apmib_get(MIB_SCRLOG_ENABLED, (void*)&intValue); if(intValue !=0 && intValue !=2 && intValue !=4 && intValue !=6 && intValue !=8 && intValue !=10 && intValue !=12 && intValue !=14) { apmib_get(MIB_REMOTELOG_ENABLED, (void*)&intValue1); if(intValue1 != 0){ apmib_get(MIB_REMOTELOG_SERVER, (void *)tmpBuffer); if (memcmp(tmpBuffer, "\x0\x0\x0\x0", 4)){ #ifdef RINGLOG /* ring log */ sprintf(localServer, "%s", inet_ntoa(*((struct in_addr *)tmpBuffer))); system("rm /var/log/log_split >/dev/null 2>&1"); sprintf(tmpBuffer, "echo %d > /var/log/log_split", LOG_SPLIT); system(tmpBuffer); sprintf(tmpBuffer, "%d", MAX_LOG_SIZE); sprintf(syslog_para, "%d", LOG_SPLIT); fprintf(stderr, "syslog will use %dKB for log(%d rotate, 1 original, %dKB for each)\n", MAX_LOG_SIZE * (LOG_SPLIT+1), LOG_SPLIT, MAX_LOG_SIZE); RunSystemCmd(NULL_FILE, "syslogd", "-L","-R", localServer, "-s", tmpBuffer, "-b", syslog_para, NULL_STR); #else sprintf(syslog_para, "%s", inet_ntoa(*((struct in_addr *)tmpBuffer))); RunSystemCmd(NULL_FILE, "syslogd", "-L", "-R", syslog_para, NULL_STR); #endif } }else{ //### add by sen_liu 2011.4.21 sync the system log update (enlarge from 1 pcs to 8 pcs) to SDKv2.5 from kernel 2.4 #ifdef RINGLOG /* ring log */ system("rm /var/log/log_split >/dev/null 2>&1"); sprintf(tmpBuffer, "echo %d > /var/log/log_split", LOG_SPLIT); system(tmpBuffer); sprintf(tmpBuffer, "%d", MAX_LOG_SIZE); sprintf(syslog_para, "%d", LOG_SPLIT); fprintf(stderr, "syslog will use %dKB for log(%d rotate, 1 original, %dKB for each)\n", MAX_LOG_SIZE * (LOG_SPLIT+1), LOG_SPLIT, MAX_LOG_SIZE); RunSystemCmd(NULL_FILE, "syslogd", "-L", "-s", tmpBuffer, "-b", syslog_para, NULL_STR); #else //### end RunSystemCmd(NULL_FILE, "syslogd", "-L", NULL_STR); #endif } RunSystemCmd(NULL_FILE, "klogd", NULL_STR); } return; }
void clean_process(int sys_opmode,int wan_dhcp_mode,int gateway, int enable_wan, char *lanInterface, char *wlanInterface, char *wanInterface) { char strPID[10], tmpBuff[200]; int pid=-1; int i; RunSystemCmd(HW_NAT_FILE, "echo", "2", NULL_STR); /*bridge mode*/ RunSystemCmd(NULL_FILE, "killall", "-9", "reload", NULL_STR); }
void autoMountOnBootUp(void) { FILE *fp; int line=0; char buf[512]; char partition[32]; char usbMntCmd[64]; int ret=-1; if(isFileExist(PARTITION_FILE)){ fp= fopen(PARTITION_FILE, "r"); if (!fp) { printf("can not open /proc/partitions\n"); return; } while (fgets(buf, sizeof(buf), fp)) { ret=get_blockDevPartition(buf, &partition); if(ret==0) { if(Check_shouldMount(partition)==0){ sprintf(usbMntCmd, "DEVPATH=/sys/block/sda/%s ACTION=add usbmount block", partition); RunSystemCmd(NULL_FILE, "echo", usbMntCmd, NULL_STR); system(usbMntCmd); } } } fclose(fp); } }
void start_samba() { /*start samba*/ RunSystemCmd(NULL_FILE, "echo", "start samba", NULL_STR); RunSystemCmd(NULL_FILE, "mkdir", "/var/samba", NULL_STR); RunSystemCmd(NULL_FILE, "cp", "/etc/samba/smb.conf", "/var/samba/smb.conf", NULL_STR); RunSystemCmd("/var/group", "echo", " ", NULL_STR); RunSystemCmd(NULL_FILE, "cp", "/etc/group", "/var/group", NULL_STR); RunSystemCmd(NULL_FILE, "smbd", "-D", NULL_STR); RunSystemCmd(NULL_FILE, "nmbd", "-D", NULL_STR); }
int main(int argc, char *argv[]) { int i; unsigned char command[100]; //unsigned short fail_wait_time = 300; //unsigned int succ_wait_time = 86400; unsigned char ddns_type[10]; unsigned char ddns_domanin_name[51]; unsigned char ddns_user_name[51]; unsigned char ddns_password[51]; for(i=1; i<argc; i++) { if(argv[i][0]!='-') { fprintf(stderr, "%s: Unknown option\n", argv[i]); } else switch(argv[i][1]) { case 'x': isDaemon = 1; break; default: fprintf(stderr, "%s: Unknown option\n", argv[i]); } } sprintf((char *)ddns_type, "%s", argv[2]); sprintf((char *)ddns_user_name, "%s", argv[3]); sprintf((char *)ddns_password, "%s", argv[4]); sprintf((char *)ddns_domanin_name, "%s", argv[5]); sprintf((char *)command, "%s:%s", ddns_user_name, ddns_password); if(isDaemon==1){ if (daemon(0, 1) == -1) { perror("ntp_inet fork error"); return 0; } } RunSystemCmd(FIRSTDDNS, "echo", "pass", NULL_STR); for (;;) { //unsigned char cmdBuffer[100]; int ret; ret = RunSystemCmd(NULL_FILE, "updatedd", ddns_type, command, ddns_domanin_name, NULL_STR); if(ret == 0) // success { RunSystemCmd(NULL_FILE, "echo", "DDNS update successfully", NULL_STR); sleep(86430); } else // fail { sleep(300); } } return 0; }
int setinit(int argc, char** argv) { int i, cmdRet=-1; int intValue=0, intValue1=0; char cmdBuffer[100], tmpBuff[512]; char *token=NULL, *savestr1=NULL; char tmp_args[16]; char Ip[32], Mask[32], Gateway[32]; char strPID[32]; int pid = 0; int wlan_support = 0; int index; int old_wlan_idx; int repeater_enable1=0; int repeater_enable2=0; int reinit=1; #ifdef AEI_WECB if( (!strcmp(argv[2], "aei")) && (!strcmp(argv[3], "mac"))) { #ifdef AEI_CTL_BRIDGE init_mac(); #endif up_mib_value(); RunSystemCmd(REINIT_FILE, "echo", "1", NULL_STR); RunSystemCmd("/var/sys_op", "echo", "1", NULL_STR); RunSystemCmd("/proc/sys/net/ipv4/ip_forward", "echo", "0", NULL_STR); RunSystemCmd(PROC_BR_IGMPPROXY, "echo", "0", NULL_STR); /*cleanup hardware tables*/ RunSystemCmd(HW_NAT_FILE, "echo", "2", NULL_STR); /*bridge mode*/ RunSystemCmd("/proc/br_wlanblock", "echo","0",NULL_STR); RunSystemCmd(NULL_FILE, "iptables", "-F", NULL_STR); RunSystemCmd(NULL_FILE, "iptables", "-F", "-t", "nat", NULL_STR); RunSystemCmd(NULL_FILE, "iptables", "-A", "INPUT", "-j", "ACCEPT", NULL_STR); RunSystemCmd(NULL_FILE, "rm", "-f", "/var/eth1_ip", NULL_STR); RunSystemCmd(NULL_FILE, "rm", "-f", "/var/ntp_run", NULL_STR); //set kthreadd high priority for performance RunSystemCmd(NULL_FILE, "renice -20 2", NULL_STR); //set ksoftirqd high priority for performance RunSystemCmd(NULL_FILE, "renice -20 3", NULL_STR); //set boa high priority if(isFileExist(WEBS_PID_FILE)){ pid=getPid_fromFile(WEBS_PID_FILE); if(pid != 0){ sprintf(strPID, "%d", pid); RunSystemCmd(NULL_FILE, "renice", "-20", strPID, NULL_STR); } } RunSystemCmd("/proc/custom_Passthru", "echo", (intValue & 0x1)?"1":"0", NULL_STR); /*enable igmp snooping*/ /*igmp snooping is independent with igmp proxy*/ #ifdef AEI_IGMPV3 RunSystemCmd(PROC_BR_IGMPVERSION, "echo", "3", NULL_STR); #else RunSystemCmd(PROC_BR_IGMPVERSION, "echo", "2", NULL_STR); #endif RunSystemCmd(PROC_BR_IGMPSNOOP, "echo", "1", NULL_STR); #if defined(AEI_DISABLE_IGMP_QUERY) || defined(AEI_CONTROL_IGMP_QUERY) RunSystemCmd(PROC_BR_IGMPQUERY, "echo", "0", NULL_STR); #else RunSystemCmd(PROC_BR_IGMPQUERY, "echo", "1", NULL_STR); #endif RunSystemCmd(PROC_BR_MLDSNOOP, "echo", "1", NULL_STR); RunSystemCmd(PROC_BR_MLDQUERY, "echo", "1", NULL_STR); /*increase routing cache rebuild count from 4 to 2048*/ RunSystemCmd(RT_CACHE_REBUILD_COUNT, "echo", "2048", NULL_STR); return 0; } #endif //step 1: 802.1x client support #ifdef CONFIG_RTL_802_1X_CLIENT_SUPPORT if((isFileExist(RS_USER_CERT_5G)==0) && (isFileExist(RS_ROOT_CERT_5G)==0) && (isFileExist(RS_USER_CERT_2G)==0) && (isFileExist(RS_ROOT_CERT_2G)==0)){ RunSystemCmd(NULL_FILE, "rsCert","-rd", NULL_STR); } #endif printf("Init Start...\n"); //step 2 num_wlan_interface=get_interfaces_list(5, "wlan", NULL, wlan_interface, sizeof(wlan_interface)); num_wlan_virtual_interface=get_interfaces_list(9, "wlan", "-va", wlan_virtual_interface, sizeof(wlan_virtual_interface)); /*currently, we just support init gw/ap all */ // clean_process(BRIDGE_MODE,0,1, 1, "br0", wlan_interface, "eth1"); RunSystemCmd(HW_NAT_FILE, "echo", "2", NULL_STR); /*bridge mode*/ RunSystemCmd(NULL_FILE, "killall", "-9", "reload", NULL_STR); /*init wlan interface*/ //ifconfig rootap down && flash set_mib for(i=0;i<NUM_WLAN_INTERFACE;i++) { int wlan_disable = 1; unsigned char wlan_name[10]; memset(wlan_name,0x00,sizeof(wlan_name)); int j; for(j=0; j<NUM_VWLAN; j++){ sprintf(wlan_name, "wlan%d-va%d",i, j); RunSystemCmd(NULL_FILE, "ifconfig", wlan_name, "down", NULL_STR); } sprintf(wlan_name, "wlan%d",i); apmib_save_wlanIdx(); if(SetWlan_idx(wlan_name)) { apmib_get( MIB_WLAN_WLAN_DISABLED, (void *)&wlan_disable); if(wlan_disable == 1) { RunSystemCmd(NULL_FILE, "ifconfig", wlan_name, "down", NULL_STR); RunSystemCmd(NULL_FILE, "iwpriv", wlan_name, "radio_off", NULL_STR); } else { RunSystemCmd(NULL_FILE, "ifconfig", wlan_name, "down", NULL_STR); cmdRet=RunSystemCmd(NULL_FILE, "flash", "set_mib", wlan_name, NULL_STR); if(cmdRet != 0) { printf("init %s failed!\n", wlan_name); continue; } } } apmib_recov_wlanIdx(); } //ifconfig vap down && flash set_mib if(wlan_interface[0]){ if(wlan_virtual_interface[0]){ token=NULL; savestr1=NULL; sprintf(tmpBuff, "%s", wlan_virtual_interface); token = strtok_r(tmpBuff," ", &savestr1); do{ if (token == NULL){ break; }else{ RunSystemCmd(NULL_FILE, "ifconfig", token, "down", NULL_STR); RunSystemCmd(NULL_FILE, "flash", "set_mib", token, NULL_STR);/*set virtual wlan iface*/ } token = strtok_r(NULL, " ", &savestr1); }while(token !=NULL); } } /////////////////////////////////////////////////////////// //set_br_interface(tmpBuff); sprintf(tmpBuff, "%s %s", wlan_interface, wlan_virtual_interface); setbridge(tmpBuff);//ifconfig wlanx up or not sprintf(br_interface, "%s", "br0"); start_wlanapp(1); system("reload -k /var/wlsch.conf &"); #if defined(CONFIG_IPV6) set_ipv6(BRIDGE_MODE); #endif return 0; }
void start_vsftpd() { RunSystemCmd(NULL_FILE, "echo","start vsftpd", NULL_STR); RunSystemCmd(NULL_FILE, "cp", "/etc/vsftpd.conf", "/var/config/vsftpd.conf", NULL_STR); system("vsftpd /var/config/vsftpd.conf &"); }
void start_mount() { #if defined(HTTP_FILE_SERVER_SUPPORTED) RunSystemCmd("/proc/sys/vm/min_free_kbytes", "echo", "384", NULL_STR); RunSystemCmd("/proc/sys/net/core/rmem_max", "echo", "1048576", NULL_STR); RunSystemCmd("/proc/sys/net/core/wmem_max", "echo", "1048576", NULL_STR); RunSystemCmd("/proc/sys/net/ipv4/tcp_rmem", "echo", "4096 108544 4194304", NULL_STR); RunSystemCmd("/proc/sys/net/ipv4/tcp_wmem", "echo", "4096 108544 4194304", NULL_STR); RunSystemCmd("/proc/sys/net/ipv4/tcp_moderate_rcvbuf", "echo", "0", NULL_STR); #else /*config linux parameter for improving samba performance*/ RunSystemCmd("/proc/sys/vm/min_free_kbytes", "echo", "1024", NULL_STR); RunSystemCmd("/proc/sys/net/core/netdev_max_backlog", "echo", "8192", NULL_STR); RunSystemCmd("/proc/sys/net/core/optmem_max", "echo", "131072", NULL_STR); RunSystemCmd("/proc/sys/net/core/rmem_default", "echo", "524288", NULL_STR); RunSystemCmd("/proc/sys/net/core/rmem_max", "echo", "524288", NULL_STR); RunSystemCmd("/proc/sys/net/core/wmem_default", "echo", "524288", NULL_STR); RunSystemCmd("/proc/sys/net/core/wmem_max", "echo", "524288", NULL_STR); RunSystemCmd("/proc/sys/net/ipv4/tcp_rmem", "echo", "131072 262144 393216", NULL_STR); RunSystemCmd("/proc/sys/net/ipv4/tcp_wmem", "echo", "131072 262144 393216", NULL_STR); RunSystemCmd("/proc/sys/net/ipv4/tcp_mem", "echo", "768 1024 1380", NULL_STR); #endif /*config hot plug and auto-mount*/ RunSystemCmd("/proc/sys/kernel/hotplug", "echo", "/usr/hotplug", NULL_STR); RunSystemCmd(NULL_FILE, "mkdir", "-p /tmp/usb/", NULL_STR); /*force kernel to write data to disk, don't cache in memory for a long time*/ RunSystemCmd("/proc/sys/vm/vfs_cache_pressure", "echo", "10000", NULL_STR); RunSystemCmd("/proc/sys/vm/dirty_background_ratio", "echo", "5", NULL_STR); RunSystemCmd("/proc/sys/vm/dirty_writeback_centisecs", "echo", "100", NULL_STR); /*automatically mount partions listed in /proc/partitions*/ autoMountOnBootUp(); // RunSystemCmd("/var/group", "echo", " ", NULL_STR); // RunSystemCmd(NULL_FILE, "cp", "/etc/group", "/var/group", NULL_STR); }
int main(int argc, char *argv[]) { int i; int cnt;//patch for l2tp dial-on-demand wantype for(i=1; i<argc; i++) { if(argv[i][0]!='-') { fprintf(stderr, "%s: Unknown option\n", argv[i]); } else switch(argv[i][1]) { case 'c': ConnectType = atoi(argv[++i]); break; case 't': WanType = atoi(argv[++i]); break; case 'x': isDaemon = 1; break; default: fprintf(stderr, "%s: Unknown option\n", argv[i]); } } if(isDaemon==1){ if (daemon(0, 1) == -1) { perror("ppp_inet fork error"); return 0; } } cnt=0;//patch for l2tp dial-on-demand wantype for (;;) { //if(isFileExist(PPP_CONNECT_FILE)==0){ if((isFileExist(PPP_CONNECT_FILE)==0) && (isFileExist(PPP_PATCH_FILE)==0)){ sleep(3); //To avoid ppp1 if(WanType==3){ if(isFileExist("/var/disc")==0){ RunSystemCmd(PPP_CONNECT_FILE, "echo", "pass", NULL_STR); system("pppd &"); } } if(WanType==4){ if(isFileExist("/var/disc")==0){ RunSystemCmd(PPP_CONNECT_FILE, "echo", "pass", NULL_STR); system("pppd call rpptp &"); } } if(WanType==6){ if(isFileExist("/var/disc")==0){ usleep(1200000); //wait l2tpd init finish RunSystemCmd(PPP_CONNECT_FILE, "echo", "pass", NULL_STR); system("echo \"c client\" > /var/run/l2tp-control &"); } } #ifdef RTK_USB3G if(WanType==16){ if(isFileExist("/var/disc")==0){ RunSystemCmd(PPP_CONNECT_FILE, "echo", "pass", NULL_STR); system("pppd file /var/usb3g.option &"); } } #endif /* #ifdef RTK_USB3G */ }else{ if(WanType==6 && ConnectType==1){ if(isFileExist(PPPD_PID_FILE)==0){ //patch for l2tp dial-on-demand wantype //after 3 times, restart l2tpd if(cnt<3){ cnt++; }else{ RunSystemCmd(NULL_FILE, "killall", "-9", "l2tpd", NULL_STR); sleep(1); system("l2tpd &"); } unlink(PPP_CONNECT_FILE); /*force start pppd*/ } } } if(ConnectType==2) break; sleep(5); } return 0; }
int main(int argc, char** argv) { char line[300]; char action[16]; int i; //printf("start.......:%s\n",argv[1]); #if 0 if(strcmp(argv[1],"firewall")) { printf("******************\n"); for(i=0;i<argc;i++) { printf("%s ",argv[i]); } printf("\n***************\n"); } #endif if ( !apmib_init()) { printf("Initialize AP MIB failed !\n"); return -1; } apmib_initialized = 1; memset(line,0x00,300); if(argv[1] && (strcmp(argv[1], "init")==0)){ #if defined(CONFIG_RTL_ULINKER) #if defined(CONFIG_RTL_ULINKER_WLAN_DELAY_INIT) int ulinker_auto = 0; apmib_get(MIB_ULINKER_AUTO, (void *)&ulinker_auto); if (ulinker_auto == 0) system("echo \"wlan 1\" > /proc/wlan_init"); #endif if (strcmp(argv[3], "all")==0) { ulinker_bootup(); } #elif defined(CONFIG_POCKET_ROUTER_SUPPORT) pocketAP_bootup(); #endif #ifdef CONFIG_POCKET_AP_SUPPORT i=BRIDGE_MODE; apmib_set(MIB_OP_MODE,(void *)&i); apmib_get(MIB_DHCP, (void *)&i); //for FC, dhcp server not allowed when client if( i > DHCP_CLIENT ) i=0; apmib_set(MIB_DHCP, (void *)&i); //0:DHCP_DISABLED i = 0xc0a801fa; apmib_set(MIB_IP_ADDR, (void *)&i); //for FC, default IP to 192.168.1.250 #endif setinit(argc,argv); #if defined(CONFIG_RTL_ULINKER_WLAN_DELAY_INIT) if (ulinker_auto == 1) ulinker_wlan_init(); #endif return 0; } else if(argv[1] && (strcmp(argv[1], "br")==0)){ for(i=0;i<argc;i++){ if( i>2 ) string_casecade(line, argv[i]); } setbridge(line); } #ifdef HOME_GATEWAY else if(argv[1] && (strcmp(argv[1], "firewall")==0)){ if(argv[2] && (strcmp(argv[2], "Send_GARP")==0)) //it will be call by set_staticIP function { #ifdef SEND_GRATUITOUS_ARP sendArp(); #endif } else { setFirewallIptablesRules(argc,argv); } } else if(argv[1] && (strcmp(argv[1], "wlanapp")==0)){ for(i=0;i<argc;i++){ if( i>2 ) string_casecade(line, argv[i]); if(i==2) sprintf(action, "%s",argv[i]); } setWlan_Applications(action, line); }else if(argv[1] && (strcmp(argv[1], "disc")==0)){ sprintf(line, "%s", argv[2]); #ifdef MULTI_PPPOE if(argv[3]) wan_disconnect(line,argv[3]); else wan_disconnect(line,"NOMULPPPOE"); #else wan_disconnect(line); #endif }else if(argv[1] && ((strcmp(argv[1], "conn")==0)||(strcmp(argv[1], "renew")==0))){ if(argc < 4){ printf("sysconf conn Invalid agrments!\n"); return 0; } sprintf(action, "%s",argv[3]); for(i=0;i<argc;i++){ if( i>2 ) string_casecade(line, argv[i]); } if((strcmp(argv[1], "renew")==0)&&!strcmp(argv[2],"dhcp") &&!wan_dhcpcNeedRenewConn(action,line)) { return 0; } #if defined(CONFIG_DYNAMIC_WAN_IP) if((!strcmp(argv[2], "dhcp"))&&(isFileExist(TEMP_WAN_CHECK))){ RunSystemCmd(TEMP_WAN_DHCP_INFO, "echo", line, NULL_STR); } #endif #if defined(CONFIG_RTL_ULINKER) /* notice ulinker_process to reset domain name query */ system("echo 1 > /var/ulinker_reset_domain"); #endif #if defined(CONFIG_DOMAIN_NAME_QUERY_SUPPORT) if(!strcmp(action, "br0")) wan_connect_pocket(action, line); else wan_connect(action, line); #else wan_connect(action, line); #endif }else if(argv[1] && (strcmp(argv[1], "pppoe")==0)){ Init_Internet(argc,argv); }else if(argv[1] && (strcmp(argv[1], "pptp")==0)){ Init_Internet(argc,argv); }else if(argv[1] && (strcmp(argv[1], "l2tp")==0)){ Init_Internet(argc,argv); }else if(argv[1] && (strcmp(argv[1], "setQos")==0)){ Init_QoS(argc,argv); }else if(argv[1] && (strcmp(argv[1], "dhcpd")==0)){ sprintf(action, "%s",argv[2]); start_lan_dhcpd(action); } #if defined(CONFIG_DOMAIN_NAME_QUERY_SUPPORT) else if(argv[1] && (strcmp(argv[1], "upnpd")==0)){ if(argc < 4){ printf("sysconf upnpd Invalid agrments!\n"); return 0; } start_upnpd(atoi(argv[2]),atoi(argv[3])); } #endif //### add by sen_liu 2011.4.21 sync the system log update (enlarge from 1 pcs to 8 pcs) to SDKv2.5 from kernel 2.4 #if defined(RINGLOG) else if(argv[1] && (strcmp(argv[1], "log")==0)){ if (argc == 6 && !strcmp(argv[2], "-s") && !strcmp(argv[4], "-b")) { system("killall syslogd >/dev/null 2>&1"); system("rm /var/log/log_split >/dev/null 2>&1"); sprintf(line, "echo %s > /var/log/log_split", argv[5]); system(line); RunSystemCmd(NULL_FILE, "syslogd", "-L", "-s", argv[3], "-b", argv[5], NULL_STR); fprintf(stderr, "syslog will use %dKB for log(%s rotate, 1 original, %sKB for each).\n", atoi(argv[3]) * ((atoi(argv[5]))+1), argv[5], argv[3]); } /* else if (argc == 4 && !strcmp(argv[2], "-R")) { RunSystemCmd(NULL_FILE, "killall syslogd", NULL_STR); RunSystemCmd(NULL_FILE, "syslogd", "-L", "-R", argv[3], NULL_STR); } */ else { fprintf(stderr, "usage:\n"); fprintf(stderr, "sysconf log -s size -b number-of-rotate-backup\n"); //fprintf(stderr, "sysconf log -R IP\n"); } } #endif //### end #endif //#ifdef CONFIG_POCKET_ROUTER_SUPPORT // system("boa"); //#endif return 0; }