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
3a98412d
Commit
3a98412d
authored
Aug 19, 2004
by
Hideaki Yoshifuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[XFRM] Fix selector comparison against icmp{,v6} flows.
Signed-off-by:
Hideaki YOSHIFUJI
<
yoshfuji@linux-ipv6.org
>
parent
4d802161
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
4 deletions
+42
-4
include/net/xfrm.h
include/net/xfrm.h
+42
-4
No files found.
include/net/xfrm.h
View file @
3a98412d
...
@@ -462,13 +462,51 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
...
@@ -462,13 +462,51 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
return
1
;
return
1
;
}
}
static
__inline__
u16
xfrm_flowi_sport
(
struct
flowi
*
fl
)
{
u16
port
;
switch
(
fl
->
proto
)
{
case
IPPROTO_TCP
:
case
IPPROTO_UDP
:
port
=
fl
->
fl_ip_sport
;
break
;
case
IPPROTO_ICMP
:
case
IPPROTO_ICMPV6
:
port
=
htons
(
fl
->
fl_icmp_type
);
break
;
default:
port
=
0
;
/*XXX*/
}
return
port
;
}
static
__inline__
u16
xfrm_flowi_dport
(
struct
flowi
*
fl
)
{
u16
port
;
switch
(
fl
->
proto
)
{
case
IPPROTO_TCP
:
case
IPPROTO_UDP
:
port
=
fl
->
fl_ip_dport
;
break
;
case
IPPROTO_ICMP
:
case
IPPROTO_ICMPV6
:
port
=
htons
(
fl
->
fl_icmp_code
);
break
;
default:
port
=
0
;
/*XXX*/
}
return
port
;
}
static
inline
int
static
inline
int
__xfrm4_selector_match
(
struct
xfrm_selector
*
sel
,
struct
flowi
*
fl
)
__xfrm4_selector_match
(
struct
xfrm_selector
*
sel
,
struct
flowi
*
fl
)
{
{
return
addr_match
(
&
fl
->
fl4_dst
,
&
sel
->
daddr
,
sel
->
prefixlen_d
)
&&
return
addr_match
(
&
fl
->
fl4_dst
,
&
sel
->
daddr
,
sel
->
prefixlen_d
)
&&
addr_match
(
&
fl
->
fl4_src
,
&
sel
->
saddr
,
sel
->
prefixlen_s
)
&&
addr_match
(
&
fl
->
fl4_src
,
&
sel
->
saddr
,
sel
->
prefixlen_s
)
&&
!
((
fl
->
fl_ip_dport
^
sel
->
dport
)
&
sel
->
dport_mask
)
&&
!
((
xfrm_flowi_dport
(
fl
)
^
sel
->
dport
)
&
sel
->
dport_mask
)
&&
!
((
fl
->
fl_ip_sport
^
sel
->
sport
)
&
sel
->
sport_mask
)
&&
!
((
xfrm_flowi_sport
(
fl
)
^
sel
->
sport
)
&
sel
->
sport_mask
)
&&
(
fl
->
proto
==
sel
->
proto
||
!
sel
->
proto
)
&&
(
fl
->
proto
==
sel
->
proto
||
!
sel
->
proto
)
&&
(
fl
->
oif
==
sel
->
ifindex
||
!
sel
->
ifindex
);
(
fl
->
oif
==
sel
->
ifindex
||
!
sel
->
ifindex
);
}
}
...
@@ -478,8 +516,8 @@ __xfrm6_selector_match(struct xfrm_selector *sel, struct flowi *fl)
...
@@ -478,8 +516,8 @@ __xfrm6_selector_match(struct xfrm_selector *sel, struct flowi *fl)
{
{
return
addr_match
(
&
fl
->
fl6_dst
,
&
sel
->
daddr
,
sel
->
prefixlen_d
)
&&
return
addr_match
(
&
fl
->
fl6_dst
,
&
sel
->
daddr
,
sel
->
prefixlen_d
)
&&
addr_match
(
&
fl
->
fl6_src
,
&
sel
->
saddr
,
sel
->
prefixlen_s
)
&&
addr_match
(
&
fl
->
fl6_src
,
&
sel
->
saddr
,
sel
->
prefixlen_s
)
&&
!
((
fl
->
fl_ip_dport
^
sel
->
dport
)
&
sel
->
dport_mask
)
&&
!
((
xfrm_flowi_dport
(
fl
)
^
sel
->
dport
)
&
sel
->
dport_mask
)
&&
!
((
fl
->
fl_ip_sport
^
sel
->
sport
)
&
sel
->
sport_mask
)
&&
!
((
xfrm_flowi_sport
(
fl
)
^
sel
->
sport
)
&
sel
->
sport_mask
)
&&
(
fl
->
proto
==
sel
->
proto
||
!
sel
->
proto
)
&&
(
fl
->
proto
==
sel
->
proto
||
!
sel
->
proto
)
&&
(
fl
->
oif
==
sel
->
ifindex
||
!
sel
->
ifindex
);
(
fl
->
oif
==
sel
->
ifindex
||
!
sel
->
ifindex
);
}
}
...
...
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