ipv6: Do route updating for redirect in ndisc layer
Subsystems (7)
v3 cover ipv6: Do route updating for redirect in ndisc layer
From: Duan Jiong <[email protected]>
the ip6_redirect() could be replaced with ip6_redirect_no_header(), we could always use ip6_redirect() for route updating in ndisc layer and use the data of the redirected header option just for finding the socket to be notified and then notify user in protocols' err_handler.
---
Changes for v3:
1.del the ICMP6_INC_STATS_BH error count, these are in fact
no errors.
Changes for v2:
1.handle the update of the NDISC_REDIRECT error code directly in
icmpv6_err_convert.
2.squash some patchs into one patch.
3.modify the subject of those patchs.
Duan Jiong (6):
ipv6: del the statements for updating route in (dccp|tcp|sctp)_v6_err
ipv6: just match on ICMPV6_PKT_TOOBIG in those err_handle
ipv6: del statements for dealing with NDISC_REDIRECT
ip6tnl: move route updating for redirect to ndisc layer
ipv6: modify the err to 0 when dealing with NDISC_REDIRECT
ipv6: Do route updating for redirect in ndisc layer
include/net/ip6_route.h | 3 --- net/dccp/ipv6.c | 13 +------------ net/ipv6/ah6.c | 9 ++------- net/ipv6/esp6.c | 9 ++------- net/ipv6/icmp.c | 5 +++-- net/ipv6/ip6_tunnel.c | 5 ----- net/ipv6/ipcomp6.c | 9 ++------- net/ipv6/ndisc.c | 6 ++---- net/ipv6/raw.c | 3 +-- net/ipv6/route.c | 29 ++--------------------------- net/ipv6/tcp_ipv6.c | 12 ++++-------- net/ipv6/udp.c | 2 -- net/sctp/input.c | 12 ------------ net/sctp/ipv6.c | 6 +++--- 14 files changed, 22 insertions(+), 101 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v3 1/6 ipv6: del the statements for updating route in, (dccp|tcp|sctp)_v6_err
Because we will do route updating for redirect in nidsc layer. And when dealing with redirect message, the dccp and sctp should like tcp return directly.
--- net/dccp/ipv6.c | 10 +++------- net/ipv6/tcp_ipv6.c | 12 ++++-------- net/sctp/input.c | 12 ------------ net/sctp/ipv6.c | 6 +++--- 4 files changed, 10 insertions(+), 30 deletions(-)
net/dccp/ipv6.c +3 -7
@@ -98,6 +98,9 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,return ; } +if (type ==NDISC_REDIRECT ) +return ; + sk =inet6_lookup (net, &dccp_hashinfo, &hdr->daddr, dh->dccph_dport, &hdr->saddr, dh->dccph_sport,inet6_iif (skb));
@@ -130,13 +133,6 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 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, sk, skb); - } -if (type ==ICMPV6_PKT_TOOBIG ) {struct dst_entry *dst =NULL ;
net/ipv6/tcp_ipv6.c +4 -8
@@ -346,6 +346,10 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,__u32 seq;struct net *net =dev_net (skb->dev); + +if (type ==NDISC_REDIRECT ) +return ; + sk =inet6_lookup (net, &tcp_hashinfo, &hdr->daddr, th->dest, &hdr->saddr, th->source, skb->dev->ifindex);
@@ -382,14 +386,6 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 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, sk, skb); - goto out; - } -if (type ==ICMPV6_PKT_TOOBIG ) {/* We are not interested in TCP_LISTEN and open_requests * (SYN-ACKs send out by Linux are always <576bytes so
net/sctp/input.c +0 -12
@@ -413,18 +413,6 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,sctp_retransmit (&asoc->outqueue, t,SCTP_RTXR_PMTUD ); } -void sctp_icmp_redirect (struct sock *sk,struct sctp_transport *t, -struct sk_buff *skb) -{ -struct dst_entry *dst; - -if (!t) -return ; - dst =sctp_transport_dst_check (t); -if (dst) - dst->ops->redirect (dst, sk, skb); -} -/* * SCTP Implementer's Guide, 2.37 ICMP handling procedures *
net/sctp/ipv6.c +3 -3
@@ -151,6 +151,9 @@ static void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,int err;struct net *net =dev_net (skb->dev); +if (type ==NDISC_REDIRECT ) +return ; + idev =in6_dev_get (skb->dev);/* Fix up skb to look at the embedded net header. */
@@ -181,9 +184,6 @@ static void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, goto out_unlock; }break ; -case NDISC_REDIRECT : -sctp_icmp_redirect (sk, transport, skb); -break ;default :break ; }
Signature · 1 line
1.8.3.1
PATCH v3 2/6 ipv6: just match on ICMPV6_PKT_TOOBIG in those err_handle
In reply to Duan JiongFrom: Duan Jiong <[email protected]>
we don't handle NDISC_REDIRECTs here any more, and the match on ICMPV6_DEST_UNREACH is meaningless.
--- net/dccp/ipv6.c | 7 ------- net/ipv6/ah6.c | 9 ++------- net/ipv6/esp6.c | 9 ++------- net/ipv6/ipcomp6.c | 9 ++------- 4 files changed, 6 insertions(+), 28 deletions(-)
net/dccp/ipv6.c +0 -7
@@ -91,13 +91,6 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,__u64 seq;struct net *net =dev_net (skb->dev); -if (skb->len < offset +sizeof (*dh) || - skb->len < offset +__dccp_basic_hdr_len (dh)) { -ICMP6_INC_STATS_BH (net,__in6_dev_get (skb->dev), -ICMP6_MIB_INERRORS ); -return ; - } -if (type =NDISC_REDIRECT )return ;
net/ipv6/ah6.c +2 -7
@@ -618,19 +618,14 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,struct ip_auth_hdr *ah = (struct ip_auth_hdr *)(skb->data+offset);struct xfrm_state *x; -if (type !=ICMPV6_DEST_UNREACH && - type !=ICMPV6_PKT_TOOBIG && - type !=NDISC_REDIRECT ) +if (type !=ICMPV6_PKT_TOOBIG )return ; x =xfrm_state_lookup (net, skb->mark, (xfrm_address_t *)&iph->daddr, ah->spi,IPPROTO_AH ,AF_INET6 );if (!x)return ; -if (type =NDISC_REDIRECT ) -ip6_redirect (skb, net, skb->dev->ifindex,0 ); -else -ip6_update_pmtu (skb, net, info,0 ,0 ); +ip6_update_pmtu (skb, net, info,0 ,0 );xfrm_state_put (x); }
net/ipv6/esp6.c +2 -7
@@ -436,9 +436,7 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data + offset);struct xfrm_state *x; -if (type !=ICMPV6_DEST_UNREACH && - type !=ICMPV6_PKT_TOOBIG && - type !=NDISC_REDIRECT ) +if (type !=ICMPV6_PKT_TOOBIG )return ; x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr,
@@ -446,10 +444,7 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,if (!x)return ; -if (type =NDISC_REDIRECT ) -ip6_redirect (skb, net, skb->dev->ifindex,0 ); -else -ip6_update_pmtu (skb, net, info,0 ,0 ); +ip6_update_pmtu (skb, net, info,0 ,0 );xfrm_state_put (x); }
net/ipv6/ipcomp6.c +2 -7
@@ -64,9 +64,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, (struct ip_comp_hdr *)(skb->data + offset);struct xfrm_state *x; -if (type !=ICMPV6_DEST_UNREACH && - type !=ICMPV6_PKT_TOOBIG && - type !=NDISC_REDIRECT ) +if (type !=ICMPV6_PKT_TOOBIG )return ; spi =htonl (ntohs (ipcomph->cpi));
@@ -75,10 +73,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,if (!x)return ; -if (type =NDISC_REDIRECT ) -ip6_redirect (skb, net, skb->dev->ifindex,0 ); -else -ip6_update_pmtu (skb, net, info,0 ,0 ); +ip6_update_pmtu (skb, net, info,0 ,0 );xfrm_state_put (x); }
Signature · 1 line
1.8.3.1
PATCH v3 3/6 ipv6: del statements for dealing with NDISC_REDIRECT
In reply to Duan JiongFrom: Duan Jiong <[email protected]>
Now the route updating for redirect is done in ndisc layer.
--- net/ipv6/icmp.c | 2 -- 1 file changed, 2 deletions(-)
net/ipv6/icmp.c +0 -2
@@ -91,8 +91,6 @@ static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,if (type ==ICMPV6_PKT_TOOBIG )ip6_update_pmtu (skb, net, info,0 ,0 ); -else if (type ==NDISC_REDIRECT ) -ip6_redirect (skb, net, skb->dev->ifindex,0 );if (!(type &ICMPV6_INFOMSG_MASK ))if (icmp6->icmp6_type ==ICMPV6_ECHO_REQUEST )
Signature · 1 line
1.8.3.1
PATCH v3 4/6 ip6tnl: move route updating for redirect to ndisc layer
In reply to Duan JiongFrom: Duan Jiong <[email protected]>
In rfc2473, we can know that the tunnel ICMP redirect message should not be reported to the source of the original packet, so after calling ip6_tnl_err(), the rel_msg is set to 0 in function ip4ip6_err(), and the redirect will never be handled.
In order to deal with this, we move route updating for redirect to ndisc layer.
--- net/ipv6/ip6_tunnel.c | 5 ----- 1 file changed, 5 deletions(-)
net/ipv6/ip6_tunnel.c +0 -5
@@ -576,9 +576,6 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, rel_type =ICMP_DEST_UNREACH ; rel_code =ICMP_FRAG_NEEDED ;break ; -case NDISC_REDIRECT : - rel_type =ICMP_REDIRECT ; - rel_code =ICMP_REDIR_HOST ;default :return 0 ; }
@@ -637,8 +634,6 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,skb_dst (skb2)->ops->update_pmtu (skb_dst (skb2),NULL , skb2, rel_info); } -if (rel_type ==ICMP_REDIRECT ) -skb_dst (skb2)->ops->redirect (skb_dst (skb2),NULL , skb2);icmp_send (skb2, rel_type, rel_code,htonl (rel_info));
Signature · 1 line
1.8.3.1
PATCH v3 5/6 ipv6: modify the err to 0 when dealing with, NDISC_REDIRECT
In reply to Duan JiongFrom: Duan Jiong <[email protected]>
when dealing with redirect message, the err shoud be assigned to 0, not EPROTO. And del the statements for updating route.
--- net/ipv6/icmp.c | 3 +++ net/ipv6/raw.c | 3 +-- net/ipv6/udp.c | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-)
net/ipv6/icmp.c +3 -0
@@ -975,6 +975,9 @@ int icmpv6_err_convert(u8 type, u8 code, int *err)case ICMPV6_TIME_EXCEED : *err =EHOSTUNREACH ;break ; +case NDISC_REDIRECT : + *err =0 ; +break ; }return fatal;
net/ipv6/raw.c +1 -2
@@ -335,8 +335,7 @@ static void rawv6_err(struct sock *sk, struct sk_buff *skb,ip6_sk_update_pmtu (skb, sk, info); harderr = (np->pmtudisc ==IPV6_PMTUDISC_DO ); } -if (type ==NDISC_REDIRECT ) -ip6_sk_redirect (skb, sk); +if (np->recverr) {u8 *payload = skb->data;if (!inet->hdrincl)
net/ipv6/udp.c +0 -2
@@ -525,8 +525,6 @@ void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,if (type ==ICMPV6_PKT_TOOBIG )ip6_sk_update_pmtu (skb, sk, info); -if (type ==NDISC_REDIRECT ) -ip6_sk_redirect (skb, sk); np =inet6_sk (sk);
Signature · 1 line
1.8.3.1
PATCH v3 6/6 ipv6: Do route updating for redirect in ndisc layer
In reply to Duan JiongFrom: Duan Jiong <[email protected]>
Do the whole verification and route updating in ndisc lay and then just call into icmpv6_notify() to notify the upper protocols.
--- include/net/ip6_route.h | 3 --- net/ipv6/ndisc.c | 6 ++---- net/ipv6/route.c | 29 ++--------------------------- 3 files changed, 4 insertions(+), 34 deletions(-)
include/net/ip6_route.h +0 -3
@@ -133,9 +133,6 @@ extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu,extern void ip6_sk_update_pmtu (struct sk_buff *skb,struct sock *sk,__be32 mtu);extern void ip6_redirect (struct sk_buff *skb,struct net *net,int oif,u32 mark); -extern void ip6_redirect_no_header (struct sk_buff *skb,struct net *net,int oif, -u32 mark); -extern void ip6_sk_redirect (struct sk_buff *skb,struct sock *sk);struct netlink_callback ;
net/ipv6/ndisc.c +2 -4
@@ -1368,11 +1368,9 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)if (!ndisc_parse_options (msg->opt, ndoptlen, &ndopts))return ; -if (!ndopts.nd_opts_rh) { -ip6_redirect_no_header (skb,dev_net (skb->dev), - skb->dev->ifindex,0 ); +ip6_redirect (skb,dev_net (skb->dev), skb->dev->ifindex,0 ); +if (!ndopts.nd_opts_rh)return ; - } hdr = (u8 *)ndopts.nd_opts_rh; hdr +=8 ;
net/ipv6/route.c +2 -27
@@ -1227,27 +1227,7 @@ static struct dst_entry *ip6_route_redirect(struct net *net, flags, __ip6_route_redirect); } -void ip6_redirect (struct sk_buff *skb,struct net *net,int oif,u32 mark) -{ -const struct ipv6hdr *iph = (struct ipv6hdr *) skb->data; -struct dst_entry *dst; -struct flowi6 fl6; - -memset (&fl6,0 ,sizeof (fl6)); - fl6.flowi6_oif = oif; - fl6.flowi6_mark = mark; - fl6.flowi6_flags =0 ; - fl6.daddr = iph->daddr; - fl6.saddr = iph->saddr; - fl6.flowlabel =ip6_flowinfo (iph); - - dst =ip6_route_redirect (net, &fl6, &ipv6_hdr (skb)->saddr); -rt6_do_redirect (dst,NULL , skb); -dst_release (dst); -} -EXPORT_SYMBOL_GPL (ip6_redirect); - -void ip6_redirect_no_header (struct sk_buff *skb,struct net *net,int oif, +void ip6_redirect (struct sk_buff *skb,struct net *net,int oif,u32 mark) {const struct ipv6hdr *iph =ipv6_hdr (skb);
@@ -1266,12 +1246,7 @@ void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,rt6_do_redirect (dst,NULL , skb);dst_release (dst); } - -void ip6_sk_redirect (struct sk_buff *skb,struct sock *sk) -{ -ip6_redirect (skb,sock_net (sk), sk->sk_bound_dev_if, sk->sk_mark); -} -EXPORT_SYMBOL_GPL (ip6_sk_redirect); +EXPORT_SYMBOL_GPL (ip6_redirect);static unsigned int ip6_default_advmss (const struct dst_entry *dst) {
Signature · 1 line
1.8.3.1
Quoted 7 lines · Duan Jiong
From: Duan Jiong <[email protected]>
the
ip6_redirect()could be replaced withip6_redirect_no_header(), we could always useip6_redirect()for route updating in ndisc layer and use the data of the redirected header option just for finding the socket to be notified and then notify user in protocols'err_handler.
If I get this right, it seems to me that this patchset actually consists of two different kind of changes:
1) Not notifying user space on ICMP redirects (net material)
2) Simplify code for updating route in ndisc layer instead of error handlers (net-next)
Also, you do the *actual* change in the very last patch, which means that from patch 1 to 5 we're in an inconsistent and buggy state unless we also apply patch number 6. It should actually be the other way around, that you first do the actual change and then migrate users (also commit messages are quite terse).
Moreover, just looking at the SCTP part (sctp_err_lookup() function) ...
/* RFC 4960, Appendix C. ICMP Handling
*
* ICMP6) An implementation MUST validate that the Verification Tag
* contained in the ICMP message matches the Verification Tag of
* the peer. If the Verification Tag is not 0 and does NOT
* match, discard the ICMP message. If it is 0 and the ICMP
* message contains enough bytes to verify that the chunk type is
* an INIT chunk and that the Initiate Tag matches the tag of the
* peer, continue with ICMP7. If the ICMP message is too short
* or the chunk type or the Initiate Tag does not match, silently
* discard the packet.
*/
... it seems to me that we would simply ignore such RFC requirements with your patch for the sctp_v6_err() part.
Care to elaborate? ;-)
Quoted 35 lines
---
Changes for v3:
1.del theICMP6_INC_STATS_BHerror count, these are in fact
no errors.Changes for v2:
1.handle the update of theNDISC_REDIRECTerror code directly in
icmpv6_err_convert.
2.squash some patchs into one patch.
3.modify the subject of those patchs.Duan Jiong (6):
ipv6: del the statements for updating route in (dccp|tcp|sctp)_v6_err
ipv6: just match onICMPV6_PKT_TOOBIGin thoseerr_handle
ipv6: del statements for dealing withNDISC_REDIRECT
ip6tnl: move route updating for redirect to ndisc layer
ipv6: modify the err to 0 when dealing withNDISC_REDIRECT
ipv6: Do route updating for redirect in ndisc layerinclude/net/ip6_route.h | 3 --- net/dccp/ipv6.c | 13 +------------ net/ipv6/ah6.c | 9 ++------- net/ipv6/esp6.c | 9 ++------- net/ipv6/icmp.c | 5 +++-- net/ipv6/ip6_tunnel.c | 5 ----- net/ipv6/ipcomp6.c | 9 ++------- net/ipv6/ndisc.c | 6 ++---- net/ipv6/raw.c | 3 +-- net/ipv6/route.c | 29 ++--------------------------- net/ipv6/tcp_ipv6.c | 12 ++++-------- net/ipv6/udp.c | 2 -- net/sctp/input.c | 12 ------------ net/sctp/ipv6.c | 6 +++--- 14 files changed, 22 insertions(+), 101 deletions(-)
Re: [PATCH 1/6] ipv6: del the statements for updating route in, (dccp|tcp|sctp)_v6_err
In reply to Duan JiongSorry, i forgot to add "v3" in title.
Thanks,
Duan
Quoted 117 lines · Duan Jiong
Because we will do route updating for redirect in nidsc layer. And when dealing with redirect message, the dccp and sctp should like tcp return directly.
Signed-off-by Duan Jiong <[email protected]>--- net/dccp/ipv6.c | 10 +++------- net/ipv6/tcp_ipv6.c | 12 ++++-------- net/sctp/input.c | 12 ------------ net/sctp/ipv6.c | 6 +++--- 4 files changed, 10 insertions(+), 30 deletions(-)net/dccp/ipv6.c +3
-7@@ -98,6 +98,9 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,return ; } +if (type ==NDISC_REDIRECT ) +return ; + sk =inet6_lookup (net, &dccp_hashinfo, &hdr->daddr, dh->dccph_dport, &hdr->saddr, dh->dccph_sport,inet6_iif (skb));@@ -130,13 +133,6 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 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, sk, skb); - } -if (type ==ICMPV6_PKT_TOOBIG ) {struct dst_entry *dst =NULL ;net/ipv6/tcp_ipv6.c +4
-8@@ -346,6 +346,10 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,__u32 seq;struct net *net =dev_net (skb->dev); + +if (type ==NDISC_REDIRECT ) +return ; + sk =inet6_lookup (net, &tcp_hashinfo, &hdr->daddr, th->dest, &hdr->saddr, th->source, skb->dev->ifindex);@@ -382,14 +386,6 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 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, sk, skb); - goto out; - } -if (type ==ICMPV6_PKT_TOOBIG ) {/* We are not interested in TCP_LISTEN and open_requests * (SYN-ACKs send out by Linux are always <576bytes so net/sctp/input.c +0
-12@@ -413,18 +413,6 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,sctp_retransmit (&asoc->outqueue, t,SCTP_RTXR_PMTUD ); } -void sctp_icmp_redirect (struct sock *sk,struct sctp_transport *t, -struct sk_buff *skb) -{ -struct dst_entry *dst; - -if (!t) -return ; - dst =sctp_transport_dst_check (t); -if (dst) - dst->ops->redirect (dst, sk, skb); -} -/* * SCTP Implementer's Guide, 2.37 ICMP handling procedures * net/sctp/ipv6.c +3
-3@@ -151,6 +151,9 @@ static void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,int err;struct net *net =dev_net (skb->dev); +if (type ==NDISC_REDIRECT ) +return ; + idev =in6_dev_get (skb->dev);/* Fix up skb to look at the embedded net header. */ @@ -181,9 +184,6 @@ static void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, goto out_unlock; }break ; -case NDISC_REDIRECT : -sctp_icmp_redirect (sk, transport, skb); -break ;default :break ; }
davem,
please just ignore this patch set this time, i find some errors in patch 2/6, and i'm so sorry for this.
thanks,
Duan
Quoted 43 lines · Duan Jiong
From: Duan Jiong <[email protected]>
the
ip6_redirect()could be replaced withip6_redirect_no_header(), we could always useip6_redirect()for route updating in ndisc layer and use the data of the redirected header option just for finding the socket to be notified and then notify user in protocols'err_handler.---
Changes for v3:
1.del theICMP6_INC_STATS_BHerror count, these are in fact
no errors.Changes for v2:
1.handle the update of theNDISC_REDIRECTerror code directly in
icmpv6_err_convert.
2.squash some patchs into one patch.
3.modify the subject of those patchs.Duan Jiong (6):
ipv6: del the statements for updating route in (dccp|tcp|sctp)_v6_err
ipv6: just match onICMPV6_PKT_TOOBIGin thoseerr_handle
ipv6: del statements for dealing withNDISC_REDIRECT
ip6tnl: move route updating for redirect to ndisc layer
ipv6: modify the err to 0 when dealing withNDISC_REDIRECT
ipv6: Do route updating for redirect in ndisc layerinclude/net/ip6_route.h | 3 --- net/dccp/ipv6.c | 13 +------------ net/ipv6/ah6.c | 9 ++------- net/ipv6/esp6.c | 9 ++------- net/ipv6/icmp.c | 5 +++-- net/ipv6/ip6_tunnel.c | 5 ----- net/ipv6/ipcomp6.c | 9 ++------- net/ipv6/ndisc.c | 6 ++---- net/ipv6/raw.c | 3 +-- net/ipv6/route.c | 29 ++--------------------------- net/ipv6/tcp_ipv6.c | 12 ++++-------- net/ipv6/udp.c | 2 -- net/sctp/input.c | 12 ------------ net/sctp/ipv6.c | 6 +++--- 14 files changed, 22 insertions(+), 101 deletions(-)
ÓÚ 2013/9/16 20:22, Daniel Borkmann дµÀ:
Quoted 11 lines · Duan Jiong
Quoted 7 lines
From: Duan Jiong <[email protected]>
the
ip6_redirect()could be replaced withip6_redirect_no_header(), we could always useip6_redirect()for route updating in ndisc layer and use the data of the redirected header option just for finding the socket to be notified and then notify user in protocols'err_handler.If I get this right, it seems to me that this patchset actually consists of two different kind of changes:
Quoted 7 lines
1) Not notifying user space on ICMP redirects (net material)
2) Simplify code for updating route in ndisc layer instead of error handlers (net-next)Also, you do the *actual* change in the very last patch, which means that from patch 1 to 5 we're in an inconsistent and buggy state unless we also apply patch number 6. It should actually be the other way around, that you first do the actual change and then migrate users (also commit messages are quite terse).
I make the patch set on net tree, not on net-next. Maybe those things should be done in two patch sets.
Quoted 15 lines
Moreover, just looking at the SCTP part (
sctp_err_lookup()function) .../* RFC 4960, Appendix C. ICMP Handling
*
* ICMP6) An implementation MUST validate that the Verification Tag
* contained in the ICMP message matches the Verification Tag of
* the peer. If the Verification Tag is not 0 and does NOT
* match, discard the ICMP message. If it is 0 and the ICMP
* message contains enough bytes to verify that the chunk type is
* an INIT chunk and that the Initiate Tag matches the tag of the
* peer, continue with ICMP7. If the ICMP message is too short
* or the chunk type or the Initiate Tag does not match, silently
* discard the packet.
*/
Quoted 4 lines
... it seems to me that we would simply ignore such RFC requirements with your patch for the
sctp_v6_err()part.Care to elaborate? ;-)
Sorry, i didn't notice that.
According to the RFC requirements, it suggests that we can't update route for redirect in ndisc layer before calling into sctp_err_lookup(), because we must verify the ICMP Message. Now maybe we update route for redirect in ndisc layer is wrong.
Do you have any idea?
Quoted 39 lines
Quoted 19 lines
---
Changes for v3:
1.del theICMP6_INC_STATS_BHerror count, these are in fact
no errors.Changes for v2:
1.handle the update of theNDISC_REDIRECTerror code directly in
icmpv6_err_convert.
2.squash some patchs into one patch.
3.modify the subject of those patchs.Duan Jiong (6):
ipv6: del the statements for updating route in (dccp|tcp|sctp)_v6_err
ipv6: just match onICMPV6_PKT_TOOBIGin thoseerr_handle
ipv6: del statements for dealing withNDISC_REDIRECT
ip6tnl: move route updating for redirect to ndisc layer
ipv6: modify the err to 0 when dealing withNDISC_REDIRECT
ipv6: Do route updating for redirect in ndisc layerQuoted 16 lines
include/net/ip6_route.h | 3 --- net/dccp/ipv6.c | 13 +------------ net/ipv6/ah6.c | 9 ++------- net/ipv6/esp6.c | 9 ++------- net/ipv6/icmp.c | 5 +++-- net/ipv6/ip6_tunnel.c | 5 ----- net/ipv6/ipcomp6.c | 9 ++------- net/ipv6/ndisc.c | 6 ++---- net/ipv6/raw.c | 3 +-- net/ipv6/route.c | 29 ++--------------------------- net/ipv6/tcp_ipv6.c | 12 ++++-------- net/ipv6/udp.c | 2 -- net/sctp/input.c | 12 ------------ net/sctp/ipv6.c | 6 +++--- 14 files changed, 22 insertions(+), 101 deletions(-)--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 41 lines · Duan Jiong
ÓÚ 2013/9/16 20:22, Daniel Borkmann дµÀ:
Quoted 11 lines · Duan Jiong
Quoted 7 lines
From: Duan Jiong <[email protected]>
the
ip6_redirect()could be replaced withip6_redirect_no_header(), we could always useip6_redirect()for route updating in ndisc layer and use the data of the redirected header option just for finding the socket to be notified and then notify user in protocols'err_handler.If I get this right, it seems to me that this patchset actually consists of two different kind of changes:
Quoted 7 lines
1) Not notifying user space on ICMP redirects (net material)
2) Simplify code for updating route in ndisc layer instead of error handlers (net-next)Also, you do the *actual* change in the very last patch, which means that from patch 1 to 5 we're in an inconsistent and buggy state unless we also apply patch number 6. It should actually be the other way around, that you first do the actual change and then migrate users (also commit messages are quite terse).
I make the patch set on net tree, not on net-next. Maybe those things should be done in two patch sets.
Quoted 18 lines
Moreover, just looking at the SCTP part (
sctp_err_lookup()function) .../* RFC 4960, Appendix C. ICMP Handling
*
* ICMP6) An implementation MUST validate that the Verification Tag
* contained in the ICMP message matches the Verification Tag of
* the peer. If the Verification Tag is not 0 and does NOT
* match, discard the ICMP message. If it is 0 and the ICMP
* message contains enough bytes to verify that the chunk type is
* an INIT chunk and that the Initiate Tag matches the tag of the
* peer, continue with ICMP7. If the ICMP message is too short
* or the chunk type or the Initiate Tag does not match, silently
* discard the packet.
*/... it seems to me that we would simply ignore such RFC requirements with your patch for the
sctp_v6_err()part.
Quoted 8 lines
Quoted 1 line
Care to elaborate? ;-)
Sorry, i didn't notice that.
According to the RFC requirements, it suggests that we can't update route for redirect in ndisc layer before calling into
sctp_err_lookup(), because we must verify the ICMP Message. Now maybe we update route for redirect in ndisc layer is wrong.
Looking further into RFC4960 [1] ... it says:
Appendix C. ICMP Handling
Whenever an ICMP message is received by an SCTP endpoint, the following procedures MUST be followed to ensure proper utilization of the information being provided by layer 3.
ICMP1) An implementation MAY ignore all ICMPv4 messages where the
type field is not set to "Destination Unreachable".
ICMP2) An implementation MAY ignore all ICMPv6 messages where the
type field is not "Destination Unreachable", "Parameter Problem", or "Packet Too Big".
...
So this basically means that only packets in step 2 are interesting for us here, we *may* ignore the rest. The verification comes at step 6, so we may have ignored the packet first. ;-) Therefore, I think your proposal should not be an issue for SCTP.
I'd however prefer that your patch handles this similarly as in sctp_v4_err(), so that in the default switch-case, we just go to out_unlock.
In any case, your commit message would need to be more elaborate and reflect "why" it is okay/safe to change that in SCTP or other cases, preferably with reference to the RFC. Otherwise, looking at the Git history in future will just be confusing as it won't clarify why it was reasonable doing so this way.
Quoted 15 lines · Duan Jiong
Quoted 14 lines · Daniel Borkmann
Quoted 7 lines · Duan Jiong
From: Duan Jiong <[email protected]>
the
ip6_redirect()could be replaced withip6_redirect_no_header(), we could always useip6_redirect()for route updating in ndisc layer and use the data of the redirected header option just for finding the socket to be notified and then notify user in protocols'err_handler.If I get this right, it seems to me that this patchset actually consists of two different kind of changes:
1) Not notifying user space on ICMP redirects (net material)
2) Simplify code for updating route in ndisc layer instead of error handlers (net-next)
Quoted 7 lines
Quoted 4 lines
Also, you do the *actual* change in the very last patch, which means that from patch 1 to 5 we're in an inconsistent and buggy state unless we also apply patch number 6. It should actually be the other way around, that you first do the actual change and then migrate users (also commit messages are quite terse).
I make the patch set on net tree, not on net-next. Maybe those things should be done in two patch sets.
I have thought about going the other direction. Just make it one patch and update the whole logic atomically in the git tree. So we won't have any partial logic updates in the tree.
Please also rebase your series onto net from today, because Daniel's patch regarding updating sk->sk_err in sctp went in yesterday.
Quoted 20 lines
Quoted 15 lines
Moreover, just looking at the SCTP part (
sctp_err_lookup()function) .../* RFC 4960, Appendix C. ICMP Handling
*
* ICMP6) An implementation MUST validate that the Verification Tag
* contained in the ICMP message matches the Verification Tag of
* the peer. If the Verification Tag is not 0 and does NOT
* match, discard the ICMP message. If it is 0 and the ICMP
* message contains enough bytes to verify that the chunk type is
* an INIT chunk and that the Initiate Tag matches the tag of the
* peer, continue with ICMP7. If the ICMP message is too short
* or the chunk type or the Initiate Tag does not match, silently
* discard the packet.
*/Quoted 4 lines
... it seems to me that we would simply ignore such RFC requirements with your patch for the
sctp_v6_err()part.Care to elaborate? ;-)
Quoted 8 lines
Sorry, i didn't notice that.
According to the RFC requirements, it suggests that we can't update route for redirect in ndisc layer before calling into
sctp_err_lookup(), because we must verify the ICMP Message. Now maybe we update route for redirect in ndisc layer is wrong.Do you have any idea?
IMO updating of routes in ndisc layer is fine. We already accept redirects (and also change routes) for sctp connections where the redirect packet does not contain any tag. Also it is debatable if redirects are counted as icmp packets or merely just belong to the kind of neighbour discovery packets which just use icmp framing (and so the sctp rfc would not say anything about them).
As Daniel already said, it would be better to update the commit message to clarify the reasons why this is ok (with some pointers to RFCs).
Greetings,
Hannes