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
61c05fcd
Commit
61c05fcd
authored
May 26, 2003
by
Herbert Xu
Committed by
David S. Miller
May 26, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPSEC]: Order SPD using priority.
parent
32ac8e51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_policy.c
+20
-8
No files found.
net/xfrm/xfrm_policy.c
View file @
61c05fcd
...
@@ -244,22 +244,34 @@ static u32 xfrm_gen_index(int dir)
...
@@ -244,22 +244,34 @@ static u32 xfrm_gen_index(int dir)
int
xfrm_policy_insert
(
int
dir
,
struct
xfrm_policy
*
policy
,
int
excl
)
int
xfrm_policy_insert
(
int
dir
,
struct
xfrm_policy
*
policy
,
int
excl
)
{
{
struct
xfrm_policy
*
pol
,
**
p
;
struct
xfrm_policy
*
pol
,
**
p
;
struct
xfrm_policy
*
delpol
=
NULL
;
struct
xfrm_policy
**
newpos
=
NULL
;
write_lock_bh
(
&
xfrm_policy_lock
);
write_lock_bh
(
&
xfrm_policy_lock
);
for
(
p
=
&
xfrm_policy_list
[
dir
];
(
pol
=*
p
)
!=
NULL
;
p
=
&
pol
->
next
)
{
for
(
p
=
&
xfrm_policy_list
[
dir
];
(
pol
=*
p
)
!=
NULL
;
p
=
&
pol
->
next
)
{
if
(
memcmp
(
&
policy
->
selector
,
&
pol
->
selector
,
sizeof
(
pol
->
selector
))
==
0
)
{
if
(
!
delpol
&&
memcmp
(
&
policy
->
selector
,
&
pol
->
selector
,
sizeof
(
pol
->
selector
))
==
0
)
{
if
(
excl
)
{
if
(
excl
)
{
write_unlock_bh
(
&
xfrm_policy_lock
);
write_unlock_bh
(
&
xfrm_policy_lock
);
return
-
EEXIST
;
return
-
EEXIST
;
}
}
*
p
=
pol
->
next
;
delpol
=
pol
;
if
(
policy
->
priority
>
pol
->
priority
)
continue
;
}
else
if
(
policy
->
priority
>=
pol
->
priority
)
continue
;
if
(
!
newpos
)
newpos
=
p
;
if
(
delpol
)
break
;
break
;
}
}
}
if
(
newpos
)
p
=
newpos
;
xfrm_pol_hold
(
policy
);
xfrm_pol_hold
(
policy
);
policy
->
next
=
pol
?
pol
->
next
:
NULL
;
policy
->
next
=
*
p
;
*
p
=
policy
;
*
p
=
policy
;
atomic_inc
(
&
flow_cache_genid
);
atomic_inc
(
&
flow_cache_genid
);
policy
->
index
=
pol
?
pol
->
index
:
xfrm_gen_index
(
dir
);
policy
->
index
=
delpol
?
del
pol
->
index
:
xfrm_gen_index
(
dir
);
policy
->
curlft
.
add_time
=
(
unsigned
long
)
xtime
.
tv_sec
;
policy
->
curlft
.
add_time
=
(
unsigned
long
)
xtime
.
tv_sec
;
policy
->
curlft
.
use_time
=
0
;
policy
->
curlft
.
use_time
=
0
;
if
(
policy
->
lft
.
hard_add_expires_seconds
&&
if
(
policy
->
lft
.
hard_add_expires_seconds
&&
...
@@ -267,10 +279,10 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
...
@@ -267,10 +279,10 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
xfrm_pol_hold
(
policy
);
xfrm_pol_hold
(
policy
);
write_unlock_bh
(
&
xfrm_policy_lock
);
write_unlock_bh
(
&
xfrm_policy_lock
);
if
(
pol
)
{
if
(
del
pol
)
{
atomic_dec
(
&
pol
->
refcnt
);
atomic_dec
(
&
del
pol
->
refcnt
);
xfrm_policy_kill
(
pol
);
xfrm_policy_kill
(
del
pol
);
xfrm_pol_put
(
pol
);
xfrm_pol_put
(
del
pol
);
}
}
return
0
;
return
0
;
}
}
...
...
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