[package] fix a couple of bugs in smap (#5373)
[openwrt/svn-archive/archive.git] / net / smap / patches / 02-segfault-and-toofast-bugfixes.patch
1 diff -Naur smap.supported/config.h smap/config.h
2 --- smap.supported/config.h 2009-06-14 22:18:57.000000000 -0400
3 +++ smap/config.h 2009-06-24 16:36:50.000000000 -0400
4 @@ -113,6 +113,7 @@
5
6 #define DEFAULT_SIP_PORT 5060
7 #define DEFAULT_TIMEOUT 500 /* in ms */
8 +#define DEFAULT_RATELIMIT 25
9
10 /* randomizer related ********************************************************/
11 enum { RAND_CALLID = 1, RAND_TAG, RAND_CSEQ, RAND_BRANCH };
12 diff -Naur smap.supported/listener.c smap/listener.c
13 --- smap.supported/listener.c 2009-06-14 22:18:57.000000000 -0400
14 +++ smap/listener.c 2009-06-15 04:36:40.000000000 -0400
15 @@ -130,7 +130,7 @@
16 /* use Call-ID to match response to requests */
17 callid = response_getcallid(msg);
18 if (callid == 0) {
19 - error(ERR_NOTICE, "could not parse Call-ID");
20 + error(ERR_DEBUG, "could not parse Call-ID");
21 goto nextmsg;
22 }
23 state = state_lookup_by_callid(callid);
24 diff -Naur smap.supported/results.c smap/results.c
25 --- smap.supported/results.c 2009-06-14 22:18:57.000000000 -0400
26 +++ smap/results.c 2009-06-24 16:38:00.000000000 -0400
27 @@ -39,6 +39,7 @@
28 (task->results & RES_ICMP_REACH) ? "reachable" : "unreachable",
29 (task->results & RES_SIP_ENABLED) ? "enabled" : "disabled");
30 if (task->results & RES_SIP_ENABLED)
31 + error(ERR_DEBUG, "Looking up fingerprint");
32 fingerprint_lookup(*task->fp);
33 break;
34 default:
35 diff -Naur smap.supported/smap.c smap/smap.c
36 --- smap.supported/smap.c 2009-06-14 22:18:57.000000000 -0400
37 +++ smap/smap.c 2009-06-24 17:09:39.000000000 -0400
38 @@ -197,7 +197,7 @@
39 config.sip_port = DEFAULT_SIP_PORT;
40 config.sip_domain = NULL;
41 config.timeout = DEFAULT_TIMEOUT;
42 - config.ratelimit = 0;
43 + config.ratelimit = DEFAULT_RATELIMIT;
44
45 printf("\nsmap %s <hs@123.org> "
46 "http://www.wormulon.net/\n\n", SMAP_VERSION);
47 @@ -338,12 +338,15 @@
48 break; /* make gcc happy */
49 }
50 error_while_scanning:
51 -
52 pthread_join(pth_worker, NULL);
53 pthread_kill(pth_worker, SIGINT);
54 pthread_kill(pth_listener, SIGINT);
55 stats_dump();
56
57 + signal(SIGINT, SIG_DFL);
58 + signal(SIGTERM, SIG_DFL);
59 + signal(SIGKILL, SIG_DFL);
60 +
61 /* clean up */
62 pthread_mutex_destroy(&scrlock);
63 pthread_mutex_destroy(&tasklock);