Skip to contentSkip to conversation

ip6tnl: do route updating for redirect in ip6_tnl_err()

PATCH In review Duan Jiong 2 participants 2 messages Sep 18, 2013

Subsystems (3)
lore
Share & tools
lore

Duan Jiong

author
#0 lore raw

PATCH 1/1 ip6tnl: do route updating for redirect in ip6_tnl_err()

From: Duan Jiong <[email protected]>

After the ip6_tnl_err() is called, the rel_msg is assigned to 0, and the ip4ip6_err()will return directly, the instruction below will not be executed.

In rfc2473, we can know that the tunnel ICMP redirect message should not be reported to the source of the original packet, so we can handle it in ip4ip6_err().

---
 net/ipv6/ip6_tunnel.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
net/ipv6/ip6_tunnel.c +3 -5
index 2d8f482..35c4b70 100644
@@ -529,6 +529,9 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
 			rel_msg = 1;
 		}
 		break;
+	case NDISC_REDIRECT:
+		ip6_redirect(skb, net, 0, 0);
+		break;
 	}
 
 	*type = rel_type;
@@ -576,9 +579,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 +637,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
#1 lore raw
Quoted 20 lines · Duan Jiong

From: Duan Jiong <[email protected]>

After the ip6_tnl_err() is called, the rel_msg is assigned to 0, and the ip4ip6_err()will return directly, the instruction below will not be executed.

In rfc2473, we can know that the tunnel ICMP redirect message should not be reported to the source of the original packet, so we can handle it in ip4ip6_err().

---
 net/ipv6/ip6_tunnel.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
net/ipv6/ip6_tunnel.c +0 -0
index 2d8f482..35c4b70 100644

net/ipv6/ip6_tunnel.c ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt, · line 533

Quoted 5 lines
net/ipv6/ip6_tunnel.c +2 -0
@@ -529,6 +529,9 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
 			rel_msg = 1;
 		}
 		break;
+	case NDISC_REDIRECT:
+		ip6_redirect(skb, net, 0, 0);

sorry, it should be

ip6_redirect(skb, dev_net(skb->dev), skb->dev->ifindex, 0);

Quoted 23 lines
net/ipv6/ip6_tunnel.c +1 -5
+		break;
 	}
 
 	*type = rel_type;
@@ -576,9 +579,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 +637,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));