Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
linux
Commits
c6e56994
Commit
c6e56994
authored
22 years ago
by
Harald Welte
Committed by
David S. Miller
22 years ago
Browse files
Options
Download
Email Patches
Plain Diff
net/ipv4/netfilter/ip_conntrack_core.c: Fix ip_conntrack_change_expect locking.
parent
1fc9d1fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
net/ipv4/netfilter/ip_conntrack_core.c
net/ipv4/netfilter/ip_conntrack_core.c
+9
-7
No files found.
net/ipv4/netfilter/ip_conntrack_core.c
View file @
c6e56994
...
...
@@ -1061,7 +1061,10 @@ int ip_conntrack_expect_related(struct ip_conntrack *related_to,
int
ip_conntrack_change_expect
(
struct
ip_conntrack_expect
*
expect
,
struct
ip_conntrack_tuple
*
newtuple
)
{
int
ret
;
MUST_BE_READ_LOCKED
(
&
ip_conntrack_lock
);
WRITE_LOCK
(
&
ip_conntrack_expect_tuple_lock
);
DEBUGP
(
"change_expect:
\n
"
);
DEBUGP
(
"exp tuple: "
);
DUMP_TUPLE
(
&
expect
->
tuple
);
...
...
@@ -1074,26 +1077,25 @@ int ip_conntrack_change_expect(struct ip_conntrack_expect *expect,
&&
LIST_FIND
(
&
ip_conntrack_expect_list
,
expect_clash
,
struct
ip_conntrack_expect
*
,
newtuple
,
&
expect
->
mask
))
{
/* Force NAT to find an unused tuple */
ret
urn
-
1
;
ret
=
-
1
;
}
else
{
WRITE_LOCK
(
&
ip_conntrack_expect_tuple_lock
);
memcpy
(
&
expect
->
ct_tuple
,
&
expect
->
tuple
,
sizeof
(
expect
->
tuple
));
memcpy
(
&
expect
->
tuple
,
newtuple
,
sizeof
(
expect
->
tuple
));
WRITE_UNLOCK
(
&
ip_conntrack_expect_tuple_lock
);
return
0
;
ret
=
0
;
}
}
else
{
/* Resent packet */
DEBUGP
(
"change expect: resent packet
\n
"
);
if
(
ip_ct_tuple_equal
(
&
expect
->
tuple
,
newtuple
))
{
ret
urn
0
;
ret
=
0
;
}
else
{
/* Force NAT to choose again the same port */
ret
urn
-
1
;
ret
=
-
1
;
}
}
WRITE_UNLOCK
(
&
ip_conntrack_expect_tuple_lock
);
return
-
1
;
return
ret
;
}
/* Alter reply tuple (maybe alter helper). If it's already taken,
...
...
This diff is collapsed.
Click to expand it.
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