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
Kirill Smelkov
linux
Commits
4ebb54ba
Commit
4ebb54ba
authored
May 08, 2003
by
James Morris
Committed by
David S. Miller
May 08, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[XFRM]: Make use of xfrm_state_hold().
parent
37500bd7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
20 deletions
+20
-20
net/ipv4/xfrm4_state.c
net/ipv4/xfrm4_state.c
+4
-4
net/ipv6/xfrm6_state.c
net/ipv6/xfrm6_state.c
+4
-4
net/xfrm/xfrm_state.c
net/xfrm/xfrm_state.c
+12
-12
No files found.
net/ipv4/xfrm4_state.c
View file @
4ebb54ba
...
@@ -50,7 +50,7 @@ __xfrm4_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto)
...
@@ -50,7 +50,7 @@ __xfrm4_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto)
spi
==
x
->
id
.
spi
&&
spi
==
x
->
id
.
spi
&&
daddr
->
a4
==
x
->
id
.
daddr
.
a4
&&
daddr
->
a4
==
x
->
id
.
daddr
.
a4
&&
proto
==
x
->
id
.
proto
)
{
proto
==
x
->
id
.
proto
)
{
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
);
return
x
;
return
x
;
}
}
}
}
...
@@ -84,7 +84,7 @@ __xfrm4_find_acq(u8 mode, u16 reqid, u8 proto,
...
@@ -84,7 +84,7 @@ __xfrm4_find_acq(u8 mode, u16 reqid, u8 proto,
}
}
}
}
if
(
x0
)
{
if
(
x0
)
{
atomic_inc
(
&
x0
->
refcnt
);
xfrm_state_hold
(
x0
);
}
else
if
(
create
&&
(
x0
=
xfrm_state_alloc
())
!=
NULL
)
{
}
else
if
(
create
&&
(
x0
=
xfrm_state_alloc
())
!=
NULL
)
{
x0
->
sel
.
daddr
.
a4
=
daddr
->
a4
;
x0
->
sel
.
daddr
.
a4
=
daddr
->
a4
;
x0
->
sel
.
saddr
.
a4
=
saddr
->
a4
;
x0
->
sel
.
saddr
.
a4
=
saddr
->
a4
;
...
@@ -99,9 +99,9 @@ __xfrm4_find_acq(u8 mode, u16 reqid, u8 proto,
...
@@ -99,9 +99,9 @@ __xfrm4_find_acq(u8 mode, u16 reqid, u8 proto,
x0
->
props
.
reqid
=
reqid
;
x0
->
props
.
reqid
=
reqid
;
x0
->
props
.
family
=
AF_INET
;
x0
->
props
.
family
=
AF_INET
;
x0
->
lft
.
hard_add_expires_seconds
=
XFRM_ACQ_EXPIRES
;
x0
->
lft
.
hard_add_expires_seconds
=
XFRM_ACQ_EXPIRES
;
atomic_inc
(
&
x0
->
refcnt
);
xfrm_state_hold
(
x0
);
mod_timer
(
&
x0
->
timer
,
jiffies
+
XFRM_ACQ_EXPIRES
*
HZ
);
mod_timer
(
&
x0
->
timer
,
jiffies
+
XFRM_ACQ_EXPIRES
*
HZ
);
atomic_inc
(
&
x0
->
refcnt
);
xfrm_state_hold
(
0
);
list_add_tail
(
&
x0
->
bydst
,
xfrm4_state_afinfo
.
state_bydst
+
h
);
list_add_tail
(
&
x0
->
bydst
,
xfrm4_state_afinfo
.
state_bydst
+
h
);
wake_up
(
&
km_waitq
);
wake_up
(
&
km_waitq
);
}
}
...
...
net/ipv6/xfrm6_state.c
View file @
4ebb54ba
...
@@ -57,7 +57,7 @@ __xfrm6_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto)
...
@@ -57,7 +57,7 @@ __xfrm6_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto)
spi
==
x
->
id
.
spi
&&
spi
==
x
->
id
.
spi
&&
!
ipv6_addr_cmp
((
struct
in6_addr
*
)
daddr
,
(
struct
in6_addr
*
)
x
->
id
.
daddr
.
a6
)
&&
!
ipv6_addr_cmp
((
struct
in6_addr
*
)
daddr
,
(
struct
in6_addr
*
)
x
->
id
.
daddr
.
a6
)
&&
proto
==
x
->
id
.
proto
)
{
proto
==
x
->
id
.
proto
)
{
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
);
return
x
;
return
x
;
}
}
}
}
...
@@ -91,7 +91,7 @@ __xfrm6_find_acq(u8 mode, u16 reqid, u8 proto,
...
@@ -91,7 +91,7 @@ __xfrm6_find_acq(u8 mode, u16 reqid, u8 proto,
}
}
}
}
if
(
x0
)
{
if
(
x0
)
{
atomic_inc
(
&
x0
->
refcnt
);
xfrm_state_hold
(
x0
);
}
else
if
(
create
&&
(
x0
=
xfrm_state_alloc
())
!=
NULL
)
{
}
else
if
(
create
&&
(
x0
=
xfrm_state_alloc
())
!=
NULL
)
{
memcpy
(
x0
->
sel
.
daddr
.
a6
,
daddr
,
sizeof
(
struct
in6_addr
));
memcpy
(
x0
->
sel
.
daddr
.
a6
,
daddr
,
sizeof
(
struct
in6_addr
));
memcpy
(
x0
->
sel
.
saddr
.
a6
,
saddr
,
sizeof
(
struct
in6_addr
));
memcpy
(
x0
->
sel
.
saddr
.
a6
,
saddr
,
sizeof
(
struct
in6_addr
));
...
@@ -105,9 +105,9 @@ __xfrm6_find_acq(u8 mode, u16 reqid, u8 proto,
...
@@ -105,9 +105,9 @@ __xfrm6_find_acq(u8 mode, u16 reqid, u8 proto,
x0
->
props
.
mode
=
mode
;
x0
->
props
.
mode
=
mode
;
x0
->
props
.
reqid
=
reqid
;
x0
->
props
.
reqid
=
reqid
;
x0
->
lft
.
hard_add_expires_seconds
=
XFRM_ACQ_EXPIRES
;
x0
->
lft
.
hard_add_expires_seconds
=
XFRM_ACQ_EXPIRES
;
atomic_inc
(
&
x0
->
refcnt
);
xfrm_state_hold
(
x0
);
mod_timer
(
&
x0
->
timer
,
jiffies
+
XFRM_ACQ_EXPIRES
*
HZ
);
mod_timer
(
&
x0
->
timer
,
jiffies
+
XFRM_ACQ_EXPIRES
*
HZ
);
atomic_inc
(
&
x0
->
refcnt
);
xfrm_state_hold
(
x0
);
list_add_tail
(
&
x0
->
bydst
,
xfrm6_state_afinfo
.
state_bydst
+
h
);
list_add_tail
(
&
x0
->
bydst
,
xfrm6_state_afinfo
.
state_bydst
+
h
);
wake_up
(
&
km_waitq
);
wake_up
(
&
km_waitq
);
}
}
...
...
net/xfrm/xfrm_state.c
View file @
4ebb54ba
...
@@ -144,7 +144,7 @@ static void xfrm_timer_handler(unsigned long data)
...
@@ -144,7 +144,7 @@ static void xfrm_timer_handler(unsigned long data)
resched:
resched:
if
(
next
!=
LONG_MAX
&&
if
(
next
!=
LONG_MAX
&&
!
mod_timer
(
&
x
->
timer
,
jiffies
+
make_jiffies
(
next
)))
!
mod_timer
(
&
x
->
timer
,
jiffies
+
make_jiffies
(
next
)))
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
)
goto
out
;
goto
out
;
expired:
expired:
...
@@ -249,7 +249,7 @@ void xfrm_state_flush(u8 proto)
...
@@ -249,7 +249,7 @@ void xfrm_state_flush(u8 proto)
restart:
restart:
list_for_each_entry
(
x
,
xfrm_state_bydst
+
i
,
bydst
)
{
list_for_each_entry
(
x
,
xfrm_state_bydst
+
i
,
bydst
)
{
if
(
proto
==
IPSEC_PROTO_ANY
||
x
->
id
.
proto
==
proto
)
{
if
(
proto
==
IPSEC_PROTO_ANY
||
x
->
id
.
proto
==
proto
)
{
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
)
spin_unlock_bh
(
&
xfrm_state_lock
);
spin_unlock_bh
(
&
xfrm_state_lock
);
xfrm_state_delete
(
x
);
xfrm_state_delete
(
x
);
...
@@ -329,7 +329,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
...
@@ -329,7 +329,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
}
}
if
(
best
)
{
if
(
best
)
{
atomic_inc
(
&
best
->
refcn
t
);
xfrm_state_hold
(
bes
t
);
spin_unlock_bh
(
&
xfrm_state_lock
);
spin_unlock_bh
(
&
xfrm_state_lock
);
return
best
;
return
best
;
}
}
...
@@ -344,14 +344,14 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
...
@@ -344,14 +344,14 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
if
(
km_query
(
x
,
tmpl
,
pol
)
==
0
)
{
if
(
km_query
(
x
,
tmpl
,
pol
)
==
0
)
{
x
->
km
.
state
=
XFRM_STATE_ACQ
;
x
->
km
.
state
=
XFRM_STATE_ACQ
;
list_add_tail
(
&
x
->
bydst
,
xfrm_state_bydst
+
h
);
list_add_tail
(
&
x
->
bydst
,
xfrm_state_bydst
+
h
);
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
)
if
(
x
->
id
.
spi
)
{
if
(
x
->
id
.
spi
)
{
h
=
xfrm_spi_hash
(
&
x
->
id
.
daddr
,
x
->
id
.
spi
,
x
->
id
.
proto
,
family
);
h
=
xfrm_spi_hash
(
&
x
->
id
.
daddr
,
x
->
id
.
spi
,
x
->
id
.
proto
,
family
);
list_add
(
&
x
->
byspi
,
xfrm_state_byspi
+
h
);
list_add
(
&
x
->
byspi
,
xfrm_state_byspi
+
h
);
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
)
}
}
x
->
lft
.
hard_add_expires_seconds
=
XFRM_ACQ_EXPIRES
;
x
->
lft
.
hard_add_expires_seconds
=
XFRM_ACQ_EXPIRES
;
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
)
mod_timer
(
&
x
->
timer
,
XFRM_ACQ_EXPIRES
*
HZ
);
mod_timer
(
&
x
->
timer
,
XFRM_ACQ_EXPIRES
*
HZ
);
}
else
{
}
else
{
x
->
km
.
state
=
XFRM_STATE_DEAD
;
x
->
km
.
state
=
XFRM_STATE_DEAD
;
...
@@ -373,15 +373,15 @@ void xfrm_state_insert(struct xfrm_state *x)
...
@@ -373,15 +373,15 @@ void xfrm_state_insert(struct xfrm_state *x)
spin_lock_bh
(
&
xfrm_state_lock
);
spin_lock_bh
(
&
xfrm_state_lock
);
list_add
(
&
x
->
bydst
,
xfrm_state_bydst
+
h
);
list_add
(
&
x
->
bydst
,
xfrm_state_bydst
+
h
);
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
)
h
=
xfrm_spi_hash
(
&
x
->
id
.
daddr
,
x
->
id
.
spi
,
x
->
id
.
proto
,
x
->
props
.
family
);
h
=
xfrm_spi_hash
(
&
x
->
id
.
daddr
,
x
->
id
.
spi
,
x
->
id
.
proto
,
x
->
props
.
family
);
list_add
(
&
x
->
byspi
,
xfrm_state_byspi
+
h
);
list_add
(
&
x
->
byspi
,
xfrm_state_byspi
+
h
);
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
)
if
(
!
mod_timer
(
&
x
->
timer
,
jiffies
+
HZ
))
if
(
!
mod_timer
(
&
x
->
timer
,
jiffies
+
HZ
))
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
)
spin_unlock_bh
(
&
xfrm_state_lock
);
spin_unlock_bh
(
&
xfrm_state_lock
);
wake_up
(
&
km_waitq
);
wake_up
(
&
km_waitq
);
...
@@ -399,7 +399,7 @@ int xfrm_state_check_expire(struct xfrm_state *x)
...
@@ -399,7 +399,7 @@ int xfrm_state_check_expire(struct xfrm_state *x)
x
->
curlft
.
packets
>=
x
->
lft
.
hard_packet_limit
)
{
x
->
curlft
.
packets
>=
x
->
lft
.
hard_packet_limit
)
{
km_expired
(
x
);
km_expired
(
x
);
if
(
!
mod_timer
(
&
x
->
timer
,
jiffies
+
XFRM_ACQ_EXPIRES
*
HZ
))
if
(
!
mod_timer
(
&
x
->
timer
,
jiffies
+
XFRM_ACQ_EXPIRES
*
HZ
))
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
)
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -466,7 +466,7 @@ struct xfrm_state * xfrm_find_acq_byseq(u32 seq)
...
@@ -466,7 +466,7 @@ struct xfrm_state * xfrm_find_acq_byseq(u32 seq)
for
(
i
=
0
;
i
<
XFRM_DST_HSIZE
;
i
++
)
{
for
(
i
=
0
;
i
<
XFRM_DST_HSIZE
;
i
++
)
{
list_for_each_entry
(
x
,
xfrm_state_bydst
+
i
,
bydst
)
{
list_for_each_entry
(
x
,
xfrm_state_bydst
+
i
,
bydst
)
{
if
(
x
->
km
.
seq
==
seq
)
{
if
(
x
->
km
.
seq
==
seq
)
{
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
)
spin_unlock_bh
(
&
xfrm_state_lock
);
spin_unlock_bh
(
&
xfrm_state_lock
);
return
x
;
return
x
;
}
}
...
@@ -521,7 +521,7 @@ xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi)
...
@@ -521,7 +521,7 @@ xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi)
spin_lock_bh
(
&
xfrm_state_lock
);
spin_lock_bh
(
&
xfrm_state_lock
);
h
=
xfrm_spi_hash
(
&
x
->
id
.
daddr
,
x
->
id
.
spi
,
x
->
id
.
proto
,
x
->
props
.
family
);
h
=
xfrm_spi_hash
(
&
x
->
id
.
daddr
,
x
->
id
.
spi
,
x
->
id
.
proto
,
x
->
props
.
family
);
list_add
(
&
x
->
byspi
,
xfrm_state_byspi
+
h
);
list_add
(
&
x
->
byspi
,
xfrm_state_byspi
+
h
);
atomic_inc
(
&
x
->
refcnt
);
xfrm_state_hold
(
x
)
spin_unlock_bh
(
&
xfrm_state_lock
);
spin_unlock_bh
(
&
xfrm_state_lock
);
wake_up
(
&
km_waitq
);
wake_up
(
&
km_waitq
);
}
}
...
...
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