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
345b4943
Commit
345b4943
authored
Apr 17, 2003
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Actually apply Yoshfuji's fl6_{src,dst} patch.
parent
15e1406e
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
102 additions
and
107 deletions
+102
-107
include/net/flow.h
include/net/flow.h
+5
-1
include/net/route.h
include/net/route.h
+4
-4
include/net/xfrm.h
include/net/xfrm.h
+8
-8
net/ipv4/xfrm4_policy.c
net/ipv4/xfrm4_policy.c
+6
-6
net/ipv4/xfrm4_state.c
net/ipv4/xfrm4_state.c
+2
-2
net/ipv6/datagram.c
net/ipv6/datagram.c
+1
-1
net/ipv6/icmp.c
net/ipv6/icmp.c
+8
-8
net/ipv6/ip6_output.c
net/ipv6/ip6_output.c
+8
-8
net/ipv6/ndisc.c
net/ipv6/ndisc.c
+2
-2
net/ipv6/raw.c
net/ipv6/raw.c
+2
-2
net/ipv6/route.c
net/ipv6/route.c
+8
-15
net/ipv6/tcp_ipv6.c
net/ipv6/tcp_ipv6.c
+37
-39
net/ipv6/udp.c
net/ipv6/udp.c
+4
-4
net/ipv6/xfrm6_policy.c
net/ipv6/xfrm6_policy.c
+3
-3
net/ipv6/xfrm6_state.c
net/ipv6/xfrm6_state.c
+2
-2
net/sctp/ipv6.c
net/sctp/ipv6.c
+2
-2
No files found.
include/net/flow.h
View file @
345b4943
...
...
@@ -50,6 +50,10 @@ struct flowi {
__u32
spi
;
}
uli_u
;
#define fl_ip_sport uli_u.ports.sport
#define fl_ip_dport uli_u.ports.dport
#define fl_icmp_type uli_u.icmpt.type
#define fl_icmp_code uli_u.icmpt.code
#define fl_ipsec_spi uli_u.spi
};
#endif
include/net/route.h
View file @
345b4943
...
...
@@ -173,13 +173,13 @@ static inline int ip_route_connect(struct rtable **rp, u32 dst,
static
inline
int
ip_route_newports
(
struct
rtable
**
rp
,
u16
sport
,
u16
dport
,
struct
sock
*
sk
)
{
if
(
sport
!=
(
*
rp
)
->
fl
.
uli_u
.
ports
.
sport
||
dport
!=
(
*
rp
)
->
fl
.
uli_u
.
ports
.
dport
)
{
if
(
sport
!=
(
*
rp
)
->
fl
.
fl_ip_
sport
||
dport
!=
(
*
rp
)
->
fl
.
fl_ip_
dport
)
{
struct
flowi
fl
;
memcpy
(
&
fl
,
&
(
*
rp
)
->
fl
,
sizeof
(
fl
));
fl
.
uli_u
.
ports
.
sport
=
sport
;
fl
.
uli_u
.
ports
.
dport
=
dport
;
fl
.
fl_ip_
sport
=
sport
;
fl
.
fl_ip_
dport
=
dport
;
ip_rt_put
(
*
rp
);
*
rp
=
NULL
;
return
ip_route_output_flow
(
rp
,
&
fl
,
sk
,
0
);
...
...
include/net/xfrm.h
View file @
345b4943
...
...
@@ -295,11 +295,11 @@ extern int xfrm_unregister_km(struct xfrm_mgr *km);
static
inline
u32
__flow_hash4
(
struct
flowi
*
fl
)
{
u32
hash
=
fl
->
fl4_src
^
fl
->
uli_u
.
ports
.
sport
;
u32
hash
=
fl
->
fl4_src
^
fl
->
fl_ip_
sport
;
hash
=
((
hash
&
0xF0F0F0F0
)
>>
4
)
|
((
hash
&
0x0F0F0F0F
)
<<
4
);
hash
^=
fl
->
fl4_dst
^
fl
->
uli_u
.
ports
.
dport
;
hash
^=
fl
->
fl4_dst
^
fl
->
fl_ip_
dport
;
hash
^=
(
hash
>>
10
);
hash
^=
(
hash
>>
20
);
return
hash
&
(
XFRM_FLOWCACHE_HASH_SIZE
-
1
);
...
...
@@ -309,13 +309,13 @@ static inline u32 __flow_hash6(struct flowi *fl)
{
u32
hash
=
fl
->
fl6_src
->
s6_addr32
[
2
]
^
fl
->
fl6_src
->
s6_addr32
[
3
]
^
fl
->
uli_u
.
ports
.
sport
;
fl
->
fl_ip_
sport
;
hash
=
((
hash
&
0xF0F0F0F0
)
>>
4
)
|
((
hash
&
0x0F0F0F0F
)
<<
4
);
hash
^=
fl
->
fl6_dst
->
s6_addr32
[
2
]
^
fl
->
fl6_dst
->
s6_addr32
[
3
]
^
fl
->
uli_u
.
ports
.
dport
;
fl
->
fl_ip_
dport
;
hash
^=
(
hash
>>
10
);
hash
^=
(
hash
>>
20
);
return
hash
&
(
XFRM_FLOWCACHE_HASH_SIZE
-
1
);
...
...
@@ -454,8 +454,8 @@ __xfrm4_selector_match(struct xfrm_selector *sel, struct flowi *fl)
{
return
addr_match
(
&
fl
->
fl4_dst
,
&
sel
->
daddr
,
sel
->
prefixlen_d
)
&&
addr_match
(
&
fl
->
fl4_src
,
&
sel
->
saddr
,
sel
->
prefixlen_s
)
&&
!
((
fl
->
uli_u
.
ports
.
dport
^
sel
->
dport
)
&
sel
->
dport_mask
)
&&
!
((
fl
->
uli_u
.
ports
.
sport
^
sel
->
sport
)
&
sel
->
sport_mask
)
&&
!
((
fl
->
fl_ip_
dport
^
sel
->
dport
)
&
sel
->
dport_mask
)
&&
!
((
fl
->
fl_ip_
sport
^
sel
->
sport
)
&
sel
->
sport_mask
)
&&
(
fl
->
proto
==
sel
->
proto
||
!
sel
->
proto
)
&&
(
fl
->
oif
==
sel
->
ifindex
||
!
sel
->
ifindex
);
}
...
...
@@ -465,8 +465,8 @@ __xfrm6_selector_match(struct xfrm_selector *sel, struct flowi *fl)
{
return
addr_match
(
fl
->
fl6_dst
,
&
sel
->
daddr
,
sel
->
prefixlen_d
)
&&
addr_match
(
fl
->
fl6_src
,
&
sel
->
saddr
,
sel
->
prefixlen_s
)
&&
!
((
fl
->
uli_u
.
ports
.
dport
^
sel
->
dport
)
&
sel
->
dport_mask
)
&&
!
((
fl
->
uli_u
.
ports
.
sport
^
sel
->
sport
)
&
sel
->
sport_mask
)
&&
!
((
fl
->
fl_ip_
dport
^
sel
->
dport
)
&
sel
->
dport_mask
)
&&
!
((
fl
->
fl_ip_
sport
^
sel
->
sport
)
&
sel
->
sport_mask
)
&&
(
fl
->
proto
==
sel
->
proto
||
!
sel
->
proto
)
&&
(
fl
->
oif
==
sel
->
ifindex
||
!
sel
->
ifindex
);
}
...
...
net/ipv4/xfrm4_policy.c
View file @
345b4943
...
...
@@ -180,8 +180,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl)
if
(
pskb_may_pull
(
skb
,
xprth
+
4
-
skb
->
data
))
{
u16
*
ports
=
(
u16
*
)
xprth
;
fl
->
uli_u
.
ports
.
sport
=
ports
[
0
];
fl
->
uli_u
.
ports
.
dport
=
ports
[
1
];
fl
->
fl_ip_
sport
=
ports
[
0
];
fl
->
fl_ip_
dport
=
ports
[
1
];
}
break
;
...
...
@@ -189,7 +189,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl)
if
(
pskb_may_pull
(
skb
,
xprth
+
4
-
skb
->
data
))
{
u32
*
ehdr
=
(
u32
*
)
xprth
;
fl
->
uli_u
.
spi
=
ehdr
[
0
];
fl
->
fl_ipsec_
spi
=
ehdr
[
0
];
}
break
;
...
...
@@ -197,7 +197,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl)
if
(
pskb_may_pull
(
skb
,
xprth
+
8
-
skb
->
data
))
{
u32
*
ah_hdr
=
(
u32
*
)
xprth
;
fl
->
uli_u
.
spi
=
ah_hdr
[
1
];
fl
->
fl_ipsec_
spi
=
ah_hdr
[
1
];
}
break
;
...
...
@@ -205,11 +205,11 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl)
if
(
pskb_may_pull
(
skb
,
xprth
+
4
-
skb
->
data
))
{
u16
*
ipcomp_hdr
=
(
u16
*
)
xprth
;
fl
->
uli_u
.
spi
=
ntohl
(
ntohs
(
ipcomp_hdr
[
1
]));
fl
->
fl_ipsec_
spi
=
ntohl
(
ntohs
(
ipcomp_hdr
[
1
]));
}
break
;
default:
fl
->
uli_u
.
spi
=
0
;
fl
->
fl_ipsec_
spi
=
0
;
break
;
};
}
else
{
...
...
net/ipv4/xfrm4_state.c
View file @
345b4943
...
...
@@ -20,9 +20,9 @@ __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl,
{
x
->
sel
.
daddr
.
a4
=
fl
->
fl4_dst
;
x
->
sel
.
saddr
.
a4
=
fl
->
fl4_src
;
x
->
sel
.
dport
=
fl
->
uli_u
.
ports
.
dport
;
x
->
sel
.
dport
=
fl
->
fl_ip_
dport
;
x
->
sel
.
dport_mask
=
~
0
;
x
->
sel
.
sport
=
fl
->
uli_u
.
ports
.
sport
;
x
->
sel
.
sport
=
fl
->
fl_ip_
sport
;
x
->
sel
.
sport_mask
=
~
0
;
x
->
sel
.
prefixlen_d
=
32
;
x
->
sel
.
prefixlen_s
=
32
;
...
...
net/ipv6/datagram.c
View file @
345b4943
...
...
@@ -91,7 +91,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
serr
->
ee
.
ee_info
=
info
;
serr
->
ee
.
ee_data
=
0
;
serr
->
addr_offset
=
(
u8
*
)
&
iph
->
daddr
-
skb
->
nh
.
raw
;
serr
->
port
=
fl
->
uli_u
.
ports
.
dport
;
serr
->
port
=
fl
->
fl_ip_
dport
;
skb
->
h
.
raw
=
skb
->
tail
;
__skb_pull
(
skb
,
skb
->
tail
-
skb
->
data
);
...
...
net/ipv6/icmp.c
View file @
345b4943
...
...
@@ -313,12 +313,12 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
}
fl
.
proto
=
IPPROTO_ICMPV6
;
fl
.
nl_u
.
ip6_u
.
daddr
=
&
hdr
->
saddr
;
fl
.
nl_u
.
ip6_u
.
saddr
=
saddr
;
fl
.
fl6_dst
=
&
hdr
->
saddr
;
fl
.
fl6_src
=
saddr
;
fl
.
oif
=
iif
;
fl
.
fl6_flowlabel
=
0
;
fl
.
uli_u
.
icmpt
.
type
=
type
;
fl
.
uli_u
.
icmpt
.
code
=
code
;
fl
.
fl_icmp_
type
=
type
;
fl
.
fl_icmp_
code
=
code
;
icmpv6_xmit_lock
();
...
...
@@ -387,12 +387,12 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
msg
.
daddr
=
&
skb
->
nh
.
ipv6h
->
saddr
;
fl
.
proto
=
IPPROTO_ICMPV6
;
fl
.
nl_u
.
ip6_u
.
daddr
=
msg
.
daddr
;
fl
.
nl_u
.
ip6_u
.
saddr
=
saddr
;
fl
.
fl6_dst
=
msg
.
daddr
;
fl
.
fl6_src
=
saddr
;
fl
.
oif
=
skb
->
dev
->
ifindex
;
fl
.
fl6_flowlabel
=
0
;
fl
.
uli_u
.
icmpt
.
type
=
ICMPV6_ECHO_REPLY
;
fl
.
uli_u
.
icmpt
.
code
=
0
;
fl
.
fl_icmp_
type
=
ICMPV6_ECHO_REPLY
;
fl
.
fl_icmp_
code
=
0
;
icmpv6_xmit_lock
();
...
...
net/ipv6/ip6_output.c
View file @
345b4943
...
...
@@ -147,8 +147,8 @@ int ip6_route_me_harder(struct sk_buff *skb)
fl
.
fl6_src
=
&
iph
->
saddr
;
fl
.
oif
=
skb
->
sk
?
skb
->
sk
->
bound_dev_if
:
0
;
fl
.
fl6_flowlabel
=
0
;
fl
.
uli_u
.
ports
.
dport
=
0
;
fl
.
uli_u
.
ports
.
sport
=
0
;
fl
.
fl_ip_
dport
=
0
;
fl
.
fl_ip_
sport
=
0
;
dst
=
ip6_route_output
(
skb
->
sk
,
&
fl
);
...
...
@@ -188,7 +188,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
struct
ipv6_txoptions
*
opt
)
{
struct
ipv6_pinfo
*
np
=
sk
?
inet6_sk
(
sk
)
:
NULL
;
struct
in6_addr
*
first_hop
=
fl
->
nl_u
.
ip6_u
.
daddr
;
struct
in6_addr
*
first_hop
=
fl
->
fl6_dst
;
struct
dst_entry
*
dst
=
skb
->
dst
;
struct
ipv6hdr
*
hdr
;
u8
proto
=
fl
->
proto
;
...
...
@@ -243,7 +243,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
hdr
->
nexthdr
=
proto
;
hdr
->
hop_limit
=
hlimit
;
ipv6_addr_copy
(
&
hdr
->
saddr
,
fl
->
nl_u
.
ip6_u
.
saddr
);
ipv6_addr_copy
(
&
hdr
->
saddr
,
fl
->
fl6_src
);
ipv6_addr_copy
(
&
hdr
->
daddr
,
first_hop
);
mtu
=
dst_pmtu
(
dst
);
...
...
@@ -308,8 +308,8 @@ static struct ipv6hdr * ip6_bld_1(struct sock *sk, struct sk_buff *skb, struct f
hdr
->
hop_limit
=
hlimit
;
hdr
->
nexthdr
=
fl
->
proto
;
ipv6_addr_copy
(
&
hdr
->
saddr
,
fl
->
nl_u
.
ip6_u
.
saddr
);
ipv6_addr_copy
(
&
hdr
->
daddr
,
fl
->
nl_u
.
ip6_u
.
daddr
);
ipv6_addr_copy
(
&
hdr
->
saddr
,
fl
->
fl6_src
);
ipv6_addr_copy
(
&
hdr
->
daddr
,
fl
->
fl6_dst
);
return
hdr
;
}
...
...
@@ -526,7 +526,7 @@ int ip6_build_xmit(struct sock *sk, inet_getfrag_t getfrag, const void *data,
fl
->
fl6_dst
=
rt0
->
addr
;
}
if
(
!
fl
->
oif
&&
ipv6_addr_is_multicast
(
fl
->
nl_u
.
ip6_u
.
daddr
))
if
(
!
fl
->
oif
&&
ipv6_addr_is_multicast
(
fl
->
fl6_dst
))
fl
->
oif
=
np
->
mcast_oif
;
dst
=
__sk_dst_check
(
sk
,
np
->
dst_cookie
);
...
...
@@ -703,7 +703,7 @@ int ip6_build_xmit(struct sock *sk, inet_getfrag_t getfrag, const void *data,
* cleanup
*/
out:
ip6_dst_store
(
sk
,
dst
,
fl
->
nl_u
.
ip6_u
.
daddr
==
&
np
->
daddr
?
&
np
->
daddr
:
NULL
);
ip6_dst_store
(
sk
,
dst
,
fl
->
fl6_dst
==
&
np
->
daddr
?
&
np
->
daddr
:
NULL
);
if
(
err
>
0
)
err
=
np
->
recverr
?
net_xmit_errno
(
err
)
:
0
;
return
err
;
...
...
net/ipv6/ndisc.c
View file @
345b4943
...
...
@@ -405,8 +405,8 @@ static inline void ndisc_flow_init(struct flowi *fl, u8 type,
fl
->
fl6_src
=
saddr
;
fl
->
fl6_dst
=
daddr
;
fl
->
proto
=
IPPROTO_ICMPV6
;
fl
->
uli_u
.
icmpt
.
type
=
type
;
fl
->
uli_u
.
icmpt
.
code
=
0
;
fl
->
fl_icmp_
type
=
type
;
fl
->
fl_icmp_
code
=
0
;
}
static
void
ndisc_send_na
(
struct
net_device
*
dev
,
struct
neighbour
*
neigh
,
...
...
net/ipv6/raw.c
View file @
345b4943
...
...
@@ -622,8 +622,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
fl
.
fl6_dst
=
daddr
;
if
(
fl
.
fl6_src
==
NULL
&&
!
ipv6_addr_any
(
&
np
->
saddr
))
fl
.
fl6_src
=
&
np
->
saddr
;
fl
.
uli_u
.
icmpt
.
type
=
0
;
fl
.
uli_u
.
icmpt
.
code
=
0
;
fl
.
fl_icmp_
type
=
0
;
fl
.
fl_icmp_
code
=
0
;
if
(
raw_opt
->
checksum
)
{
struct
rawv6_fakehdr
hdr
;
...
...
net/ipv6/route.c
View file @
345b4943
...
...
@@ -449,13 +449,12 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
int
strict
;
int
attempts
=
3
;
strict
=
ipv6_addr_type
(
fl
->
nl_u
.
ip6_u
.
daddr
)
&
(
IPV6_ADDR_MULTICAST
|
IPV6_ADDR_LINKLOCAL
);
strict
=
ipv6_addr_type
(
fl
->
fl6_dst
)
&
(
IPV6_ADDR_MULTICAST
|
IPV6_ADDR_LINKLOCAL
);
relookup:
read_lock_bh
(
&
rt6_lock
);
fn
=
fib6_lookup
(
&
ip6_routing_table
,
fl
->
nl_u
.
ip6_u
.
daddr
,
fl
->
nl_u
.
ip6_u
.
saddr
);
fn
=
fib6_lookup
(
&
ip6_routing_table
,
fl
->
fl6_dst
,
fl
->
fl6_src
);
restart:
rt
=
fn
->
leaf
;
...
...
@@ -477,9 +476,8 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
if
(
!
rt
->
rt6i_nexthop
&&
!
(
rt
->
rt6i_flags
&
RTF_NONEXTHOP
))
{
read_unlock_bh
(
&
rt6_lock
);
rt
=
rt6_cow
(
rt
,
fl
->
nl_u
.
ip6_u
.
daddr
,
fl
->
nl_u
.
ip6_u
.
saddr
);
rt
=
rt6_cow
(
rt
,
fl
->
fl6_dst
,
fl
->
fl6_src
);
if
(
rt
->
u
.
dst
.
error
!=
-
EEXIST
||
--
attempts
<=
0
)
goto
out2
;
...
...
@@ -1585,15 +1583,11 @@ int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
skb
->
mac
.
raw
=
skb
->
data
;
skb_reserve
(
skb
,
MAX_HEADER
+
sizeof
(
struct
ipv6hdr
));
fl
.
proto
=
0
;
fl
.
nl_u
.
ip6_u
.
daddr
=
NULL
;
fl
.
nl_u
.
ip6_u
.
saddr
=
NULL
;
fl
.
uli_u
.
icmpt
.
type
=
0
;
fl
.
uli_u
.
icmpt
.
code
=
0
;
memset
(
&
fl
,
0
,
sizeof
(
fl
));
if
(
rta
[
RTA_SRC
-
1
])
fl
.
nl_u
.
ip6_u
.
saddr
=
(
struct
in6_addr
*
)
RTA_DATA
(
rta
[
RTA_SRC
-
1
]);
fl
.
fl6_src
=
(
struct
in6_addr
*
)
RTA_DATA
(
rta
[
RTA_SRC
-
1
]);
if
(
rta
[
RTA_DST
-
1
])
fl
.
nl_u
.
ip6_u
.
daddr
=
(
struct
in6_addr
*
)
RTA_DATA
(
rta
[
RTA_DST
-
1
]);
fl
.
fl6_dst
=
(
struct
in6_addr
*
)
RTA_DATA
(
rta
[
RTA_DST
-
1
]);
if
(
rta
[
RTA_IIF
-
1
])
memcpy
(
&
iif
,
RTA_DATA
(
rta
[
RTA_IIF
-
1
]),
sizeof
(
int
));
...
...
@@ -1617,8 +1611,7 @@ int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
NETLINK_CB
(
skb
).
dst_pid
=
NETLINK_CB
(
in_skb
).
pid
;
err
=
rt6_fill_node
(
skb
,
rt
,
fl
.
nl_u
.
ip6_u
.
daddr
,
fl
.
nl_u
.
ip6_u
.
saddr
,
fl
.
fl6_dst
,
fl
.
fl6_src
,
iif
,
RTM_NEWROUTE
,
NETLINK_CB
(
in_skb
).
pid
,
nlh
->
nlmsg_seq
,
nlh
);
...
...
net/ipv6/tcp_ipv6.c
View file @
345b4943
...
...
@@ -670,12 +670,12 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
fl
.
fl6_dst
=
&
np
->
daddr
;
fl
.
fl6_src
=
saddr
;
fl
.
oif
=
sk
->
bound_dev_if
;
fl
.
uli_u
.
ports
.
dport
=
usin
->
sin6_port
;
fl
.
uli_u
.
ports
.
sport
=
inet
->
sport
;
fl
.
fl_ip_
dport
=
usin
->
sin6_port
;
fl
.
fl_ip_
sport
=
inet
->
sport
;
if
(
np
->
opt
&&
np
->
opt
->
srcrt
)
{
struct
rt0_hdr
*
rt0
=
(
struct
rt0_hdr
*
)
np
->
opt
->
srcrt
;
fl
.
nl_u
.
ip6_u
.
daddr
=
rt0
->
addr
;
fl
.
fl6_dst
=
rt0
->
addr
;
}
if
(
!
fl
.
fl6_src
)
...
...
@@ -796,11 +796,11 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
for now.
*/
fl
.
proto
=
IPPROTO_TCP
;
fl
.
nl_u
.
ip6_u
.
daddr
=
&
np
->
daddr
;
fl
.
nl_u
.
ip6_u
.
saddr
=
&
np
->
saddr
;
fl
.
fl6_dst
=
&
np
->
daddr
;
fl
.
fl6_src
=
&
np
->
saddr
;
fl
.
oif
=
sk
->
bound_dev_if
;
fl
.
uli_u
.
ports
.
dport
=
inet
->
dport
;
fl
.
uli_u
.
ports
.
sport
=
inet
->
sport
;
fl
.
fl_ip_
dport
=
inet
->
dport
;
fl
.
fl_ip_
sport
=
inet
->
sport
;
dst
=
ip6_route_output
(
sk
,
&
fl
);
}
else
...
...
@@ -881,12 +881,12 @@ static int tcp_v6_send_synack(struct sock *sk, struct open_request *req,
int
err
=
-
1
;
fl
.
proto
=
IPPROTO_TCP
;
fl
.
nl_u
.
ip6_u
.
daddr
=
&
req
->
af
.
v6_req
.
rmt_addr
;
fl
.
nl_u
.
ip6_u
.
saddr
=
&
req
->
af
.
v6_req
.
loc_addr
;
fl
.
fl6_dst
=
&
req
->
af
.
v6_req
.
rmt_addr
;
fl
.
fl6_src
=
&
req
->
af
.
v6_req
.
loc_addr
;
fl
.
fl6_flowlabel
=
0
;
fl
.
oif
=
req
->
af
.
v6_req
.
iif
;
fl
.
uli_u
.
ports
.
dport
=
req
->
rmt_port
;
fl
.
uli_u
.
ports
.
sport
=
inet_sk
(
sk
)
->
sport
;
fl
.
fl_ip_
dport
=
req
->
rmt_port
;
fl
.
fl_ip_
sport
=
inet_sk
(
sk
)
->
sport
;
if
(
dst
==
NULL
)
{
opt
=
np
->
opt
;
...
...
@@ -901,7 +901,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct open_request *req,
if
(
opt
&&
opt
->
srcrt
)
{
struct
rt0_hdr
*
rt0
=
(
struct
rt0_hdr
*
)
opt
->
srcrt
;
fl
.
nl_u
.
ip6_u
.
daddr
=
rt0
->
addr
;
fl
.
fl6_dst
=
rt0
->
addr
;
}
dst
=
ip6_route_output
(
sk
,
&
fl
);
...
...
@@ -917,7 +917,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct open_request *req,
&
req
->
af
.
v6_req
.
loc_addr
,
&
req
->
af
.
v6_req
.
rmt_addr
,
csum_partial
((
char
*
)
th
,
skb
->
len
,
skb
->
csum
));
fl
.
nl_u
.
ip6_u
.
daddr
=
&
req
->
af
.
v6_req
.
rmt_addr
;
fl
.
fl6_dst
=
&
req
->
af
.
v6_req
.
rmt_addr
;
err
=
ip6_xmit
(
sk
,
skb
,
&
fl
,
opt
);
if
(
err
==
NET_XMIT_CN
)
err
=
0
;
...
...
@@ -1019,19 +1019,18 @@ static void tcp_v6_send_reset(struct sk_buff *skb)
buff
->
csum
=
csum_partial
((
char
*
)
t1
,
sizeof
(
*
t1
),
0
);
fl
.
nl_u
.
ip6_u
.
daddr
=
&
skb
->
nh
.
ipv6h
->
saddr
;
fl
.
nl_u
.
ip6_u
.
saddr
=
&
skb
->
nh
.
ipv6h
->
daddr
;
fl
.
fl6_dst
=
&
skb
->
nh
.
ipv6h
->
saddr
;
fl
.
fl6_src
=
&
skb
->
nh
.
ipv6h
->
daddr
;
fl
.
fl6_flowlabel
=
0
;
t1
->
check
=
csum_ipv6_magic
(
fl
.
nl_u
.
ip6_u
.
saddr
,
fl
.
nl_u
.
ip6_u
.
daddr
,
t1
->
check
=
csum_ipv6_magic
(
fl
.
fl6_src
,
fl
.
fl6_dst
,
sizeof
(
*
t1
),
IPPROTO_TCP
,
buff
->
csum
);
fl
.
proto
=
IPPROTO_TCP
;
fl
.
oif
=
tcp_v6_iif
(
skb
);
fl
.
uli_u
.
ports
.
dport
=
t1
->
dest
;
fl
.
uli_u
.
ports
.
sport
=
t1
->
source
;
fl
.
fl_ip_
dport
=
t1
->
dest
;
fl
.
fl_ip_
sport
=
t1
->
source
;
/* sk = NULL, but it is safe for now. RST socket required. */
buff
->
dst
=
ip6_route_output
(
NULL
,
&
fl
);
...
...
@@ -1084,19 +1083,18 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
buff
->
csum
=
csum_partial
((
char
*
)
t1
,
tot_len
,
0
);
fl
.
nl_u
.
ip6_u
.
daddr
=
&
skb
->
nh
.
ipv6h
->
saddr
;
fl
.
nl_u
.
ip6_u
.
saddr
=
&
skb
->
nh
.
ipv6h
->
daddr
;
fl
.
fl6_dst
=
&
skb
->
nh
.
ipv6h
->
saddr
;
fl
.
fl6_src
=
&
skb
->
nh
.
ipv6h
->
daddr
;
fl
.
fl6_flowlabel
=
0
;
t1
->
check
=
csum_ipv6_magic
(
fl
.
nl_u
.
ip6_u
.
saddr
,
fl
.
nl_u
.
ip6_u
.
daddr
,
t1
->
check
=
csum_ipv6_magic
(
fl
.
fl6_src
,
fl
.
fl6_dst
,
tot_len
,
IPPROTO_TCP
,
buff
->
csum
);
fl
.
proto
=
IPPROTO_TCP
;
fl
.
oif
=
tcp_v6_iif
(
skb
);
fl
.
uli_u
.
ports
.
dport
=
t1
->
dest
;
fl
.
uli_u
.
ports
.
sport
=
t1
->
source
;
fl
.
fl_ip_
dport
=
t1
->
dest
;
fl
.
fl_ip_
sport
=
t1
->
source
;
buff
->
dst
=
ip6_route_output
(
NULL
,
&
fl
);
...
...
@@ -1335,16 +1333,16 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
if
(
dst
==
NULL
)
{
fl
.
proto
=
IPPROTO_TCP
;
fl
.
nl_u
.
ip6_u
.
daddr
=
&
req
->
af
.
v6_req
.
rmt_addr
;
fl
.
fl6_dst
=
&
req
->
af
.
v6_req
.
rmt_addr
;
if
(
opt
&&
opt
->
srcrt
)
{
struct
rt0_hdr
*
rt0
=
(
struct
rt0_hdr
*
)
opt
->
srcrt
;
fl
.
nl_u
.
ip6_u
.
daddr
=
rt0
->
addr
;
fl
.
fl6_dst
=
rt0
->
addr
;
}
fl
.
nl_u
.
ip6_u
.
saddr
=
&
req
->
af
.
v6_req
.
loc_addr
;
fl
.
fl6_src
=
&
req
->
af
.
v6_req
.
loc_addr
;
fl
.
fl6_flowlabel
=
0
;
fl
.
oif
=
sk
->
bound_dev_if
;
fl
.
uli_u
.
ports
.
dport
=
req
->
rmt_port
;
fl
.
uli_u
.
ports
.
sport
=
inet_sk
(
sk
)
->
sport
;
fl
.
fl_ip_
dport
=
req
->
rmt_port
;
fl
.
fl_ip_
sport
=
inet_sk
(
sk
)
->
sport
;
dst
=
ip6_route_output
(
sk
,
&
fl
);
}
...
...
@@ -1732,16 +1730,16 @@ static int tcp_v6_rebuild_header(struct sock *sk)
struct
flowi
fl
;
fl
.
proto
=
IPPROTO_TCP
;
fl
.
nl_u
.
ip6_u
.
daddr
=
&
np
->
daddr
;
fl
.
nl_u
.
ip6_u
.
saddr
=
&
np
->
saddr
;
fl
.
fl6_dst
=
&
np
->
daddr
;
fl
.
fl6_src
=
&
np
->
saddr
;
fl
.
fl6_flowlabel
=
np
->
flow_label
;
fl
.
oif
=
sk
->
bound_dev_if
;
fl
.
uli_u
.
ports
.
dport
=
inet
->
dport
;
fl
.
uli_u
.
ports
.
sport
=
inet
->
sport
;
fl
.
fl_ip_
dport
=
inet
->
dport
;
fl
.
fl_ip_
sport
=
inet
->
sport
;
if
(
np
->
opt
&&
np
->
opt
->
srcrt
)
{
struct
rt0_hdr
*
rt0
=
(
struct
rt0_hdr
*
)
np
->
opt
->
srcrt
;
fl
.
nl_u
.
ip6_u
.
daddr
=
rt0
->
addr
;
fl
.
fl6_dst
=
rt0
->
addr
;
}
dst
=
ip6_route_output
(
sk
,
&
fl
);
...
...
@@ -1774,12 +1772,12 @@ static int tcp_v6_xmit(struct sk_buff *skb, int ipfragok)
fl
.
fl6_flowlabel
=
np
->
flow_label
;
IP6_ECN_flow_xmit
(
sk
,
fl
.
fl6_flowlabel
);
fl
.
oif
=
sk
->
bound_dev_if
;
fl
.
uli_u
.
ports
.
sport
=
inet
->
sport
;
fl
.
uli_u
.
ports
.
dport
=
inet
->
dport
;
fl
.
fl_ip_
sport
=
inet
->
sport
;
fl
.
fl_ip_
dport
=
inet
->
dport
;
if
(
np
->
opt
&&
np
->
opt
->
srcrt
)
{
struct
rt0_hdr
*
rt0
=
(
struct
rt0_hdr
*
)
np
->
opt
->
srcrt
;
fl
.
nl_u
.
ip6_u
.
daddr
=
rt0
->
addr
;
fl
.
fl6_dst
=
rt0
->
addr
;
}
dst
=
__sk_dst_check
(
sk
,
np
->
dst_cookie
);
...
...
@@ -1799,7 +1797,7 @@ static int tcp_v6_xmit(struct sk_buff *skb, int ipfragok)
skb
->
dst
=
dst_clone
(
dst
);
/* Restore final destination back after routing done */
fl
.
nl_u
.
ip6_u
.
daddr
=
&
np
->
daddr
;
fl
.
fl6_dst
=
&
np
->
daddr
;
return
ip6_xmit
(
sk
,
skb
,
&
fl
,
np
->
opt
);
}
...
...
net/ipv6/udp.c
View file @
345b4943
...
...
@@ -352,8 +352,8 @@ int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
fl
.
fl6_dst
=
&
np
->
daddr
;
fl
.
fl6_src
=
&
saddr
;
fl
.
oif
=
sk
->
bound_dev_if
;
fl
.
uli_u
.
ports
.
dport
=
inet
->
dport
;
fl
.
uli_u
.
ports
.
sport
=
inet
->
sport
;
fl
.
fl_ip_
dport
=
inet
->
dport
;
fl
.
fl_ip_
sport
=
inet
->
sport
;
if
(
!
fl
.
oif
&&
(
addr_type
&
IPV6_ADDR_MULTICAST
))
fl
.
oif
=
np
->
mcast_oif
;
...
...
@@ -936,8 +936,8 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
fl
.
fl6_dst
=
daddr
;
if
(
fl
.
fl6_src
==
NULL
&&
!
ipv6_addr_any
(
&
np
->
saddr
))
fl
.
fl6_src
=
&
np
->
saddr
;
fl
.
uli_u
.
ports
.
dport
=
udh
.
uh
.
dest
;
fl
.
uli_u
.
ports
.
sport
=
udh
.
uh
.
source
;
fl
.
fl_ip_
dport
=
udh
.
uh
.
dest
;
fl
.
fl_ip_
sport
=
udh
.
uh
.
source
;
err
=
ip6_build_xmit
(
sk
,
udpv6_getfrag
,
&
udh
,
&
fl
,
len
,
opt
,
hlimit
,
msg
->
msg_flags
);
...
...
net/ipv6/xfrm6_policy.c
View file @
345b4943
...
...
@@ -195,8 +195,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl)
if
(
pskb_may_pull
(
skb
,
skb
->
nh
.
raw
+
offset
+
4
-
skb
->
data
))
{
u16
*
ports
=
(
u16
*
)
exthdr
;
fl
->
uli_u
.
ports
.
sport
=
ports
[
0
];
fl
->
uli_u
.
ports
.
dport
=
ports
[
1
];
fl
->
fl_ip_
sport
=
ports
[
0
];
fl
->
fl_ip_
dport
=
ports
[
1
];
}
return
;
...
...
@@ -205,7 +205,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl)
case
IPPROTO_ESP
:
case
IPPROTO_COMP
:
default:
fl
->
uli_u
.
spi
=
0
;
fl
->
fl_ipsec_
spi
=
0
;
return
;
};
}
...
...
net/ipv6/xfrm6_state.c
View file @
345b4943
...
...
@@ -27,9 +27,9 @@ __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl,
* to current session. */
memcpy
(
&
x
->
sel
.
daddr
,
fl
->
fl6_dst
,
sizeof
(
struct
in6_addr
));
memcpy
(
&
x
->
sel
.
saddr
,
fl
->
fl6_src
,
sizeof
(
struct
in6_addr
));
x
->
sel
.
dport
=
fl
->
uli_u
.
ports
.
dport
;
x
->
sel
.
dport
=
fl
->
fl_ip_
dport
;
x
->
sel
.
dport_mask
=
~
0
;
x
->
sel
.
sport
=
fl
->
uli_u
.
ports
.
sport
;
x
->
sel
.
sport
=
fl
->
fl_ip_
sport
;
x
->
sel
.
sport_mask
=
~
0
;
x
->
sel
.
prefixlen_d
=
128
;
x
->
sel
.
prefixlen_s
=
128
;
...
...
net/sctp/ipv6.c
View file @
345b4943
...
...
@@ -165,8 +165,8 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport,
fl
.
oif
=
transport
->
saddr
.
v6
.
sin6_scope_id
;
else
fl
.
oif
=
sk
->
bound_dev_if
;
fl
.
uli_u
.
ports
.
sport
=
inet_sk
(
sk
)
->
sport
;
fl
.
uli_u
.
ports
.
dport
=
transport
->
ipaddr
.
v6
.
sin6_port
;
fl
.
fl_ip_
sport
=
inet_sk
(
sk
)
->
sport
;
fl
.
fl_ip_
dport
=
transport
->
ipaddr
.
v6
.
sin6_port
;
if
(
np
->
opt
&&
np
->
opt
->
srcrt
)
{
struct
rt0_hdr
*
rt0
=
(
struct
rt0_hdr
*
)
np
->
opt
->
srcrt
;
...
...
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