Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
9e8b4ed8
Commit
9e8b4ed8
authored
Apr 28, 2008
by
YOSHIFUJI Hideaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
key: Introduce pfkey_sockaddr_len() for raw sockaddr{} length.
Signed-off-by:
YOSHIFUJI Hideaki
<
yoshfuji@linux-ipv6.org
>
parent
3de23255
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
31 deletions
+19
-31
net/key/af_key.c
net/key/af_key.c
+19
-31
No files found.
net/key/af_key.c
View file @
9e8b4ed8
...
...
@@ -579,6 +579,19 @@ static uint8_t pfkey_proto_from_xfrm(uint8_t proto)
return
(
proto
?
proto
:
IPSEC_PROTO_ANY
);
}
static
inline
int
pfkey_sockaddr_len
(
sa_family_t
family
)
{
switch
(
family
)
{
case
AF_INET
:
return
sizeof
(
struct
sockaddr_in
);
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
case
AF_INET6
:
return
sizeof
(
struct
sockaddr_in6
);
#endif
}
return
0
;
}
static
int
pfkey_sadb_addr2xfrm_addr
(
struct
sadb_address
*
addr
,
xfrm_address_t
*
xaddr
)
{
...
...
@@ -642,20 +655,11 @@ static struct xfrm_state *pfkey_xfrm_state_lookup(struct sadb_msg *hdr, void **
}
#define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1)))
static
int
pfkey_sockaddr_size
(
sa_family_t
family
)
{
switch
(
family
)
{
case
AF_INET
:
return
PFKEY_ALIGN8
(
sizeof
(
struct
sockaddr_in
));
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
case
AF_INET6
:
return
PFKEY_ALIGN8
(
sizeof
(
struct
sockaddr_in6
));
#endif
default:
return
0
;
}
/* NOTREACHED */
return
PFKEY_ALIGN8
(
pfkey_sockaddr_len
(
family
));
}
static
inline
int
pfkey_mode_from_xfrm
(
int
mode
)
...
...
@@ -1952,9 +1956,7 @@ static int pfkey_xfrm_policy2msg_size(struct xfrm_policy *xp)
for
(
i
=
0
;
i
<
xp
->
xfrm_nr
;
i
++
)
{
t
=
xp
->
xfrm_vec
+
i
;
socklen
+=
(
t
->
encap_family
==
AF_INET
?
sizeof
(
struct
sockaddr_in
)
:
sizeof
(
struct
sockaddr_in6
));
socklen
+=
pfkey_sockaddr_len
(
t
->
encap_family
);
}
return
sizeof
(
struct
sadb_msg
)
+
...
...
@@ -1996,9 +1998,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, in
int
i
;
int
size
;
int
sockaddr_size
=
pfkey_sockaddr_size
(
xp
->
family
);
int
socklen
=
(
xp
->
family
==
AF_INET
?
sizeof
(
struct
sockaddr_in
)
:
sizeof
(
struct
sockaddr_in6
));
int
socklen
=
pfkey_sockaddr_len
(
xp
->
family
);
size
=
pfkey_xfrm_policy2msg_size
(
xp
);
...
...
@@ -2122,9 +2122,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, in
req_size
=
sizeof
(
struct
sadb_x_ipsecrequest
);
if
(
t
->
mode
==
XFRM_MODE_TUNNEL
)
req_size
+=
((
t
->
encap_family
==
AF_INET
?
sizeof
(
struct
sockaddr_in
)
:
sizeof
(
struct
sockaddr_in6
))
*
2
);
req_size
+=
pfkey_sockaddr_len
(
t
->
encap_family
)
*
2
;
else
size
-=
2
*
socklen
;
rq
=
(
void
*
)
skb_put
(
skb
,
req_size
);
...
...
@@ -2459,17 +2457,7 @@ out:
#ifdef CONFIG_NET_KEY_MIGRATE
static
int
pfkey_sockaddr_pair_size
(
sa_family_t
family
)
{
switch
(
family
)
{
case
AF_INET
:
return
PFKEY_ALIGN8
(
sizeof
(
struct
sockaddr_in
)
*
2
);
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
case
AF_INET6
:
return
PFKEY_ALIGN8
(
sizeof
(
struct
sockaddr_in6
)
*
2
);
#endif
default:
return
0
;
}
/* NOTREACHED */
return
PFKEY_ALIGN8
(
pfkey_sockaddr_len
(
family
)
*
2
);
}
static
int
parse_sockaddr_pair
(
struct
sadb_x_ipsecrequest
*
rq
,
...
...
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