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
497e5221
Commit
497e5221
authored
Jun 06, 2003
by
Herbert Xu
Committed by
Christoph Hellwig
Jun 06, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[XFRM_USER]: Allow del policy by id and get policy by selector.
parent
921a5004
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
36 deletions
+39
-36
include/net/xfrm.h
include/net/xfrm.h
+2
-1
net/key/af_key.c
net/key/af_key.c
+1
-1
net/netsyms.c
net/netsyms.c
+1
-1
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_policy.c
+10
-4
net/xfrm/xfrm_user.c
net/xfrm/xfrm_user.c
+25
-29
No files found.
include/net/xfrm.h
View file @
497e5221
...
@@ -790,7 +790,8 @@ void xfrm6_policy_init(void);
...
@@ -790,7 +790,8 @@ void xfrm6_policy_init(void);
struct
xfrm_policy
*
xfrm_policy_alloc
(
int
gfp
);
struct
xfrm_policy
*
xfrm_policy_alloc
(
int
gfp
);
extern
int
xfrm_policy_walk
(
int
(
*
func
)(
struct
xfrm_policy
*
,
int
,
int
,
void
*
),
void
*
);
extern
int
xfrm_policy_walk
(
int
(
*
func
)(
struct
xfrm_policy
*
,
int
,
int
,
void
*
),
void
*
);
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
*
xfrm_policy_delete
(
int
dir
,
struct
xfrm_selector
*
sel
);
struct
xfrm_policy
*
xfrm_policy_bysel
(
int
dir
,
struct
xfrm_selector
*
sel
,
int
delete
);
struct
xfrm_policy
*
xfrm_policy_byid
(
int
dir
,
u32
id
,
int
delete
);
struct
xfrm_policy
*
xfrm_policy_byid
(
int
dir
,
u32
id
,
int
delete
);
void
xfrm_policy_flush
(
void
);
void
xfrm_policy_flush
(
void
);
u32
xfrm_get_acqseq
(
void
);
u32
xfrm_get_acqseq
(
void
);
...
...
net/key/af_key.c
View file @
497e5221
...
@@ -1990,7 +1990,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
...
@@ -1990,7 +1990,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, struct sadb_msg
if
(
sel
.
dport
)
if
(
sel
.
dport
)
sel
.
dport_mask
=
~
0
;
sel
.
dport_mask
=
~
0
;
xp
=
xfrm_policy_
delete
(
pol
->
sadb_x_policy_dir
-
1
,
&
sel
);
xp
=
xfrm_policy_
bysel
(
pol
->
sadb_x_policy_dir
-
1
,
&
sel
,
1
);
if
(
xp
==
NULL
)
if
(
xp
==
NULL
)
return
-
ENOENT
;
return
-
ENOENT
;
...
...
net/netsyms.c
View file @
497e5221
...
@@ -337,7 +337,7 @@ EXPORT_SYMBOL(xfrm_find_acq);
...
@@ -337,7 +337,7 @@ EXPORT_SYMBOL(xfrm_find_acq);
EXPORT_SYMBOL
(
xfrm_alloc_spi
);
EXPORT_SYMBOL
(
xfrm_alloc_spi
);
EXPORT_SYMBOL
(
xfrm_state_flush
);
EXPORT_SYMBOL
(
xfrm_state_flush
);
EXPORT_SYMBOL
(
xfrm_policy_kill
);
EXPORT_SYMBOL
(
xfrm_policy_kill
);
EXPORT_SYMBOL
(
xfrm_policy_
delete
);
EXPORT_SYMBOL
(
xfrm_policy_
bysel
);
EXPORT_SYMBOL
(
xfrm_policy_insert
);
EXPORT_SYMBOL
(
xfrm_policy_insert
);
EXPORT_SYMBOL
(
xfrm_policy_walk
);
EXPORT_SYMBOL
(
xfrm_policy_walk
);
EXPORT_SYMBOL
(
xfrm_policy_flush
);
EXPORT_SYMBOL
(
xfrm_policy_flush
);
...
...
net/xfrm/xfrm_policy.c
View file @
497e5221
...
@@ -297,19 +297,25 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
...
@@ -297,19 +297,25 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
return
0
;
return
0
;
}
}
struct
xfrm_policy
*
xfrm_policy_delete
(
int
dir
,
struct
xfrm_selector
*
sel
)
struct
xfrm_policy
*
xfrm_policy_bysel
(
int
dir
,
struct
xfrm_selector
*
sel
,
int
delete
)
{
{
struct
xfrm_policy
*
pol
,
**
p
;
struct
xfrm_policy
*
pol
,
**
p
;
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
(
sel
,
&
pol
->
selector
,
sizeof
(
*
sel
))
==
0
)
{
if
(
memcmp
(
sel
,
&
pol
->
selector
,
sizeof
(
*
sel
))
==
0
)
{
*
p
=
pol
->
next
;
if
(
delete
)
*
p
=
pol
->
next
;
break
;
break
;
}
}
}
}
if
(
pol
)
if
(
pol
)
{
atomic_inc
(
&
flow_cache_genid
);
if
(
delete
)
atomic_inc
(
&
flow_cache_genid
);
else
xfrm_pol_hold
(
pol
);
}
write_unlock_bh
(
&
xfrm_policy_lock
);
write_unlock_bh
(
&
xfrm_policy_lock
);
return
pol
;
return
pol
;
}
}
...
...
net/xfrm/xfrm_user.c
View file @
497e5221
...
@@ -656,26 +656,6 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfr
...
@@ -656,26 +656,6 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfr
return
0
;
return
0
;
}
}
static
int
xfrm_del_policy
(
struct
sk_buff
*
skb
,
struct
nlmsghdr
*
nlh
,
void
**
xfrma
)
{
struct
xfrm_policy
*
xp
;
struct
xfrm_userpolicy_id
*
p
;
int
err
;
p
=
NLMSG_DATA
(
nlh
);
err
=
verify_policy_dir
(
p
->
dir
);
if
(
err
)
return
err
;
xp
=
xfrm_policy_delete
(
p
->
dir
,
&
p
->
sel
);
if
(
xp
==
NULL
)
return
-
ENOENT
;
xfrm_policy_kill
(
xp
);
xfrm_pol_put
(
xp
);
return
0
;
}
static
int
dump_one_policy
(
struct
xfrm_policy
*
xp
,
int
dir
,
int
count
,
void
*
ptr
)
static
int
dump_one_policy
(
struct
xfrm_policy
*
xp
,
int
dir
,
int
count
,
void
*
ptr
)
{
{
struct
xfrm_dump_info
*
sp
=
ptr
;
struct
xfrm_dump_info
*
sp
=
ptr
;
...
@@ -774,20 +754,36 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfr
...
@@ -774,20 +754,36 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfr
{
{
struct
xfrm_policy
*
xp
;
struct
xfrm_policy
*
xp
;
struct
xfrm_userpolicy_id
*
p
;
struct
xfrm_userpolicy_id
*
p
;
struct
sk_buff
*
resp_skb
;
int
err
;
int
err
;
int
delete
;
p
=
NLMSG_DATA
(
nlh
);
p
=
NLMSG_DATA
(
nlh
);
xp
=
xfrm_policy_byid
(
p
->
dir
,
p
->
index
,
0
);
delete
=
nlh
->
nlmsg_type
==
XFRM_MSG_DELPOLICY
;
err
=
verify_policy_dir
(
p
->
dir
);
if
(
err
)
return
err
;
if
(
p
->
index
)
xp
=
xfrm_policy_byid
(
p
->
dir
,
p
->
index
,
delete
);
else
xp
=
xfrm_policy_bysel
(
p
->
dir
,
&
p
->
sel
,
delete
);
if
(
xp
==
NULL
)
if
(
xp
==
NULL
)
return
-
ENOENT
;
return
-
ENOENT
;
resp_skb
=
xfrm_policy_netlink
(
skb
,
xp
,
p
->
dir
,
nlh
->
nlmsg_seq
);
if
(
delete
)
if
(
IS_ERR
(
resp_skb
))
{
xfrm_policy_kill
(
xp
);
err
=
PTR_ERR
(
resp_skb
);
else
{
}
else
{
struct
sk_buff
*
resp_skb
;
err
=
netlink_unicast
(
xfrm_nl
,
resp_skb
,
NETLINK_CB
(
skb
).
pid
,
MSG_DONTWAIT
);
resp_skb
=
xfrm_policy_netlink
(
skb
,
xp
,
p
->
dir
,
nlh
->
nlmsg_seq
);
if
(
IS_ERR
(
resp_skb
))
{
err
=
PTR_ERR
(
resp_skb
);
}
else
{
err
=
netlink_unicast
(
xfrm_nl
,
resp_skb
,
NETLINK_CB
(
skb
).
pid
,
MSG_DONTWAIT
);
}
}
}
xfrm_pol_put
(
xp
);
xfrm_pol_put
(
xp
);
...
@@ -819,7 +815,7 @@ static struct xfrm_link {
...
@@ -819,7 +815,7 @@ static struct xfrm_link {
.
dump
=
xfrm_dump_sa
,
.
dump
=
xfrm_dump_sa
,
},
},
{
.
doit
=
xfrm_add_policy
},
{
.
doit
=
xfrm_add_policy
},
{
.
doit
=
xfrm_
del
_policy
},
{
.
doit
=
xfrm_
get
_policy
},
{
{
.
doit
=
xfrm_get_policy
,
.
doit
=
xfrm_get_policy
,
.
dump
=
xfrm_dump_policy
,
.
dump
=
xfrm_dump_policy
,
...
...
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