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
ec18d9a2
Commit
ec18d9a2
authored
Jul 12, 2012
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ipv6: Add redirect support to all protocol icmp error handlers.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
3a5ad2ee
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
69 additions
and
14 deletions
+69
-14
include/net/sctp/sctp.h
include/net/sctp/sctp.h
+2
-0
net/dccp/ipv6.c
net/dccp/ipv6.c
+7
-0
net/ipv6/ah6.c
net/ipv6/ah6.c
+6
-4
net/ipv6/esp6.c
net/ipv6/esp6.c
+7
-4
net/ipv6/ip6_tunnel.c
net/ipv6/ip6_tunnel.c
+7
-0
net/ipv6/ipcomp6.c
net/ipv6/ipcomp6.c
+7
-4
net/ipv6/raw.c
net/ipv6/raw.c
+2
-0
net/ipv6/sit.c
net/ipv6/sit.c
+8
-0
net/ipv6/tcp_ipv6.c
net/ipv6/tcp_ipv6.c
+7
-0
net/ipv6/udp.c
net/ipv6/udp.c
+2
-0
net/ipv6/xfrm6_policy.c
net/ipv6/xfrm6_policy.c
+9
-0
net/sctp/input.c
net/sctp/input.c
+2
-2
net/sctp/ipv6.c
net/sctp/ipv6.c
+3
-0
No files found.
include/net/sctp/sctp.h
View file @
ec18d9a2
...
@@ -162,6 +162,8 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *,
...
@@ -162,6 +162,8 @@ struct sock *sctp_err_lookup(int family, struct sk_buff *,
void
sctp_err_finish
(
struct
sock
*
,
struct
sctp_association
*
);
void
sctp_err_finish
(
struct
sock
*
,
struct
sctp_association
*
);
void
sctp_icmp_frag_needed
(
struct
sock
*
,
struct
sctp_association
*
,
void
sctp_icmp_frag_needed
(
struct
sock
*
,
struct
sctp_association
*
,
struct
sctp_transport
*
t
,
__u32
pmtu
);
struct
sctp_transport
*
t
,
__u32
pmtu
);
void
sctp_icmp_redirect
(
struct
sock
*
,
struct
sctp_transport
*
,
struct
sk_buff
*
);
void
sctp_icmp_proto_unreachable
(
struct
sock
*
sk
,
void
sctp_icmp_proto_unreachable
(
struct
sock
*
sk
,
struct
sctp_association
*
asoc
,
struct
sctp_association
*
asoc
,
struct
sctp_transport
*
t
);
struct
sctp_transport
*
t
);
...
...
net/dccp/ipv6.c
View file @
ec18d9a2
...
@@ -130,6 +130,13 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
...
@@ -130,6 +130,13 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
np
=
inet6_sk
(
sk
);
np
=
inet6_sk
(
sk
);
if
(
type
==
NDISC_REDIRECT
)
{
struct
dst_entry
*
dst
=
__sk_dst_check
(
sk
,
np
->
dst_cookie
);
if
(
dst
&&
dst
->
ops
->
redirect
)
dst
->
ops
->
redirect
(
dst
,
skb
);
}
if
(
type
==
ICMPV6_PKT_TOOBIG
)
{
if
(
type
==
ICMPV6_PKT_TOOBIG
)
{
struct
dst_entry
*
dst
=
NULL
;
struct
dst_entry
*
dst
=
NULL
;
...
...
net/ipv6/ah6.c
View file @
ec18d9a2
...
@@ -613,15 +613,17 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
...
@@ -613,15 +613,17 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
struct
xfrm_state
*
x
;
struct
xfrm_state
*
x
;
if
(
type
!=
ICMPV6_DEST_UNREACH
&&
if
(
type
!=
ICMPV6_DEST_UNREACH
&&
type
!=
ICMPV6_PKT_TOOBIG
)
type
!=
ICMPV6_PKT_TOOBIG
&&
type
!=
NDISC_REDIRECT
)
return
;
return
;
x
=
xfrm_state_lookup
(
net
,
skb
->
mark
,
(
xfrm_address_t
*
)
&
iph
->
daddr
,
ah
->
spi
,
IPPROTO_AH
,
AF_INET6
);
x
=
xfrm_state_lookup
(
net
,
skb
->
mark
,
(
xfrm_address_t
*
)
&
iph
->
daddr
,
ah
->
spi
,
IPPROTO_AH
,
AF_INET6
);
if
(
!
x
)
if
(
!
x
)
return
;
return
;
NETDEBUG
(
KERN_DEBUG
"pmtu discovery on SA AH/%08x/%pI6
\n
"
,
if
(
type
==
NDISC_REDIRECT
)
ntohl
(
ah
->
spi
),
&
iph
->
daddr
);
ip6_redirect
(
skb
,
net
,
0
,
0
);
else
ip6_update_pmtu
(
skb
,
net
,
info
,
0
,
0
);
ip6_update_pmtu
(
skb
,
net
,
info
,
0
,
0
);
xfrm_state_put
(
x
);
xfrm_state_put
(
x
);
}
}
...
...
net/ipv6/esp6.c
View file @
ec18d9a2
...
@@ -434,15 +434,18 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
...
@@ -434,15 +434,18 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
struct
xfrm_state
*
x
;
struct
xfrm_state
*
x
;
if
(
type
!=
ICMPV6_DEST_UNREACH
&&
if
(
type
!=
ICMPV6_DEST_UNREACH
&&
type
!=
ICMPV6_PKT_TOOBIG
)
type
!=
ICMPV6_PKT_TOOBIG
&&
type
!=
NDISC_REDIRECT
)
return
;
return
;
x
=
xfrm_state_lookup
(
net
,
skb
->
mark
,
(
const
xfrm_address_t
*
)
&
iph
->
daddr
,
x
=
xfrm_state_lookup
(
net
,
skb
->
mark
,
(
const
xfrm_address_t
*
)
&
iph
->
daddr
,
esph
->
spi
,
IPPROTO_ESP
,
AF_INET6
);
esph
->
spi
,
IPPROTO_ESP
,
AF_INET6
);
if
(
!
x
)
if
(
!
x
)
return
;
return
;
pr_debug
(
"pmtu discovery on SA ESP/%08x/%pI6
\n
"
,
ntohl
(
esph
->
spi
),
&
iph
->
daddr
);
if
(
type
==
NDISC_REDIRECT
)
ip6_redirect
(
skb
,
net
,
0
,
0
);
else
ip6_update_pmtu
(
skb
,
net
,
info
,
0
,
0
);
ip6_update_pmtu
(
skb
,
net
,
info
,
0
,
0
);
xfrm_state_put
(
x
);
xfrm_state_put
(
x
);
}
}
...
...
net/ipv6/ip6_tunnel.c
View file @
ec18d9a2
...
@@ -550,6 +550,9 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
...
@@ -550,6 +550,9 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
rel_type
=
ICMP_DEST_UNREACH
;
rel_type
=
ICMP_DEST_UNREACH
;
rel_code
=
ICMP_FRAG_NEEDED
;
rel_code
=
ICMP_FRAG_NEEDED
;
break
;
break
;
case
NDISC_REDIRECT
:
rel_type
=
ICMP_REDIRECT
;
rel_code
=
ICMP_REDIR_HOST
;
default:
default:
return
0
;
return
0
;
}
}
...
@@ -608,6 +611,10 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
...
@@ -608,6 +611,10 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
skb_dst
(
skb2
)
->
ops
->
update_pmtu
(
skb_dst
(
skb2
),
rel_info
);
skb_dst
(
skb2
)
->
ops
->
update_pmtu
(
skb_dst
(
skb2
),
rel_info
);
}
}
if
(
rel_type
==
ICMP_REDIRECT
)
{
if
(
skb_dst
(
skb2
)
->
ops
->
redirect
)
skb_dst
(
skb2
)
->
ops
->
redirect
(
skb_dst
(
skb2
),
skb2
);
}
icmp_send
(
skb2
,
rel_type
,
rel_code
,
htonl
(
rel_info
));
icmp_send
(
skb2
,
rel_type
,
rel_code
,
htonl
(
rel_info
));
...
...
net/ipv6/ipcomp6.c
View file @
ec18d9a2
...
@@ -64,7 +64,9 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
...
@@ -64,7 +64,9 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
(
struct
ip_comp_hdr
*
)(
skb
->
data
+
offset
);
(
struct
ip_comp_hdr
*
)(
skb
->
data
+
offset
);
struct
xfrm_state
*
x
;
struct
xfrm_state
*
x
;
if
(
type
!=
ICMPV6_DEST_UNREACH
&&
type
!=
ICMPV6_PKT_TOOBIG
)
if
(
type
!=
ICMPV6_DEST_UNREACH
&&
type
!=
ICMPV6_PKT_TOOBIG
&&
type
!=
NDISC_REDIRECT
)
return
;
return
;
spi
=
htonl
(
ntohs
(
ipcomph
->
cpi
));
spi
=
htonl
(
ntohs
(
ipcomph
->
cpi
));
...
@@ -73,8 +75,9 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
...
@@ -73,8 +75,9 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
if
(
!
x
)
if
(
!
x
)
return
;
return
;
pr_debug
(
"pmtu discovery on SA IPCOMP/%08x/%pI6
\n
"
,
if
(
type
==
NDISC_REDIRECT
)
spi
,
&
iph
->
daddr
);
ip6_redirect
(
skb
,
net
,
0
,
0
);
else
ip6_update_pmtu
(
skb
,
net
,
info
,
0
,
0
);
ip6_update_pmtu
(
skb
,
net
,
info
,
0
,
0
);
xfrm_state_put
(
x
);
xfrm_state_put
(
x
);
}
}
...
...
net/ipv6/raw.c
View file @
ec18d9a2
...
@@ -332,6 +332,8 @@ static void rawv6_err(struct sock *sk, struct sk_buff *skb,
...
@@ -332,6 +332,8 @@ static void rawv6_err(struct sock *sk, struct sk_buff *skb,
ip6_sk_update_pmtu
(
skb
,
sk
,
info
);
ip6_sk_update_pmtu
(
skb
,
sk
,
info
);
harderr
=
(
np
->
pmtudisc
==
IPV6_PMTUDISC_DO
);
harderr
=
(
np
->
pmtudisc
==
IPV6_PMTUDISC_DO
);
}
}
if
(
type
==
NDISC_REDIRECT
)
ip6_sk_redirect
(
skb
,
sk
);
if
(
np
->
recverr
)
{
if
(
np
->
recverr
)
{
u8
*
payload
=
skb
->
data
;
u8
*
payload
=
skb
->
data
;
if
(
!
inet
->
hdrincl
)
if
(
!
inet
->
hdrincl
)
...
...
net/ipv6/sit.c
View file @
ec18d9a2
...
@@ -539,6 +539,8 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
...
@@ -539,6 +539,8 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
if
(
code
!=
ICMP_EXC_TTL
)
if
(
code
!=
ICMP_EXC_TTL
)
return
0
;
return
0
;
break
;
break
;
case
ICMP_REDIRECT
:
break
;
}
}
err
=
-
ENOENT
;
err
=
-
ENOENT
;
...
@@ -557,6 +559,12 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
...
@@ -557,6 +559,12 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
err
=
0
;
err
=
0
;
goto
out
;
goto
out
;
}
}
if
(
type
==
ICMP_REDIRECT
)
{
ipv4_redirect
(
skb
,
dev_net
(
skb
->
dev
),
t
->
dev
->
ifindex
,
0
,
IPPROTO_IPV6
,
0
);
err
=
0
;
goto
out
;
}
if
(
t
->
parms
.
iph
.
daddr
==
0
)
if
(
t
->
parms
.
iph
.
daddr
==
0
)
goto
out
;
goto
out
;
...
...
net/ipv6/tcp_ipv6.c
View file @
ec18d9a2
...
@@ -363,6 +363,13 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
...
@@ -363,6 +363,13 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
np
=
inet6_sk
(
sk
);
np
=
inet6_sk
(
sk
);
if
(
type
==
NDISC_REDIRECT
)
{
struct
dst_entry
*
dst
=
__sk_dst_check
(
sk
,
np
->
dst_cookie
);
if
(
dst
&&
dst
->
ops
->
redirect
)
dst
->
ops
->
redirect
(
dst
,
skb
);
}
if
(
type
==
ICMPV6_PKT_TOOBIG
)
{
if
(
type
==
ICMPV6_PKT_TOOBIG
)
{
struct
dst_entry
*
dst
;
struct
dst_entry
*
dst
;
...
...
net/ipv6/udp.c
View file @
ec18d9a2
...
@@ -483,6 +483,8 @@ void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
...
@@ -483,6 +483,8 @@ void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
if
(
type
==
ICMPV6_PKT_TOOBIG
)
if
(
type
==
ICMPV6_PKT_TOOBIG
)
ip6_sk_update_pmtu
(
skb
,
sk
,
info
);
ip6_sk_update_pmtu
(
skb
,
sk
,
info
);
if
(
type
==
NDISC_REDIRECT
)
ip6_sk_redirect
(
skb
,
sk
);
np
=
inet6_sk
(
sk
);
np
=
inet6_sk
(
sk
);
...
...
net/ipv6/xfrm6_policy.c
View file @
ec18d9a2
...
@@ -215,6 +215,14 @@ static void xfrm6_update_pmtu(struct dst_entry *dst, u32 mtu)
...
@@ -215,6 +215,14 @@ static void xfrm6_update_pmtu(struct dst_entry *dst, u32 mtu)
path
->
ops
->
update_pmtu
(
path
,
mtu
);
path
->
ops
->
update_pmtu
(
path
,
mtu
);
}
}
static
void
xfrm6_redirect
(
struct
dst_entry
*
dst
,
struct
sk_buff
*
skb
)
{
struct
xfrm_dst
*
xdst
=
(
struct
xfrm_dst
*
)
dst
;
struct
dst_entry
*
path
=
xdst
->
route
;
path
->
ops
->
redirect
(
path
,
skb
);
}
static
void
xfrm6_dst_destroy
(
struct
dst_entry
*
dst
)
static
void
xfrm6_dst_destroy
(
struct
dst_entry
*
dst
)
{
{
struct
xfrm_dst
*
xdst
=
(
struct
xfrm_dst
*
)
dst
;
struct
xfrm_dst
*
xdst
=
(
struct
xfrm_dst
*
)
dst
;
...
@@ -261,6 +269,7 @@ static struct dst_ops xfrm6_dst_ops = {
...
@@ -261,6 +269,7 @@ static struct dst_ops xfrm6_dst_ops = {
.
protocol
=
cpu_to_be16
(
ETH_P_IPV6
),
.
protocol
=
cpu_to_be16
(
ETH_P_IPV6
),
.
gc
=
xfrm6_garbage_collect
,
.
gc
=
xfrm6_garbage_collect
,
.
update_pmtu
=
xfrm6_update_pmtu
,
.
update_pmtu
=
xfrm6_update_pmtu
,
.
redirect
=
xfrm6_redirect
,
.
cow_metrics
=
dst_cow_metrics_generic
,
.
cow_metrics
=
dst_cow_metrics_generic
,
.
destroy
=
xfrm6_dst_destroy
,
.
destroy
=
xfrm6_dst_destroy
,
.
ifdown
=
xfrm6_dst_ifdown
,
.
ifdown
=
xfrm6_dst_ifdown
,
...
...
net/sctp/input.c
View file @
ec18d9a2
...
@@ -423,7 +423,7 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
...
@@ -423,7 +423,7 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
sctp_retransmit
(
&
asoc
->
outqueue
,
t
,
SCTP_RTXR_PMTUD
);
sctp_retransmit
(
&
asoc
->
outqueue
,
t
,
SCTP_RTXR_PMTUD
);
}
}
static
void
sctp_icmp_redirect
(
struct
sock
*
sk
,
struct
sctp_transport
*
t
,
void
sctp_icmp_redirect
(
struct
sock
*
sk
,
struct
sctp_transport
*
t
,
struct
sk_buff
*
skb
)
struct
sk_buff
*
skb
)
{
{
struct
dst_entry
*
dst
;
struct
dst_entry
*
dst
;
...
...
net/sctp/ipv6.c
View file @
ec18d9a2
...
@@ -185,6 +185,9 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
...
@@ -185,6 +185,9 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
goto
out_unlock
;
goto
out_unlock
;
}
}
break
;
break
;
case
NDISC_REDIRECT
:
sctp_icmp_redirect
(
sk
,
transport
,
skb
);
break
;
default:
default:
break
;
break
;
}
}
...
...
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