From: Alex Gartrell Subject: [PATCH net-next 09/12] ipvs: ensure that ICMP cannot be sent in reply to ICMP Date: Wed, 12 Aug 2015 13:47:07 -0700 Message-ID: <1439412430-1702375-10-git-send-email-agartrell@fb.com> References: <1439412430-1702375-1-git-send-email-agartrell@fb.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=KFTMp7PsHnZKG35tlj5pGJFRjKCoVBS7HCtYcK+j52s=; b=c6FrXLlGIWq56xR3caDqgUhMk6R81tQM/51zghm0340uqwtVWbm33iQX0cCzm1vGa3iz JGnyGDRmz1lKgvT6kn1ZwhOt9DQwtBuSSd6mE8BrHr/xOE2lAJ45NvPLx18Sv5LC6meI zbT00biOEozbdTwC3xPuShehdn1WuD/ST0s= In-Reply-To: <1439412430-1702375-1-git-send-email-agartrell@fb.com> Sender: lvs-devel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ja@ssi.bg, horms@verge.net.au, lvs-devel@vger.kernel.org Cc: kernel-team@fb.com, alexgartrell@gmail.com, Alex Gartrell Check the header for icmp before sending a PACKET_TOO_BIG Signed-off-by: Alex Gartrell --- net/netfilter/ipvs/ip_vs_xmit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c index 7691738..97e8769 100644 --- a/net/netfilter/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c @@ -224,7 +224,7 @@ static inline bool ensure_mtu_is_adequate(int skb_af, int rt_mode, if (!skb->dev) skb->dev = net->loopback_dev; /* only send ICMP too big on first fragment */ - if (!ipvsh->fragoffs) + if (!ipvsh->fragoffs && !ip_vs_iph_icmp(ipvsh)) icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); IP_VS_DBG(1, "frag needed for %pI6c\n", &ipv6_hdr(skb)->saddr); @@ -242,7 +242,8 @@ static inline bool ensure_mtu_is_adequate(int skb_af, int rt_mode, return true; if (unlikely(ip_hdr(skb)->frag_off & htons(IP_DF) && - skb->len > mtu && !skb_is_gso(skb))) { + skb->len > mtu && !skb_is_gso(skb) && + !ip_vs_iph_icmp(ipvsh))) { icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); IP_VS_DBG(1, "frag needed for %pI4\n", -- Alex Gartrell