From 1d2618b2cc3ebbe55988351344956192ba6706ce Mon Sep 17 00:00:00 2001 From: leetking Date: Thu, 15 Sep 2016 16:16:39 +0800 Subject: [PATCH] =?UTF-8?q?[ALL]=20=E4=BF=AE=E6=94=B9=E4=B8=8D=E7=88=BD?= =?UTF-8?q?=E7=9A=84=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 4 ++-- common.c | 3 ++- eapol.c | 4 +++- main_cli.c | 9 +++++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index fb51fa7..088c240 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ -#CC := gcc +CC := gcc #针对路由器的,一般的cpu架构都是mips msb吧:),用于交叉编译 #MIPS MSB #CC := mips-openwrt-linux-gcc #MIPS LSB -CC := mipsel-openwrt-linux-gcc +#CC := mipsel-openwrt-linux-gcc RM := rm -rf CP := cp -r diff --git a/common.c b/common.c index f851a07..6f7c67b 100644 --- a/common.c +++ b/common.c @@ -2,8 +2,9 @@ * 一些通用的代码 */ #include -#include "common.h" #include +#include +#include "common.h" #ifdef LINUX # include diff --git a/eapol.c b/eapol.c index 465f913..ebd0b61 100644 --- a/eapol.c +++ b/eapol.c @@ -36,7 +36,6 @@ static char _uname[UNAME_LEN]; static char _pwd[PWD_LEN]; static int pwdlen; -static int mac_equal(uchar *mac1, uchar *mac2); static int eap_keep_alive(int skfd, struct sockaddr const *skaddr); static int eap_md5_clg(int skfd, struct sockaddr const *skaddr); static int eap_res_identity(int skfd, struct sockaddr const *skaddr); @@ -112,6 +111,7 @@ static int eapol_init(int *skfd, struct sockaddr *skaddr) */ static int filte_req_identity(int skfd, struct sockaddr const *skaddr) { + (void)skaddr; int stime = time((time_t*)NULL); for (; difftime(time((time_t*)NULL), stime) <= TIMEOUT;) { /* TODO 看下能不能只接受某类包,包过滤 */ @@ -135,6 +135,7 @@ static int filte_req_identity(int skfd, struct sockaddr const *skaddr) */ static int filte_req_md5clg(int skfd, struct sockaddr const *skaddr) { + (void)skaddr; int stime = time((time_t*)NULL); for (; difftime(time((time_t*)NULL), stime) <= TIMEOUT;) { recvfrom(skfd, recvbuff, BUFF_LEN, 0, NULL, NULL); @@ -174,6 +175,7 @@ static int filte_req_md5clg(int skfd, struct sockaddr const *skaddr) */ static int filte_success(int skfd, struct sockaddr const *skaddr) { + (void)skaddr; int stime = time((time_t*)NULL); for (; difftime(time((time_t*)NULL), stime) <= TIMEOUT;) { recvfrom(skfd, recvbuff, BUFF_LEN, 0, NULL, NULL); diff --git a/main_cli.c b/main_cli.c index ac8741b..aea0b21 100644 --- a/main_cli.c +++ b/main_cli.c @@ -22,8 +22,8 @@ int main(int argc, char **argv) char pwd[PWD_LEN]; char islogoff = 0; - char iskpalv = 0; #ifdef WINDOWS + char iskpalv = 0; char kpalv_if[IFNAMSIZ]; #endif @@ -33,7 +33,9 @@ int main(int argc, char **argv) } else if (0 == strcmp("-h", argv[1])) { help(argc, argv); return 0; - } else if (0 == strcmp("-k", argv[1])) { + } +#ifdef WINDOWS + if (0 == strcmp("-k", argv[1])) { /* * -k选项让这个程序作为心跳程序运行。 * -k ifname @@ -47,11 +49,13 @@ int main(int argc, char **argv) _D("kpalv_if: %s\n", kpalv_if); iskpalv = 1; } +#endif } if (0 != getconf(uname, pwd)) { fprintf(stderr, "Not configure.\n"); return 1; } + #ifdef WINDOWS /* windows下作为心跳进程运行的代码 */ if (iskpalv) { @@ -66,6 +70,7 @@ int main(int argc, char **argv) return 1; } #endif + if (islogoff) { eaplogoff(); return 0;