--- embedtools/src/dwds.c 2010/10/27 15:23:49 1.1.2.4 +++ embedtools/src/dwds.c 2010/10/27 16:45:35 1.1.2.7 @@ -5,7 +5,6 @@ sl_config cfg; int Verbose, Kill, nif; char **ifs, szConfig[MAXPATHLEN] = DWDS_CONFIG; -struct dwds_if *wds; extern char compiled[], compiledby[], compilehost[]; @@ -54,7 +53,7 @@ sigHandler(int sig) } static int -RtMsg(struct rt_msghdr *msg, size_t len) +RtMsg(struct dwds_if *wds, struct rt_msghdr *msg, size_t len) { return 0; } @@ -69,6 +68,7 @@ main(int argc, char **argv) int s; struct sigaction sa; size_t len; + struct dwds_if *wds = NULL; while ((ch = getopt(argc, argv, "hvfc:")) != -1) switch (ch) { @@ -101,7 +101,7 @@ main(int argc, char **argv) return 1; } - if (fg) + if (!fg) switch (fork()) { case -1: printf("Error:: when fork() #%d - %s\n", errno, strerror(errno)); @@ -134,13 +134,18 @@ main(int argc, char **argv) goto end; } + if (!(wds = wifi_buildWDS(s, ifs, nif))) { + syslog(LOG_ERR, "Error:: Go to dead ...\n"); + goto end; + } + while (!Kill) { len = read(s, (void*) msg, sizeof msg); if (len == -1) { syslog(LOG_ERR, "Error:: read() #%d - %s\n", errno, strerror(errno)); Kill++; } else - RtMsg((struct rt_msghdr*) msg, len); + RtMsg(wds, (struct rt_msghdr*) msg, len); } close(s);