From patchwork Thu Oct 26 19:09:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Herbert X-Patchwork-Id: 830893 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quantonium-net.20150623.gappssmtp.com header.i=@quantonium-net.20150623.gappssmtp.com header.b="xXDGDSDw"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yNGmZ5XlVz9s7f for ; Fri, 27 Oct 2017 06:10:22 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751997AbdJZTKU (ORCPT ); Thu, 26 Oct 2017 15:10:20 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:55021 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751950AbdJZTKQ (ORCPT ); Thu, 26 Oct 2017 15:10:16 -0400 Received: by mail-pg0-f66.google.com with SMTP id l24so3423270pgu.11 for ; Thu, 26 Oct 2017 12:10:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantonium-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c9b+Zk1pz2iqm+GXKGvvZ1oRizQA5GgRF8hIJCjrWB0=; b=xXDGDSDwbBDizvPenmQmVsavwfcAK0TJmCKP/RWkGJTqCreBpDmYLFiqDXWNGokA3j IGiS1XmxUnufoQDvpRDsyQDyFGEbhblhJli6+aj2qhzsZW0rFPZn2dFWIxEKPbjXcGZF jynP1scKsyAK4+ZiTFCbDk7GvmwlOdgtj1smb1REILR5CRwPUpW1qmE+EjN/b+rvShre FNyMxPi3ioz+ntB4yEzkkqLQkiN4hKmf2WaY3Fx7WFrrLQ0b1Vnj2/csQYlQDBM6VqYh IsP/Qoo7K5RYLe7TKQ0B2mkW4XSnKT077SMX6Qa0wUG+FdrHB4FC+cAPykXlyZSJr8Ua +VgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c9b+Zk1pz2iqm+GXKGvvZ1oRizQA5GgRF8hIJCjrWB0=; b=mXJ/7epji+fW0ySGAmLuOjtTokRvDhqzeyYuv9aVHpWLfH2dgy5OTp0gX9rHGGyhc8 yXPuvoPJ1bsSMp/vnCLx5o+v9MfFpbJnUHFXvZ/2snuKXRlQAzS+fVVp3f8iZaTHj42e PnDG5qa1h/XF4MMDKBGaKRrdvWCfjPbkTolg39NdWQqZfdxRkLQmHkDLEttd3Zl9taYa smYn+2ULjGBY8+E3jpi9tDmFiSfT7oJWf6ZGArXaAhalJaQPeH+whP0qDSQpGkFV8Qat 0sa/+9kGgiR7Unfki2vwAjjruu78V7FPimmdBQLWgEpeJW34rg2tPFdCUtqs2JzlNNl3 vGMA== X-Gm-Message-State: AMCzsaVY8MgCz3mV0BYOMovvN8XEojqpbS6E2MqvqV5vEIaXDvg9vhEG LKEI3rsNnxco+tzcivpyqDf9+Q== X-Google-Smtp-Source: ABhQp+TGjEyHrpXSz3vp6LwLldoK/iCIldyk/BE9B+jHEmnJ0qNyDhNnCjr0ysTz1030TZ386XOfeA== X-Received: by 10.98.65.11 with SMTP id o11mr6493032pfa.86.1509045015653; Thu, 26 Oct 2017 12:10:15 -0700 (PDT) Received: from localhost.localdomain (67-207-98-108.static.wiline.com. [67.207.98.108]) by smtp.gmail.com with ESMTPSA id j1sm11071502pfc.169.2017.10.26.12.10.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Oct 2017 12:10:13 -0700 (PDT) From: Tom Herbert To: davem@davemloft.net Cc: pablo@netfilter.org, laforge@gnumonks.org, aschultz@tpip.net, netdev@vger.kernel.org, rohit@quantonium.net, Tom Herbert Subject: [PATCH v6 net-next 08/12] gtp: Call function to update path mtu Date: Thu, 26 Oct 2017 12:09:25 -0700 Message-Id: <20171026190929.11619-9-tom@quantonium.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171026190929.11619-1-tom@quantonium.net> References: <20171026190929.11619-1-tom@quantonium.net> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Replace mtu handling with call to __iptunnel_update_pmtu. Signed-off-by: Tom Herbert --- drivers/net/gtp.c | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index a6e2e0a1f424..bbb08f8849d3 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -53,6 +53,7 @@ struct pdp_ctx { } v1; } u; u8 gtp_version; + u8 hlen; u16 af; struct in_addr ms_addr_ip4; @@ -467,8 +468,6 @@ static int gtp_build_skb_ip4(struct sk_buff *skb, struct net_device *dev, struct iphdr *iph; struct sock *sk; __be32 saddr; - __be16 df; - int mtu; /* Read the IP destination address and resolve the PDP context. * Prepend PDP header with TEI/TID from PDP ctx. @@ -514,37 +513,12 @@ static int gtp_build_skb_ip4(struct sk_buff *skb, struct net_device *dev, skb_dst_drop(skb); - /* This is similar to tnl_update_pmtu(). */ - df = iph->frag_off; - if (df) { - mtu = dst_mtu(&rt->dst) - dev->hard_header_len - - sizeof(struct iphdr) - sizeof(struct udphdr); - switch (pctx->gtp_version) { - case GTP_V0: - mtu -= sizeof(struct gtp0_header); - break; - case GTP_V1: - mtu -= sizeof(struct gtp1_header); - break; - } - } else { - mtu = dst_mtu(&rt->dst); - } - - rt->dst.ops->update_pmtu(&rt->dst, NULL, skb, mtu); - - if (!skb_is_gso(skb) && (iph->frag_off & htons(IP_DF)) && - mtu < ntohs(iph->tot_len)) { - netdev_dbg(dev, "packet too big, fragmentation needed\n"); - memset(IPCB(skb), 0, sizeof(*IPCB(skb))); - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, - htonl(mtu)); - goto err_rt; - } - gtp_set_pktinfo_ipv4(pktinfo, sk, iph, pctx, rt, &fl4, dev); gtp_push_header(skb, pktinfo); + __iptunnel_update_pmtu(dev, skb, &rt->dst, !!iph->frag_off, iph, + pctx->hlen, pctx->peer_addr_ip4.s_addr); + return 0; err_rt: ip_rt_put(rt); @@ -915,10 +889,12 @@ static void ipv4_pdp_fill(struct pdp_ctx *pctx, struct genl_info *info) */ pctx->u.v0.tid = nla_get_u64(info->attrs[GTPA_TID]); pctx->u.v0.flow = nla_get_u16(info->attrs[GTPA_FLOW]); + pctx->hlen = sizeof(struct udphdr) + sizeof(struct gtp0_header); break; case GTP_V1: pctx->u.v1.i_tei = nla_get_u32(info->attrs[GTPA_I_TEI]); pctx->u.v1.o_tei = nla_get_u32(info->attrs[GTPA_O_TEI]); + pctx->hlen = sizeof(struct udphdr) + sizeof(struct gtp1_header); break; default: break;