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
7e1dc7b6
Commit
7e1dc7b6
authored
Mar 12, 2011
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: Use flowi4 and flowi6 in xfrm layer.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
2032656e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
76 deletions
+89
-76
include/net/xfrm.h
include/net/xfrm.h
+12
-12
net/ipv4/xfrm4_policy.c
net/ipv4/xfrm4_policy.c
+24
-22
net/ipv4/xfrm4_state.c
net/ipv4/xfrm4_state.c
+8
-6
net/ipv6/xfrm6_policy.c
net/ipv6/xfrm6_policy.c
+21
-18
net/ipv6/xfrm6_state.c
net/ipv6/xfrm6_state.c
+8
-6
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_policy.c
+16
-12
No files found.
include/net/xfrm.h
View file @
7e1dc7b6
...
@@ -1142,9 +1142,9 @@ xfrm_address_t *xfrm_flowi_daddr(const struct flowi *fl, unsigned short family)
...
@@ -1142,9 +1142,9 @@ xfrm_address_t *xfrm_flowi_daddr(const struct flowi *fl, unsigned short family)
{
{
switch
(
family
){
switch
(
family
){
case
AF_INET
:
case
AF_INET
:
return
(
xfrm_address_t
*
)
&
fl
->
fl4_dst
;
return
(
xfrm_address_t
*
)
&
fl
->
u
.
ip4
.
daddr
;
case
AF_INET6
:
case
AF_INET6
:
return
(
xfrm_address_t
*
)
&
fl
->
fl6_dst
;
return
(
xfrm_address_t
*
)
&
fl
->
u
.
ip6
.
daddr
;
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -1154,9 +1154,9 @@ xfrm_address_t *xfrm_flowi_saddr(const struct flowi *fl, unsigned short family)
...
@@ -1154,9 +1154,9 @@ xfrm_address_t *xfrm_flowi_saddr(const struct flowi *fl, unsigned short family)
{
{
switch
(
family
){
switch
(
family
){
case
AF_INET
:
case
AF_INET
:
return
(
xfrm_address_t
*
)
&
fl
->
fl4_src
;
return
(
xfrm_address_t
*
)
&
fl
->
u
.
ip4
.
saddr
;
case
AF_INET6
:
case
AF_INET6
:
return
(
xfrm_address_t
*
)
&
fl
->
fl6_src
;
return
(
xfrm_address_t
*
)
&
fl
->
u
.
ip6
.
saddr
;
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -1168,12 +1168,12 @@ void xfrm_flowi_addr_get(const struct flowi *fl,
...
@@ -1168,12 +1168,12 @@ void xfrm_flowi_addr_get(const struct flowi *fl,
{
{
switch
(
family
)
{
switch
(
family
)
{
case
AF_INET
:
case
AF_INET
:
memcpy
(
&
saddr
->
a4
,
&
fl
->
fl4_src
,
sizeof
(
saddr
->
a4
));
memcpy
(
&
saddr
->
a4
,
&
fl
->
u
.
ip4
.
saddr
,
sizeof
(
saddr
->
a4
));
memcpy
(
&
daddr
->
a4
,
&
fl
->
fl4_dst
,
sizeof
(
daddr
->
a4
));
memcpy
(
&
daddr
->
a4
,
&
fl
->
u
.
ip4
.
daddr
,
sizeof
(
daddr
->
a4
));
break
;
break
;
case
AF_INET6
:
case
AF_INET6
:
ipv6_addr_copy
((
struct
in6_addr
*
)
&
saddr
->
a6
,
&
fl
->
fl6_src
);
ipv6_addr_copy
((
struct
in6_addr
*
)
&
saddr
->
a6
,
&
fl
->
u
.
ip6
.
saddr
);
ipv6_addr_copy
((
struct
in6_addr
*
)
&
daddr
->
a6
,
&
fl
->
fl6_dst
);
ipv6_addr_copy
((
struct
in6_addr
*
)
&
daddr
->
a6
,
&
fl
->
u
.
ip6
.
daddr
);
break
;
break
;
}
}
}
}
...
@@ -1221,12 +1221,12 @@ xfrm_state_addr_flow_check(const struct xfrm_state *x, const struct flowi *fl,
...
@@ -1221,12 +1221,12 @@ xfrm_state_addr_flow_check(const struct xfrm_state *x, const struct flowi *fl,
switch
(
family
)
{
switch
(
family
)
{
case
AF_INET
:
case
AF_INET
:
return
__xfrm4_state_addr_check
(
x
,
return
__xfrm4_state_addr_check
(
x
,
(
const
xfrm_address_t
*
)
&
fl
->
fl4_dst
,
(
const
xfrm_address_t
*
)
&
fl
->
u
.
ip4
.
daddr
,
(
const
xfrm_address_t
*
)
&
fl
->
fl4_src
);
(
const
xfrm_address_t
*
)
&
fl
->
u
.
ip4
.
saddr
);
case
AF_INET6
:
case
AF_INET6
:
return
__xfrm6_state_addr_check
(
x
,
return
__xfrm6_state_addr_check
(
x
,
(
const
xfrm_address_t
*
)
&
fl
->
fl6_dst
,
(
const
xfrm_address_t
*
)
&
fl
->
u
.
ip6
.
daddr
,
(
const
xfrm_address_t
*
)
&
fl
->
fl6_src
);
(
const
xfrm_address_t
*
)
&
fl
->
u
.
ip6
.
saddr
);
}
}
return
0
;
return
0
;
}
}
...
...
net/ipv4/xfrm4_policy.c
View file @
7e1dc7b6
...
@@ -56,7 +56,7 @@ static int xfrm4_get_saddr(struct net *net,
...
@@ -56,7 +56,7 @@ static int xfrm4_get_saddr(struct net *net,
static
int
xfrm4_get_tos
(
const
struct
flowi
*
fl
)
static
int
xfrm4_get_tos
(
const
struct
flowi
*
fl
)
{
{
return
IPTOS_RT_MASK
&
fl
->
fl
4_tos
;
/* Strip ECN bits */
return
IPTOS_RT_MASK
&
fl
->
u
.
ip4
.
flowi
4_tos
;
/* Strip ECN bits */
}
}
static
int
xfrm4_init_path
(
struct
xfrm_dst
*
path
,
struct
dst_entry
*
dst
,
static
int
xfrm4_init_path
(
struct
xfrm_dst
*
path
,
struct
dst_entry
*
dst
,
...
@@ -69,13 +69,14 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
...
@@ -69,13 +69,14 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
const
struct
flowi
*
fl
)
const
struct
flowi
*
fl
)
{
{
struct
rtable
*
rt
=
(
struct
rtable
*
)
xdst
->
route
;
struct
rtable
*
rt
=
(
struct
rtable
*
)
xdst
->
route
;
const
struct
flowi4
*
fl4
=
&
fl
->
u
.
ip4
;
rt
->
rt_key_dst
=
fl
->
fl4_dst
;
rt
->
rt_key_dst
=
fl
4
->
daddr
;
rt
->
rt_key_src
=
fl
->
fl4_src
;
rt
->
rt_key_src
=
fl
4
->
saddr
;
rt
->
rt_tos
=
fl
->
fl
4_tos
;
rt
->
rt_tos
=
fl
4
->
flowi
4_tos
;
rt
->
rt_iif
=
fl
->
flowi
_iif
;
rt
->
rt_iif
=
fl
4
->
flowi4
_iif
;
rt
->
rt_oif
=
fl
->
flowi
_oif
;
rt
->
rt_oif
=
fl
4
->
flowi4
_oif
;
rt
->
rt_mark
=
fl
->
flowi
_mark
;
rt
->
rt_mark
=
fl
4
->
flowi4
_mark
;
xdst
->
u
.
dst
.
dev
=
dev
;
xdst
->
u
.
dst
.
dev
=
dev
;
dev_hold
(
dev
);
dev_hold
(
dev
);
...
@@ -102,9 +103,10 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
...
@@ -102,9 +103,10 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
{
{
struct
iphdr
*
iph
=
ip_hdr
(
skb
);
struct
iphdr
*
iph
=
ip_hdr
(
skb
);
u8
*
xprth
=
skb_network_header
(
skb
)
+
iph
->
ihl
*
4
;
u8
*
xprth
=
skb_network_header
(
skb
)
+
iph
->
ihl
*
4
;
struct
flowi4
*
fl4
=
&
fl
->
u
.
ip4
;
memset
(
fl
,
0
,
sizeof
(
struct
flowi
));
memset
(
fl
4
,
0
,
sizeof
(
struct
flowi4
));
fl
->
flowi
_mark
=
skb
->
mark
;
fl
4
->
flowi4
_mark
=
skb
->
mark
;
if
(
!
(
iph
->
frag_off
&
htons
(
IP_MF
|
IP_OFFSET
)))
{
if
(
!
(
iph
->
frag_off
&
htons
(
IP_MF
|
IP_OFFSET
)))
{
switch
(
iph
->
protocol
)
{
switch
(
iph
->
protocol
)
{
...
@@ -117,8 +119,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
...
@@ -117,8 +119,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
pskb_may_pull
(
skb
,
xprth
+
4
-
skb
->
data
))
{
pskb_may_pull
(
skb
,
xprth
+
4
-
skb
->
data
))
{
__be16
*
ports
=
(
__be16
*
)
xprth
;
__be16
*
ports
=
(
__be16
*
)
xprth
;
fl
->
fl4_
sport
=
ports
[
!!
reverse
];
fl
4
->
uli
.
ports
.
sport
=
ports
[
!!
reverse
];
fl
->
fl4_
dport
=
ports
[
!
reverse
];
fl
4
->
uli
.
ports
.
dport
=
ports
[
!
reverse
];
}
}
break
;
break
;
...
@@ -126,8 +128,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
...
@@ -126,8 +128,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
if
(
pskb_may_pull
(
skb
,
xprth
+
2
-
skb
->
data
))
{
if
(
pskb_may_pull
(
skb
,
xprth
+
2
-
skb
->
data
))
{
u8
*
icmp
=
xprth
;
u8
*
icmp
=
xprth
;
fl
->
fl4_icmp_
type
=
icmp
[
0
];
fl
4
->
uli
.
icmpt
.
type
=
icmp
[
0
];
fl
->
fl4_icmp_
code
=
icmp
[
1
];
fl
4
->
uli
.
icmpt
.
code
=
icmp
[
1
];
}
}
break
;
break
;
...
@@ -135,7 +137,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
...
@@ -135,7 +137,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
if
(
pskb_may_pull
(
skb
,
xprth
+
4
-
skb
->
data
))
{
if
(
pskb_may_pull
(
skb
,
xprth
+
4
-
skb
->
data
))
{
__be32
*
ehdr
=
(
__be32
*
)
xprth
;
__be32
*
ehdr
=
(
__be32
*
)
xprth
;
fl
->
fl4_ipsec_
spi
=
ehdr
[
0
];
fl
4
->
uli
.
spi
=
ehdr
[
0
];
}
}
break
;
break
;
...
@@ -143,7 +145,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
...
@@ -143,7 +145,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
if
(
pskb_may_pull
(
skb
,
xprth
+
8
-
skb
->
data
))
{
if
(
pskb_may_pull
(
skb
,
xprth
+
8
-
skb
->
data
))
{
__be32
*
ah_hdr
=
(
__be32
*
)
xprth
;
__be32
*
ah_hdr
=
(
__be32
*
)
xprth
;
fl
->
fl4_ipsec_
spi
=
ah_hdr
[
1
];
fl
4
->
uli
.
spi
=
ah_hdr
[
1
];
}
}
break
;
break
;
...
@@ -151,7 +153,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
...
@@ -151,7 +153,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
if
(
pskb_may_pull
(
skb
,
xprth
+
4
-
skb
->
data
))
{
if
(
pskb_may_pull
(
skb
,
xprth
+
4
-
skb
->
data
))
{
__be16
*
ipcomp_hdr
=
(
__be16
*
)
xprth
;
__be16
*
ipcomp_hdr
=
(
__be16
*
)
xprth
;
fl
->
fl4_ipsec_
spi
=
htonl
(
ntohs
(
ipcomp_hdr
[
1
]));
fl
4
->
uli
.
spi
=
htonl
(
ntohs
(
ipcomp_hdr
[
1
]));
}
}
break
;
break
;
...
@@ -163,20 +165,20 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
...
@@ -163,20 +165,20 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
if
(
greflags
[
0
]
&
GRE_KEY
)
{
if
(
greflags
[
0
]
&
GRE_KEY
)
{
if
(
greflags
[
0
]
&
GRE_CSUM
)
if
(
greflags
[
0
]
&
GRE_CSUM
)
gre_hdr
++
;
gre_hdr
++
;
fl
->
fl4_
gre_key
=
gre_hdr
[
1
];
fl
4
->
uli
.
gre_key
=
gre_hdr
[
1
];
}
}
}
}
break
;
break
;
default:
default:
fl
->
fl4_ipsec_
spi
=
0
;
fl
4
->
uli
.
spi
=
0
;
break
;
break
;
}
}
}
}
fl
->
flowi
_proto
=
iph
->
protocol
;
fl
4
->
flowi4
_proto
=
iph
->
protocol
;
fl
->
fl4_dst
=
reverse
?
iph
->
saddr
:
iph
->
daddr
;
fl
4
->
daddr
=
reverse
?
iph
->
saddr
:
iph
->
daddr
;
fl
->
fl4_src
=
reverse
?
iph
->
daddr
:
iph
->
saddr
;
fl
4
->
saddr
=
reverse
?
iph
->
daddr
:
iph
->
saddr
;
fl
->
fl
4_tos
=
iph
->
tos
;
fl
4
->
flowi
4_tos
=
iph
->
tos
;
}
}
static
inline
int
xfrm4_garbage_collect
(
struct
dst_ops
*
ops
)
static
inline
int
xfrm4_garbage_collect
(
struct
dst_ops
*
ops
)
...
...
net/ipv4/xfrm4_state.c
View file @
7e1dc7b6
...
@@ -23,17 +23,19 @@ static int xfrm4_init_flags(struct xfrm_state *x)
...
@@ -23,17 +23,19 @@ static int xfrm4_init_flags(struct xfrm_state *x)
static
void
static
void
__xfrm4_init_tempsel
(
struct
xfrm_selector
*
sel
,
const
struct
flowi
*
fl
)
__xfrm4_init_tempsel
(
struct
xfrm_selector
*
sel
,
const
struct
flowi
*
fl
)
{
{
sel
->
daddr
.
a4
=
fl
->
fl4_dst
;
const
struct
flowi4
*
fl4
=
&
fl
->
u
.
ip4
;
sel
->
saddr
.
a4
=
fl
->
fl4_src
;
sel
->
dport
=
xfrm_flowi_dport
(
fl
,
&
fl
->
u
.
ip4
.
uli
);
sel
->
daddr
.
a4
=
fl4
->
daddr
;
sel
->
saddr
.
a4
=
fl4
->
saddr
;
sel
->
dport
=
xfrm_flowi_dport
(
fl
,
&
fl4
->
uli
);
sel
->
dport_mask
=
htons
(
0xffff
);
sel
->
dport_mask
=
htons
(
0xffff
);
sel
->
sport
=
xfrm_flowi_sport
(
fl
,
&
fl
->
u
.
ip4
.
uli
);
sel
->
sport
=
xfrm_flowi_sport
(
fl
,
&
fl
4
->
uli
);
sel
->
sport_mask
=
htons
(
0xffff
);
sel
->
sport_mask
=
htons
(
0xffff
);
sel
->
family
=
AF_INET
;
sel
->
family
=
AF_INET
;
sel
->
prefixlen_d
=
32
;
sel
->
prefixlen_d
=
32
;
sel
->
prefixlen_s
=
32
;
sel
->
prefixlen_s
=
32
;
sel
->
proto
=
fl
->
flowi
_proto
;
sel
->
proto
=
fl
4
->
flowi4
_proto
;
sel
->
ifindex
=
fl
->
flowi
_oif
;
sel
->
ifindex
=
fl
4
->
flowi4
_oif
;
}
}
static
void
static
void
...
...
net/ipv6/xfrm6_policy.c
View file @
7e1dc7b6
...
@@ -30,15 +30,17 @@ static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos,
...
@@ -30,15 +30,17 @@ static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos,
const
xfrm_address_t
*
saddr
,
const
xfrm_address_t
*
saddr
,
const
xfrm_address_t
*
daddr
)
const
xfrm_address_t
*
daddr
)
{
{
struct
flowi
fl
=
{}
;
struct
flowi
6
fl6
;
struct
dst_entry
*
dst
;
struct
dst_entry
*
dst
;
int
err
;
int
err
;
memcpy
(
&
fl
.
fl6_dst
,
daddr
,
sizeof
(
fl
.
fl6_dst
));
memset
(
&
fl6
,
0
,
sizeof
(
fl6
));
memcpy
(
&
fl6
.
daddr
,
daddr
,
sizeof
(
fl6
.
daddr
));
if
(
saddr
)
if
(
saddr
)
memcpy
(
&
fl
.
fl6_src
,
saddr
,
sizeof
(
fl
.
fl6_src
));
memcpy
(
&
fl
6
.
saddr
,
saddr
,
sizeof
(
fl6
.
saddr
));
dst
=
ip6_route_output
(
net
,
NULL
,
&
fl
);
dst
=
ip6_route_output
(
net
,
NULL
,
flowi6_to_flowi
(
&
fl6
));
err
=
dst
->
error
;
err
=
dst
->
error
;
if
(
dst
->
error
)
{
if
(
dst
->
error
)
{
...
@@ -120,6 +122,7 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
...
@@ -120,6 +122,7 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
static
inline
void
static
inline
void
_decode_session6
(
struct
sk_buff
*
skb
,
struct
flowi
*
fl
,
int
reverse
)
_decode_session6
(
struct
sk_buff
*
skb
,
struct
flowi
*
fl
,
int
reverse
)
{
{
struct
flowi6
*
fl6
=
&
fl
->
u
.
ip6
;
int
onlyproto
=
0
;
int
onlyproto
=
0
;
u16
offset
=
skb_network_header_len
(
skb
);
u16
offset
=
skb_network_header_len
(
skb
);
struct
ipv6hdr
*
hdr
=
ipv6_hdr
(
skb
);
struct
ipv6hdr
*
hdr
=
ipv6_hdr
(
skb
);
...
@@ -127,11 +130,11 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
...
@@ -127,11 +130,11 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
const
unsigned
char
*
nh
=
skb_network_header
(
skb
);
const
unsigned
char
*
nh
=
skb_network_header
(
skb
);
u8
nexthdr
=
nh
[
IP6CB
(
skb
)
->
nhoff
];
u8
nexthdr
=
nh
[
IP6CB
(
skb
)
->
nhoff
];
memset
(
fl
,
0
,
sizeof
(
struct
flowi
));
memset
(
fl
6
,
0
,
sizeof
(
struct
flowi6
));
fl
->
flowi
_mark
=
skb
->
mark
;
fl
6
->
flowi6
_mark
=
skb
->
mark
;
ipv6_addr_copy
(
&
fl
->
fl6_dst
,
reverse
?
&
hdr
->
saddr
:
&
hdr
->
daddr
);
ipv6_addr_copy
(
&
fl
6
->
daddr
,
reverse
?
&
hdr
->
saddr
:
&
hdr
->
daddr
);
ipv6_addr_copy
(
&
fl
->
fl6_src
,
reverse
?
&
hdr
->
daddr
:
&
hdr
->
saddr
);
ipv6_addr_copy
(
&
fl
6
->
saddr
,
reverse
?
&
hdr
->
daddr
:
&
hdr
->
saddr
);
while
(
nh
+
offset
+
1
<
skb
->
data
||
while
(
nh
+
offset
+
1
<
skb
->
data
||
pskb_may_pull
(
skb
,
nh
+
offset
+
1
-
skb
->
data
))
{
pskb_may_pull
(
skb
,
nh
+
offset
+
1
-
skb
->
data
))
{
...
@@ -158,20 +161,20 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
...
@@ -158,20 +161,20 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
pskb_may_pull
(
skb
,
nh
+
offset
+
4
-
skb
->
data
)))
{
pskb_may_pull
(
skb
,
nh
+
offset
+
4
-
skb
->
data
)))
{
__be16
*
ports
=
(
__be16
*
)
exthdr
;
__be16
*
ports
=
(
__be16
*
)
exthdr
;
fl
->
fl6_
sport
=
ports
[
!!
reverse
];
fl
6
->
uli
.
ports
.
sport
=
ports
[
!!
reverse
];
fl
->
fl6_
dport
=
ports
[
!
reverse
];
fl
6
->
uli
.
ports
.
dport
=
ports
[
!
reverse
];
}
}
fl
->
flowi
_proto
=
nexthdr
;
fl
6
->
flowi6
_proto
=
nexthdr
;
return
;
return
;
case
IPPROTO_ICMPV6
:
case
IPPROTO_ICMPV6
:
if
(
!
onlyproto
&&
pskb_may_pull
(
skb
,
nh
+
offset
+
2
-
skb
->
data
))
{
if
(
!
onlyproto
&&
pskb_may_pull
(
skb
,
nh
+
offset
+
2
-
skb
->
data
))
{
u8
*
icmp
=
(
u8
*
)
exthdr
;
u8
*
icmp
=
(
u8
*
)
exthdr
;
fl
->
fl6_icmp_
type
=
icmp
[
0
];
fl
6
->
uli
.
icmpt
.
type
=
icmp
[
0
];
fl
->
fl6_icmp_
code
=
icmp
[
1
];
fl
6
->
uli
.
icmpt
.
code
=
icmp
[
1
];
}
}
fl
->
flowi
_proto
=
nexthdr
;
fl
6
->
flowi6
_proto
=
nexthdr
;
return
;
return
;
#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
...
@@ -180,9 +183,9 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
...
@@ -180,9 +183,9 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
struct
ip6_mh
*
mh
;
struct
ip6_mh
*
mh
;
mh
=
(
struct
ip6_mh
*
)
exthdr
;
mh
=
(
struct
ip6_mh
*
)
exthdr
;
fl
->
fl6_mh_
type
=
mh
->
ip6mh_type
;
fl
6
->
uli
.
mht
.
type
=
mh
->
ip6mh_type
;
}
}
fl
->
flowi
_proto
=
nexthdr
;
fl
6
->
flowi6
_proto
=
nexthdr
;
return
;
return
;
#endif
#endif
...
@@ -191,8 +194,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
...
@@ -191,8 +194,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
case
IPPROTO_ESP
:
case
IPPROTO_ESP
:
case
IPPROTO_COMP
:
case
IPPROTO_COMP
:
default:
default:
fl
->
fl6_ipsec_
spi
=
0
;
fl
6
->
uli
.
spi
=
0
;
fl
->
flowi
_proto
=
nexthdr
;
fl
6
->
flowi6
_proto
=
nexthdr
;
return
;
return
;
}
}
}
}
...
...
net/ipv6/xfrm6_state.c
View file @
7e1dc7b6
...
@@ -22,19 +22,21 @@
...
@@ -22,19 +22,21 @@
static
void
static
void
__xfrm6_init_tempsel
(
struct
xfrm_selector
*
sel
,
const
struct
flowi
*
fl
)
__xfrm6_init_tempsel
(
struct
xfrm_selector
*
sel
,
const
struct
flowi
*
fl
)
{
{
const
struct
flowi6
*
fl6
=
&
fl
->
u
.
ip6
;
/* Initialize temporary selector matching only
/* Initialize temporary selector matching only
* to current session. */
* to current session. */
ipv6_addr_copy
((
struct
in6_addr
*
)
&
sel
->
daddr
,
&
fl
->
fl6_dst
);
ipv6_addr_copy
((
struct
in6_addr
*
)
&
sel
->
daddr
,
&
fl
6
->
daddr
);
ipv6_addr_copy
((
struct
in6_addr
*
)
&
sel
->
saddr
,
&
fl
->
fl6_src
);
ipv6_addr_copy
((
struct
in6_addr
*
)
&
sel
->
saddr
,
&
fl
6
->
saddr
);
sel
->
dport
=
xfrm_flowi_dport
(
fl
,
&
fl
->
u
.
ip6
.
uli
);
sel
->
dport
=
xfrm_flowi_dport
(
fl
,
&
fl
6
->
uli
);
sel
->
dport_mask
=
htons
(
0xffff
);
sel
->
dport_mask
=
htons
(
0xffff
);
sel
->
sport
=
xfrm_flowi_sport
(
fl
,
&
fl
->
u
.
ip6
.
uli
);
sel
->
sport
=
xfrm_flowi_sport
(
fl
,
&
fl
6
->
uli
);
sel
->
sport_mask
=
htons
(
0xffff
);
sel
->
sport_mask
=
htons
(
0xffff
);
sel
->
family
=
AF_INET6
;
sel
->
family
=
AF_INET6
;
sel
->
prefixlen_d
=
128
;
sel
->
prefixlen_d
=
128
;
sel
->
prefixlen_s
=
128
;
sel
->
prefixlen_s
=
128
;
sel
->
proto
=
fl
->
flowi
_proto
;
sel
->
proto
=
fl
6
->
flowi6
_proto
;
sel
->
ifindex
=
fl
->
flowi
_oif
;
sel
->
ifindex
=
fl
6
->
flowi6
_oif
;
}
}
static
void
static
void
...
...
net/xfrm/xfrm_policy.c
View file @
7e1dc7b6
...
@@ -59,23 +59,27 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
...
@@ -59,23 +59,27 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
static
inline
int
static
inline
int
__xfrm4_selector_match
(
const
struct
xfrm_selector
*
sel
,
const
struct
flowi
*
fl
)
__xfrm4_selector_match
(
const
struct
xfrm_selector
*
sel
,
const
struct
flowi
*
fl
)
{
{
return
addr_match
(
&
fl
->
fl4_dst
,
&
sel
->
daddr
,
sel
->
prefixlen_d
)
&&
const
struct
flowi4
*
fl4
=
&
fl
->
u
.
ip4
;
addr_match
(
&
fl
->
fl4_src
,
&
sel
->
saddr
,
sel
->
prefixlen_s
)
&&
!
((
xfrm_flowi_dport
(
fl
,
&
fl
->
u
.
ip4
.
uli
)
^
sel
->
dport
)
&
sel
->
dport_mask
)
&&
return
addr_match
(
&
fl4
->
daddr
,
&
sel
->
daddr
,
sel
->
prefixlen_d
)
&&
!
((
xfrm_flowi_sport
(
fl
,
&
fl
->
u
.
ip4
.
uli
)
^
sel
->
sport
)
&
sel
->
sport_mask
)
&&
addr_match
(
&
fl4
->
saddr
,
&
sel
->
saddr
,
sel
->
prefixlen_s
)
&&
(
fl
->
flowi_proto
==
sel
->
proto
||
!
sel
->
proto
)
&&
!
((
xfrm_flowi_dport
(
fl
,
&
fl4
->
uli
)
^
sel
->
dport
)
&
sel
->
dport_mask
)
&&
(
fl
->
flowi_oif
==
sel
->
ifindex
||
!
sel
->
ifindex
);
!
((
xfrm_flowi_sport
(
fl
,
&
fl4
->
uli
)
^
sel
->
sport
)
&
sel
->
sport_mask
)
&&
(
fl4
->
flowi4_proto
==
sel
->
proto
||
!
sel
->
proto
)
&&
(
fl4
->
flowi4_oif
==
sel
->
ifindex
||
!
sel
->
ifindex
);
}
}
static
inline
int
static
inline
int
__xfrm6_selector_match
(
const
struct
xfrm_selector
*
sel
,
const
struct
flowi
*
fl
)
__xfrm6_selector_match
(
const
struct
xfrm_selector
*
sel
,
const
struct
flowi
*
fl
)
{
{
return
addr_match
(
&
fl
->
fl6_dst
,
&
sel
->
daddr
,
sel
->
prefixlen_d
)
&&
const
struct
flowi6
*
fl6
=
&
fl
->
u
.
ip6
;
addr_match
(
&
fl
->
fl6_src
,
&
sel
->
saddr
,
sel
->
prefixlen_s
)
&&
!
((
xfrm_flowi_dport
(
fl
,
&
fl
->
u
.
ip6
.
uli
)
^
sel
->
dport
)
&
sel
->
dport_mask
)
&&
return
addr_match
(
&
fl6
->
daddr
,
&
sel
->
daddr
,
sel
->
prefixlen_d
)
&&
!
((
xfrm_flowi_sport
(
fl
,
&
fl
->
u
.
ip6
.
uli
)
^
sel
->
sport
)
&
sel
->
sport_mask
)
&&
addr_match
(
&
fl6
->
saddr
,
&
sel
->
saddr
,
sel
->
prefixlen_s
)
&&
(
fl
->
flowi_proto
==
sel
->
proto
||
!
sel
->
proto
)
&&
!
((
xfrm_flowi_dport
(
fl
,
&
fl6
->
uli
)
^
sel
->
dport
)
&
sel
->
dport_mask
)
&&
(
fl
->
flowi_oif
==
sel
->
ifindex
||
!
sel
->
ifindex
);
!
((
xfrm_flowi_sport
(
fl
,
&
fl6
->
uli
)
^
sel
->
sport
)
&
sel
->
sport_mask
)
&&
(
fl6
->
flowi6_proto
==
sel
->
proto
||
!
sel
->
proto
)
&&
(
fl6
->
flowi6_oif
==
sel
->
ifindex
||
!
sel
->
ifindex
);
}
}
int
xfrm_selector_match
(
const
struct
xfrm_selector
*
sel
,
const
struct
flowi
*
fl
,
int
xfrm_selector_match
(
const
struct
xfrm_selector
*
sel
,
const
struct
flowi
*
fl
,
...
...
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