Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec18d9a2 authored by David S. Miller's avatar David S. Miller
Browse files

ipv6: Add redirect support to all protocol icmp error handlers.

parent 3a5ad2ee
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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_icmp_frag_needed(struct sock *, struct sctp_association *,
			   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,
				 struct sctp_association *asoc,
				 struct sctp_transport *t);
+7 −0
Original line number Diff line number Diff line
@@ -130,6 +130,13 @@ 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->ops->redirect(dst, skb);
	}

	if (type == ICMPV6_PKT_TOOBIG) {
		struct dst_entry *dst = NULL;

+6 −4
Original line number Diff line number Diff line
@@ -613,15 +613,17 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
	struct xfrm_state *x;

	if (type != ICMPV6_DEST_UNREACH &&
	    type != ICMPV6_PKT_TOOBIG)
	    type != ICMPV6_PKT_TOOBIG &&
	    type != NDISC_REDIRECT)
		return;

	x = xfrm_state_lookup(net, skb->mark, (xfrm_address_t *)&iph->daddr, ah->spi, IPPROTO_AH, AF_INET6);
	if (!x)
		return;

	NETDEBUG(KERN_DEBUG "pmtu discovery on SA AH/%08x/%pI6\n",
		 ntohl(ah->spi), &iph->daddr);
	if (type == NDISC_REDIRECT)
		ip6_redirect(skb, net, 0, 0);
	else
		ip6_update_pmtu(skb, net, info, 0, 0);
	xfrm_state_put(x);
}
+7 −4
Original line number Diff line number Diff line
@@ -434,15 +434,18 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
	struct xfrm_state *x;

	if (type != ICMPV6_DEST_UNREACH &&
	    type != ICMPV6_PKT_TOOBIG)
	    type != ICMPV6_PKT_TOOBIG &&
	    type != NDISC_REDIRECT)
		return;

	x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr,
			      esph->spi, IPPROTO_ESP, AF_INET6);
	if (!x)
		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);
	xfrm_state_put(x);
}
+7 −0
Original line number Diff line number Diff line
@@ -550,6 +550,9 @@ 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;
	}
@@ -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);
	}
	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));

Loading