/[gentoo-x86]/net-misc/l7-filter-userspace/files/l7-filter-userspace-0.11-map-access-threadsafe.patch
Gentoo

Contents of /net-misc/l7-filter-userspace/files/l7-filter-userspace-0.11-map-access-threadsafe.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sat Mar 3 15:31:46 2012 UTC (2 years, 4 months ago) by pacho
Branch: MAIN
CVS Tags: HEAD
Include fixes from debian and ppc/arm compatibility, bug #329397 (by Gavin Pryke).

(Portage version: 2.1.10.49/cvs/Linux x86_64)

1 --- l7-filter-userspace-0.11/l7-conntrack.cpp.orig 2009-02-26 21:40:28.000000000 +0000
2 +++ l7-filter-userspace-0.11/l7-conntrack.cpp 2010-07-23 13:03:23.000000000 +0100
3 @@ -195,11 +195,13 @@
4 {
5 nfct_conntrack_free(ct);
6 nfct_close(cth);
7 + pthread_mutex_destroy(&map_mutex);
8 }
9
10 l7_conntrack::l7_conntrack(void* l7_classifier_in)
11 {
12 l7_classifier = (l7_classify *)l7_classifier_in;
13 + pthread_mutex_init(&map_mutex, NULL);
14
15 // Now open a handler that is subscribed to all possible events
16 cth = nfct_open(CONNTRACK, NFCT_ALL_CT_GROUPS);
17 @@ -211,19 +213,27 @@
18
19 l7_connection *l7_conntrack::get_l7_connection(const string key)
20 {
21 - return l7_connections[key];
22 + l7_connection *conn;
23 + pthread_mutex_lock(&map_mutex);
24 + conn = l7_connections[key];
25 + pthread_mutex_unlock(&map_mutex);
26 + return conn;
27 }
28
29 void l7_conntrack::add_l7_connection(l7_connection* connection,
30 const string key)
31 {
32 + pthread_mutex_lock(&map_mutex);
33 l7_connections[key] = connection;
34 + pthread_mutex_unlock(&map_mutex);
35 }
36
37 void l7_conntrack::remove_l7_connection(const string key)
38 {
39 + pthread_mutex_lock(&map_mutex);
40 delete l7_connections[key];
41 l7_connections.erase(l7_connections.find(key));
42 + pthread_mutex_unlock(&map_mutex);
43 }
44
45 void l7_conntrack::start()
46 --- l7-filter-userspace-0.11/l7-conntrack.h.orig 2010-07-23 13:04:49.000000000 +0100
47 +++ l7-filter-userspace-0.11/l7-conntrack.h 2010-07-23 13:05:56.000000000 +0100
48 @@ -52,6 +52,7 @@
49 l7_map l7_connections;
50 struct nfct_conntrack *ct;
51 struct nfct_handle *cth; // the callback
52 + pthread_mutex_t map_mutex;
53
54 public:
55 l7_conntrack(void * foo);

  ViewVC Help
Powered by ViewVC 1.1.20