diff --git a/package/allwinner/softap/src/include/wifi.h b/package/allwinner/softap/src/include/wifi.h index 6d671de30..6062d3bf1 100755 --- a/package/allwinner/softap/src/include/wifi.h +++ b/package/allwinner/softap/src/include/wifi.h @@ -150,20 +150,24 @@ int wifi_change_fw_path(const char *fwpath); */ #ifndef WIFI_ENTROPY_FILE -#define WIFI_ENTROPY_FILE "/etc/wifi/entropy.bin" +//#define WIFI_ENTROPY_FILE "/etc/wifi/entropy.bin" +#define WIFI_ENTROPY_FILE "/mnt/UDISK/wifi/entropy.bin" #endif int ensure_entropy_file_exists(); /*path of firmware for WIFI in different mode*/ #ifndef WIFI_DRIVER_FW_PATH_STA -#define WIFI_DRIVER_FW_PATH_STA "/lib/firmware/fw_bcm43438a0.bin" +//#define WIFI_DRIVER_FW_PATH_STA "/lib/firmware/fw_bcm43438a0.bin" +#define WIFI_DRIVER_FW_PATH_STA "/lib/firmware/fw_bcm43436b0.bin" #endif #ifndef WIFI_DRIVER_FW_PATH_AP -#define WIFI_DRIVER_FW_PATH_AP "/lib/firmware/fw_bcm43438a0_apsta.bin" +//#define WIFI_DRIVER_FW_PATH_AP "/lib/firmware/fw_bcm43438a0_apsta.bin" +#define WIFI_DRIVER_FW_PATH_AP "/lib/firmware/fw_bcm43436b0_apsta.bin" #endif #ifndef WIFI_DRIVER_FW_PATH_P2P -#define WIFI_DRIVER_FW_PATH_P2P "/lib/firmware/fw_bcm43438a0_p2p.bin" +//#define WIFI_DRIVER_FW_PATH_P2P "/lib/firmware/fw_bcm43438a0_p2p.bin" +#define WIFI_DRIVER_FW_PATH_P2P "/lib/firmware/fw_bcm43436b0_p2p.bin" #endif #ifndef WIFI_DRIVER_FW_PATH_PARAM diff --git a/package/allwinner/softap/src/netd_softap_controller.c b/package/allwinner/softap/src/netd_softap_controller.c index 80329b897..a953ee210 100755 --- a/package/allwinner/softap/src/netd_softap_controller.c +++ b/package/allwinner/softap/src/netd_softap_controller.c @@ -43,15 +43,18 @@ #include "netd_softap_controller.h" #include "filesystem_config.h" -static const char HOSTAPD_CONF_FILE[] = "/etc/wifi/hostapd.conf"; +static const char HOSTAPD_CONF_FILE_PREV[] = "/etc/wifi/hostapd.conf"; +static const char HOSTAPD_CONF_FILE[] = "/mnt/UDISK/wifi/hostapd.conf"; static const char HOSTAPD_BIN_FILE[] = "/usr/sbin/hostapd"; +static const char SUPP_CONFIG_DIR[] = "/mnt/UDISK/wifi/"; #ifndef SHA256_DIGEST_LENGTH #define SHA256_DIGEST_LENGTH 32 #endif #ifndef WIFI_ENTROPY_FILE -#define WIFI_ENTROPY_FILE "/etc/wifi/entropy.bin" +//#define WIFI_ENTROPY_FILE "/etc/wifi/entropy.bin" +#define WIFI_ENTROPY_FILE "/mnt/UDISK/wifi/entropy.bin" #endif #ifndef WIFI_GET_FW_PATH_AP @@ -93,6 +96,104 @@ SoftapController::SoftapController() SoftapController::~SoftapController() { } */ + +static int ensure_dir_exits(const char * dir) +{ + if(NULL == dir) return -1; + if(NULL == opendir(dir)) + { + return mkdir(dir,S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } + + return 0; +} + +static int ensure_file_exists(const char *config_file,const char *temp_file) +{ + char* buf = NULL; + int srcfd, destfd; + struct stat sb; + int nread; + int ret; + + ret = access(config_file, R_OK|W_OK); + if ((ret == 0) || (errno == EACCES)) { + goto END; + } else if (errno != ENOENT) { + printf("Cannot access \"%s\": %s\n", config_file, strerror(errno)); + goto ERR; + } + + srcfd = TEMP_FAILURE_RETRY(open(temp_file, O_RDONLY)); + if (srcfd < 0) { + printf("Cannot open \"%s\": %s\n", temp_file, strerror(errno)); + goto ERR; + } + + destfd = TEMP_FAILURE_RETRY(open(config_file, O_CREAT|O_RDWR, 0660)); + if (destfd < 0) { + close(srcfd); + printf("Cannot create \"%s\": %s\n", config_file, strerror(errno)); + goto ERR; + } + + buf = (char*)calloc(1, sizeof(char)*2048); + if(buf == NULL) + { + printf("Cannot malloc buf!\n"); + goto ERR; + } + + while ((nread = TEMP_FAILURE_RETRY(read(srcfd, buf, sizeof(buf)))) != 0) { + if (nread < 0) { + printf("Error reading \"%s\": %s\n", temp_file, strerror(errno)); + close(srcfd); + close(destfd); + unlink(config_file); + goto ERR; + } + TEMP_FAILURE_RETRY(write(destfd, buf, nread)); + memset(buf, 0, 2048); + } + + close(destfd); + close(srcfd); + + /* chmod is needed because open() didn't set permisions properly */ + if (chmod(config_file, 0660) < 0) { + printf("Error changing permissions of %s to 0660: %s\n",config_file, strerror(errno)); + unlink(config_file); + goto ERR; + } + +END: + if(buf) free(buf); + return 0; + +ERR: + if(buf) free(buf); + return -1; + +} + + +static int check_conf_file() +{ + if(ensure_dir_exits(SUPP_CONFIG_DIR)) + { + printf("ensure_dir_exits %s fail\n", SUPP_CONFIG_DIR); + return -1; + } + + if(ensure_file_exists(HOSTAPD_CONF_FILE,HOSTAPD_CONF_FILE_PREV)) + { + printf("ensure_file_exists %s error\n", HOSTAPD_CONF_FILE); + return -1; + } + + return 0; +} + static void sig_chld(int signo) { int status; @@ -193,7 +294,7 @@ int is_softap_started() { * argv[6] - Security:wpa-psk/wpa2-psk/open * argv[7] - Key */ -int set_softap(int set_num, char *argv[]) { +int set_softap(int argc, char *argv[]) { char psk_str[2*SHA256_DIGEST_LENGTH+1]; tRESPONSE_CODE ret = SOFTAP_STATUS_RESULT; int i = 0; @@ -207,7 +308,13 @@ int set_softap(int set_num, char *argv[]) { char wbuf[FW_BUF_SIZE] = {0}; char fbuf[FW_BUF_SIZE] = {0}; - if (set_num < 5) { + if(check_conf_file() == -1) + { + printf("Softap conf file path err!"); + return OPERATION_FAILED; + } + + if (argc < 5) { printf("Softap set is missing arguments. Please use:"); printf("softap "); return COMMAND_SYNTAX_ERROR; @@ -216,7 +323,7 @@ int set_softap(int set_num, char *argv[]) { if (!strcasecmp(argv[4], "hidden")) hidden = 1; - if (set_num >= 5) { + if (argc >= 5) { channel = atoi(argv[5]); if (channel <= 0) channel = AP_CHANNEL_DEFAULT; @@ -232,7 +339,7 @@ int set_softap(int set_num, char *argv[]) { "hw_mode=g\nignore_broadcast_ssid=%d\n", argv[2], argv[3], channel, hidden); - if (set_num > 7) { + if (argc > 7) { if (!strcmp(argv[6], "wpa-psk")) { generate_psk(argv[3], argv[7], psk_str); /* @@ -252,7 +359,7 @@ int set_softap(int set_num, char *argv[]) { */ sprintf(fbuf, "%s", wbuf); } - } else if (set_num > 6) { + } else if (argc > 6) { if (!strcmp(argv[6], "open")) { /* asprintf(&fbuf, "%s", wbuf); @@ -310,32 +417,32 @@ int set_softap(int set_num, char *argv[]) { * argv[2] - interface name * argv[3] - AP or P2P or STA */ -int fw_reload_softap(int set_num, char *argv[]) +int fw_reload_softap(int argc, char *argv[]) { int i = 0; char *fwpath = NULL; - if (set_num < 1) { + if (argc < 4) { printf("SoftAP fwreload is missing arguments. Please use: softap "); - printf("fw_reload_softap: argc is %d\n",set_num); + printf("fw_reload_softap: argc is %d\n",argc); return COMMAND_SYNTAX_ERROR; } - if (strcmp(argv[0], "AP") == 0) { + if (strcmp(argv[3], "AP") == 0) { fwpath = (char *)wifi_get_fw_path(WIFI_GET_FW_PATH_AP); - } else if (strcmp(argv[0], "P2P") == 0) { + } else if (strcmp(argv[3], "P2P") == 0) { fwpath = (char *)wifi_get_fw_path(WIFI_GET_FW_PATH_P2P); - } else if (strcmp(argv[0], "STA") == 0) { + } else if (strcmp(argv[3], "STA") == 0) { fwpath = (char *)wifi_get_fw_path(WIFI_GET_FW_PATH_STA); } if (!fwpath) return COMMAND_PARAMETER_ERROR; if (wifi_change_fw_path((const char *)fwpath)) { - printf("Softap fwReload failed\n"); + printf("Softap fwReload failed"); return OPERATION_FAILED; } else { - printf("Softap fwReload - Ok\n"); + printf("Softap fwReload - Ok"); } return SOFTAP_STATUS_RESULT; } diff --git a/package/netease/submodules b/package/netease/submodules index 562133728..c5b154eb7 160000 --- a/package/netease/submodules +++ b/package/netease/submodules @@ -1 +1 @@ -Subproject commit 5621337281135eec8f557f4499df03aab6e67677 +Subproject commit c5b154eb7d4ff8e14750c4a4e50ec48bfd64b1cb diff --git a/target/allwinner/mandolin-pv1/config-4.9 b/target/allwinner/mandolin-pv1/config-4.9 index f1574ad06..86487c434 100644 --- a/target/allwinner/mandolin-pv1/config-4.9 +++ b/target/allwinner/mandolin-pv1/config-4.9 @@ -265,9 +265,12 @@ CONFIG_DEBUG_VM=y # CONFIG_DEBUG_VM_VMACACHE is not set # CONFIG_DEBUG_WQ_FORCE_RR_CPU is not set CONFIG_DECOMPRESS_GZIP=y +CONFIG_DEFAULT_BBR=y CONFIG_DEFAULT_CFQ=y +# CONFIG_DEFAULT_CUBIC is not set # CONFIG_DEFAULT_DEADLINE is not set CONFIG_DEFAULT_IOSCHED="cfq" +CONFIG_DEFAULT_TCP_CONG="bbr" # CONFIG_DEFAULT_USE_ENERGY_AWARE is not set CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y @@ -883,7 +886,7 @@ CONFIG_SWP_EMULATE=y CONFIG_SW_SYNC=y CONFIG_SYNC_FILE=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y -# CONFIG_TCP_CONG_BBR is not set +CONFIG_TCP_CONG_BBR=y # CONFIG_TCP_CONG_NV is not set # CONFIG_TEE is not set # CONFIG_TEST_BITMAP is not set