static void Handle_reload_config( rtapd *rtapd) { struct rtapd_config *newconf; #if MULTIPLE_RADIUS int i; #endif // MULTIPLE_RADIUS // DBGPRINT(RT_DEBUG_TRACE, "Reloading configuration\n"); /* create new config */ newconf = Config_read(rtapd->ioctl_sock, rtapd->prefix_wlan_name); if (newconf == NULL) { DBGPRINT(RT_DEBUG_ERROR, "Failed to read new configuration file - continuing with old.\n"); return; } /* TODO: update dynamic data based on changed configuration * items (e.g., open/close sockets, remove stations added to * deny list, etc.) */ Radius_client_flush(rtapd); Config_free(rtapd->conf); rtapd->conf = newconf; Apd_free_stas(rtapd); /* when reStartAP, no need to reallocate sock for (i = 0; i < rtapd->conf->SsidNum; i++) { if (rtapd->sock[i] >= 0) close(rtapd->sock[i]); rtapd->sock[i] = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); if (rtapd->sock[i] < 0) { perror("socket[PF_PACKET,SOCK_RAW]"); return; } }*/ #if MULTIPLE_RADIUS for (i = 0; i < MAX_MBSSID_NUM; i++) rtapd->radius->mbss_auth_serv_sock[i] = -1; #else rtapd->radius->auth_serv_sock = -1; #endif if (Radius_client_init(rtapd)) { DBGPRINT(RT_DEBUG_ERROR,"RADIUS client initialization failed.\n"); return; } #if MULTIPLE_RADIUS for (i = 0; i < rtapd->conf->SsidNum; i++) DBGPRINT(RT_DEBUG_TRACE, "auth_serv_sock[%d] = %d\n", i, rtapd->radius->mbss_auth_serv_sock[i]); #else DBGPRINT(RT_DEBUG_TRACE,"rtapd->radius->auth_serv_sock = %d\n",rtapd->radius->auth_serv_sock); #endif }
static void Handle_usr1(int sig, void *eloop_ctx, void *signal_ctx) { struct hapd_interfaces *rtapds = (struct hapd_interfaces *) eloop_ctx; struct rtapd_config *newconf; int i; DBGPRINT(RT_DEBUG_TRACE,"Reloading configuration\n"); for (i = 0; i < rtapds->count; i++) { rtapd *rtapd = rtapds->rtapd[i]; newconf = Config_read(rtapd->config_fname,0); if (newconf == NULL) { DBGPRINT(RT_DEBUG_ERROR,"Failed to read new configuration file - continuing with old.\n"); continue; } /* TODO: update dynamic data based on changed configuration * items (e.g., open/close sockets, remove stations added to * deny list, etc.) */ Radius_client_flush(rtapd); Config_free(rtapd->conf); rtapd->conf = newconf; Apd_free_stas(rtapd); /* when reStartAP, no need to reallocate sock for (i = 0; i < rtapd->conf->SsidNum; i++) { if (rtapd->sock[i] >= 0) close(rtapd->sock[i]); rtapd->sock[i] = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); if (rtapd->sock[i] < 0) { perror("socket[PF_PACKET,SOCK_RAW]"); return; } }*/ if (Radius_client_init(rtapd)) { DBGPRINT(RT_DEBUG_ERROR,"RADIUS client initialization failed.\n"); return; } #if MULTIPLE_RADIUS for (i = 0; i < rtapd->conf->SsidNum; i++) DBGPRINT(RT_DEBUG_TRACE, "auth_serv_sock[%d] = %d\n", i, rtapd->radius->mbss_auth_serv_sock[i]); #else DBGPRINT(RT_DEBUG_TRACE,"rtapd->radius->auth_serv_sock = %d\n",rtapd->radius->auth_serv_sock); #endif } }
static void Cyg_DOT1X(cyg_addrword_t param) #endif //__ECOS// { int ret = 1, i; pid_t auth_pid=1; char prefix_name[IFNAMSIZ+1]; strcpy(prefix_name, "ra"); DBGPRINT(RT_DEBUG_ERROR,"Start DOT1X Thread....\n"); // set number of configuration file 1 interfaces.count = 1; interfaces.rtapd = malloc(sizeof(rtapd *)); if (interfaces.rtapd == NULL) { DBGPRINT(RT_DEBUG_ERROR,"malloc failed\n"); exit(1); } eloop_init(&interfaces); interfaces.rtapd[0] = Apd_init(prefix_name); if (!interfaces.rtapd[0]) goto out; if (Apd_setup_interface(interfaces.rtapd[0])) goto out; eloop_run(); Apd_free_stas(interfaces.rtapd[0]); ret=0; out: for (i = 0; i < interfaces.count; i++) { if (!interfaces.rtapd[i]) continue; Apd_cleanup(interfaces.rtapd[i]); free(interfaces.rtapd[i]); } free(interfaces.rtapd); interfaces.rtapd = NULL; eloop_destroy(); DBGPRINT(RT_DEBUG_ERROR,"DOT1X_exit\n"); cyg_thread_exit(); return 0; }
static void Handle_usr1(int sig, void *eloop_ctx, void *signal_ctx) { struct hapd_interfaces *rtapds = (struct hapd_interfaces *) eloop_ctx; struct rtapd_config *newconf; int i; DBGPRINT(RT_DEBUG_TRACE,"Reloading configuration\n"); for (i = 0; i < rtapds->count; i++) { rtapd *rtapd = rtapds->rtapd[i]; newconf = Config_read(rtapd->ioctl_sock, rtapd->prefix_wlan_name); if (newconf == NULL) { DBGPRINT(RT_DEBUG_ERROR,"Failed to read new configuration file - continuing with old.\n"); continue; } /* TODO: update dynamic data based on changed configuration * items (e.g., open/close sockets, remove stations added to * deny list, etc.) */ Radius_client_flush(rtapd); Config_free(rtapd->conf); rtapd->conf = newconf; Apd_free_stas(rtapd); #if MULTIPLE_RADIUS for (i = 0; i < MAX_MBSSID_NUM; i++) rtapd->radius->mbss_auth_serv_sock[i] = -1; #else rtapd->radius->auth_serv_sock = -1; #endif if (Radius_client_init(rtapd)) { DBGPRINT(RT_DEBUG_ERROR,"RADIUS client initialization failed.\n"); return; } #if MULTIPLE_RADIUS for (i = 0; i < rtapd->conf->SsidNum; i++) DBGPRINT(RT_DEBUG_TRACE, "auth_serv_sock[%d] = %d\n", i, rtapd->radius->mbss_auth_serv_sock[i]); #else DBGPRINT(RT_DEBUG_TRACE,"rtapd->radius->auth_serv_sock = %d\n",rtapd->radius->auth_serv_sock); #endif } }
int main(int argc, char *argv[]) { struct hapd_interfaces interfaces; pid_t child_pid; int ret = 1, i; int c; pid_t auth_pid; char prefix_name[IFNAMSIZ+1]; printf("program name = '%s'\n", argv[0]); if (strstr(argv[0], "8021xdi")) { printf("1program name = '%s'\n", argv[0]); strcpy(prefix_name, "rai"); } else { printf("2program name = '%s'\n", argv[0]); strcpy(prefix_name, "ra"); } for (;;) { c = getopt(argc, argv, "d:i:h"); if (c < 0) break; switch (c) { case 'd': /* set Debug level - RT_DEBUG_OFF 0 RT_DEBUG_ERROR 1 RT_DEBUG_WARN 2 RT_DEBUG_TRACE 3 RT_DEBUG_INFO 4 */ printf("Set debug level as %s\n", optarg); RTDebugLevel = (int)strtol(optarg, 0, 10); break; #if 1 /* FIXME: original prefix name seems wrong. */ case 'i': // Assign the wireless interface when support multiple cards sprintf(prefix_name, "%s", optarg); break; #else case 'i': // Assign the wireless interface when support multiple cards sprintf(prefix_name, "%s%02d_", prefix_name, ((int)strtol(optarg, 0, 10) - 1)); break; #endif case 'h': default: usage(); break; } } printf("Ralink DOT1X daemon, version = '%s' \n", dot1x_version); DBGPRINT(RT_DEBUG_TRACE, "prefix_name = '%s'\n", prefix_name); child_pid = fork(); if (child_pid == 0) { auth_pid = getpid(); DBGPRINT(RT_DEBUG_TRACE, "Porcess ID = %d\n",auth_pid); openlog("rtdot1xd",0,LOG_DAEMON); // set number of configuration file 1 interfaces.count = 1; interfaces.rtapd = malloc(sizeof(rtapd *)); if (interfaces.rtapd == NULL) { DBGPRINT(RT_DEBUG_ERROR,"malloc failed\n"); exit(1); } eloop_init(&interfaces); eloop_register_signal(SIGINT, Handle_term, NULL); eloop_register_signal(SIGTERM, Handle_term, NULL); eloop_register_signal(SIGUSR1, Handle_usr1, NULL); eloop_register_signal(SIGHUP, Handle_usr1, NULL); interfaces.rtapd[0] = Apd_init(prefix_name); if (!interfaces.rtapd[0]) goto out; if (Apd_setup_interface(interfaces.rtapd[0])) goto out; // Notify driver about PID RT_ioctl(interfaces.rtapd[0]->ioctl_sock, RT_PRIV_IOCTL, (char *)&auth_pid, sizeof(int), prefix_name, 0, RT_SET_APD_PID | OID_GET_SET_TOGGLE); eloop_run(); Apd_free_stas(interfaces.rtapd[0]); ret = 0; out: for (i = 0; i < interfaces.count; i++) { if (!interfaces.rtapd[i]) continue; Apd_cleanup(interfaces.rtapd[i]); free(interfaces.rtapd[i]); } free(interfaces.rtapd); eloop_destroy(); closelog(); return ret; } else return 0; }
int main(int argc, char *argv[]) { struct hapd_interfaces interfaces; pid_t child_pid; int ret = 1, i; int c; pid_t auth_pid; for (;;) { c = getopt(argc, argv, "h"); if (c < 0) break; switch (c) { case 'h': usage(); break; default: break; } } child_pid = fork(); if (child_pid == 0) { auth_pid = getpid(); DBGPRINT(RT_DEBUG_TRACE, "Porcess ID = %d\n",auth_pid); openlog("rt61apd",0,LOG_DAEMON); // set number of configuration file 1 interfaces.count = 1; interfaces.rtapd = malloc(sizeof(rtapd *)); if (interfaces.rtapd == NULL) { DBGPRINT(RT_DEBUG_ERROR,"malloc failed\n"); exit(1); } eloop_init(&interfaces); eloop_register_signal(SIGINT, Handle_term, NULL); eloop_register_signal(SIGTERM, Handle_term, NULL); eloop_register_signal(SIGUSR1, Handle_usr1, NULL); eloop_register_signal(SIGHUP, Handle_usr1, NULL); DBGPRINT(RT_DEBUG_ERROR,"\n Configuration file: %s\n", RT61AP_SYSTEM_PATH); interfaces.rtapd[0] = Apd_init(strdup(RT61AP_SYSTEM_PATH),(int)getpid()); if (!interfaces.rtapd[0]) goto out; if (Apd_setup_interface(interfaces.rtapd[0])) goto out; // Notify driver about PID RT_ioctl(interfaces.rtapd[0], RT_PRIV_IOCTL, (u8*)&auth_pid, sizeof(int), 0, RT_SET_APD_PID | OID_GET_SET_TOGGLE); eloop_run(); Apd_free_stas(interfaces.rtapd[0]); ret = 0; out: for (i = 0; i < interfaces.count; i++) { if (!interfaces.rtapd[i]) continue; Apd_cleanup(interfaces.rtapd[i]); free(interfaces.rtapd[i]); } free(interfaces.rtapd); eloop_destroy(); closelog(); return ret; } else return 0; }
int main(int argc, char *argv[]) { struct hapd_interfaces interfaces; pid_t child_pid; int ret = 1, i; int c; for (;;) { c = getopt(argc, argv, "h"); if (c < 0) break; switch (c) { case 'h': usage(); break; default: break; } } child_pid = 0; if (child_pid == 0) { openlog("rt2500apd",0,LOG_DAEMON); // set number of configuration file 1 interfaces.count = 1; interfaces.rtapd = malloc(sizeof(rtapd *)); if (interfaces.rtapd == NULL) { DBGPRINT(RT_DEBUG_ERROR,"malloc failed\n"); exit(1); } eloop_init(&interfaces); eloop_register_signal(SIGINT, Handle_term, NULL); eloop_register_signal(SIGTERM, Handle_term, NULL); eloop_register_signal(SIGUSR1, Handle_usr1, NULL); eloop_register_signal(SIGHUP, Handle_usr1, NULL); DBGPRINT(RT_DEBUG_ERROR,"\n Configuration file: %s\n", RT2500AP_SYSTEM_PATH); interfaces.rtapd[0] = Apd_init(strdup(RT2500AP_SYSTEM_PATH),(int)getpid()); if (!interfaces.rtapd[0]) goto out; if (Apd_setup_interface(interfaces.rtapd[0])) goto out; eloop_run(); Apd_free_stas(interfaces.rtapd[0]); ret = 0; out: for (i = 0; i < interfaces.count; i++) { if (!interfaces.rtapd[i]) continue; Apd_cleanup(interfaces.rtapd[i]); free(interfaces.rtapd[i]); } free(interfaces.rtapd); eloop_destroy(); closelog(); return ret; } else return 0; }