Commit 89621f31 authored by Alex Gartrell's avatar Alex Gartrell Committed by Simon Horman

ipvs: ensure that ICMP cannot be sent in reply to ICMP

Check the header for icmp before sending a PACKET_TOO_BIG
Signed-off-by: default avatarAlex Gartrell <agartrell@fb.com>
Acked-by: default avatarJulian Anastasov <ja@ssi.bg>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
parent 6044eeff
...@@ -224,7 +224,7 @@ static inline bool ensure_mtu_is_adequate(int skb_af, int rt_mode, ...@@ -224,7 +224,7 @@ static inline bool ensure_mtu_is_adequate(int skb_af, int rt_mode,
if (!skb->dev) if (!skb->dev)
skb->dev = net->loopback_dev; skb->dev = net->loopback_dev;
/* only send ICMP too big on first fragment */ /* 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); icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
IP_VS_DBG(1, "frag needed for %pI6c\n", IP_VS_DBG(1, "frag needed for %pI6c\n",
&ipv6_hdr(skb)->saddr); &ipv6_hdr(skb)->saddr);
...@@ -242,7 +242,8 @@ static inline bool ensure_mtu_is_adequate(int skb_af, int rt_mode, ...@@ -242,7 +242,8 @@ static inline bool ensure_mtu_is_adequate(int skb_af, int rt_mode,
return true; return true;
if (unlikely(ip_hdr(skb)->frag_off & htons(IP_DF) && 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, icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
htonl(mtu)); htonl(mtu));
IP_VS_DBG(1, "frag needed for %pI4\n", IP_VS_DBG(1, "frag needed for %pI4\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment