Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
e807e566
Commit
e807e566
authored
Feb 24, 2012
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git://1984.lsi.us.es/net
parents
bff52857
7d367e06
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
12 deletions
+39
-12
include/net/netfilter/nf_conntrack.h
include/net/netfilter/nf_conntrack.h
+1
-1
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_conntrack_core.c
+34
-4
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_conntrack_netlink.c
+4
-7
No files found.
include/net/netfilter/nf_conntrack.h
View file @
e807e566
...
...
@@ -209,7 +209,7 @@ extern struct nf_conntrack_tuple_hash *
__nf_conntrack_find
(
struct
net
*
net
,
u16
zone
,
const
struct
nf_conntrack_tuple
*
tuple
);
extern
void
nf_conntrack_hash
_insert
(
struct
nf_conn
*
ct
);
extern
int
nf_conntrack_hash_check
_insert
(
struct
nf_conn
*
ct
);
extern
void
nf_ct_delete_from_lists
(
struct
nf_conn
*
ct
);
extern
void
nf_ct_insert_dying_list
(
struct
nf_conn
*
ct
);
...
...
net/netfilter/nf_conntrack_core.c
View file @
e807e566
...
...
@@ -404,19 +404,49 @@ static void __nf_conntrack_hash_insert(struct nf_conn *ct,
&
net
->
ct
.
hash
[
repl_hash
]);
}
void
nf_conntrack_hash_insert
(
struct
nf_conn
*
ct
)
int
nf_conntrack_hash_check_insert
(
struct
nf_conn
*
ct
)
{
struct
net
*
net
=
nf_ct_net
(
ct
);
unsigned
int
hash
,
repl_hash
;
struct
nf_conntrack_tuple_hash
*
h
;
struct
hlist_nulls_node
*
n
;
u16
zone
;
zone
=
nf_ct_zone
(
ct
);
hash
=
hash_conntrack
(
net
,
zone
,
&
ct
->
tuplehash
[
IP_CT_DIR_ORIGINAL
].
tuple
);
repl_hash
=
hash_conntrack
(
net
,
zone
,
&
ct
->
tuplehash
[
IP_CT_DIR_REPLY
].
tuple
);
hash
=
hash_conntrack
(
net
,
zone
,
&
ct
->
tuplehash
[
IP_CT_DIR_ORIGINAL
].
tuple
);
repl_hash
=
hash_conntrack
(
net
,
zone
,
&
ct
->
tuplehash
[
IP_CT_DIR_REPLY
].
tuple
);
spin_lock_bh
(
&
nf_conntrack_lock
);
/* See if there's one in the list already, including reverse */
hlist_nulls_for_each_entry
(
h
,
n
,
&
net
->
ct
.
hash
[
hash
],
hnnode
)
if
(
nf_ct_tuple_equal
(
&
ct
->
tuplehash
[
IP_CT_DIR_ORIGINAL
].
tuple
,
&
h
->
tuple
)
&&
zone
==
nf_ct_zone
(
nf_ct_tuplehash_to_ctrack
(
h
)))
goto
out
;
hlist_nulls_for_each_entry
(
h
,
n
,
&
net
->
ct
.
hash
[
repl_hash
],
hnnode
)
if
(
nf_ct_tuple_equal
(
&
ct
->
tuplehash
[
IP_CT_DIR_REPLY
].
tuple
,
&
h
->
tuple
)
&&
zone
==
nf_ct_zone
(
nf_ct_tuplehash_to_ctrack
(
h
)))
goto
out
;
add_timer
(
&
ct
->
timeout
);
nf_conntrack_get
(
&
ct
->
ct_general
);
__nf_conntrack_hash_insert
(
ct
,
hash
,
repl_hash
);
NF_CT_STAT_INC
(
net
,
insert
);
spin_unlock_bh
(
&
nf_conntrack_lock
);
return
0
;
out:
NF_CT_STAT_INC
(
net
,
insert_failed
);
spin_unlock_bh
(
&
nf_conntrack_lock
);
return
-
EEXIST
;
}
EXPORT_SYMBOL_GPL
(
nf_conntrack_hash_insert
);
EXPORT_SYMBOL_GPL
(
nf_conntrack_hash_
check_
insert
);
/* Confirm a connection given skb; places it in hash table */
int
...
...
net/netfilter/nf_conntrack_netlink.c
View file @
e807e566
...
...
@@ -1465,11 +1465,10 @@ ctnetlink_create_conntrack(struct net *net, u16 zone,
if
(
tstamp
)
tstamp
->
start
=
ktime_to_ns
(
ktime_get_real
());
add_timer
(
&
ct
->
timeout
);
spin_lock_bh
(
&
nf_conntrack_lock
);
nf_conntrack_hash_insert
(
ct
);
nf_conntrack_get
(
&
ct
->
ct_general
);
spin_unlock_bh
(
&
nf_conntrack_lock
);
err
=
nf_conntrack_hash_check_insert
(
ct
);
if
(
err
<
0
)
goto
err2
;
rcu_read_unlock
();
return
ct
;
...
...
@@ -1511,12 +1510,10 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
return
err
;
}
spin_lock_bh
(
&
nf_conntrack_lock
);
if
(
cda
[
CTA_TUPLE_ORIG
])
h
=
nf_conntrack_find_get
(
net
,
zone
,
&
otuple
);
else
if
(
cda
[
CTA_TUPLE_REPLY
])
h
=
nf_conntrack_find_get
(
net
,
zone
,
&
rtuple
);
spin_unlock_bh
(
&
nf_conntrack_lock
);
if
(
h
==
NULL
)
{
err
=
-
ENOENT
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment