From patchwork Thu Oct 8 10:11:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schultz X-Patchwork-Id: 527663 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 063DB140D93 for ; Thu, 8 Oct 2015 21:12:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753529AbbJHKMB (ORCPT ); Thu, 8 Oct 2015 06:12:01 -0400 Received: from mail.tpip.net ([92.43.49.48]:45583 "EHLO mail.tpip.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752412AbbJHKMA (ORCPT ); Thu, 8 Oct 2015 06:12:00 -0400 Received: from office.tpip.net (office.tpip.net [92.43.51.2]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.tpip.net (Postfix) with ESMTPS id 1A8A14F414; Thu, 8 Oct 2015 10:11:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by office.tpip.net (Postfix) with ESMTP id 1B771A2F79; Thu, 8 Oct 2015 12:11:57 +0200 (CEST) Received: from office.tpip.net ([127.0.0.1]) by localhost (office.tpip.net [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id FfFaU134Bqug; Thu, 8 Oct 2015 12:11:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by office.tpip.net (Postfix) with ESMTP id 7AB34A2F78; Thu, 8 Oct 2015 12:11:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at tpip.net Received: from office.tpip.net ([127.0.0.1]) by localhost (office.tpip.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id kQUOgL4wEXUG; Thu, 8 Oct 2015 12:11:56 +0200 (CEST) Received: from alice.tpip.org (unknown [192.168.13.53]) by office.tpip.net (Postfix) with ESMTPSA id 26DA9A2F77; Thu, 8 Oct 2015 12:11:56 +0200 (CEST) From: Andreas Schultz To: netdev@vger.kernel.org Cc: Pravin B Shelar , "David S. Miller" Subject: [PATCH net v2] fix return of iptunnel_xmit Date: Thu, 8 Oct 2015 12:11:54 +0200 Message-Id: <1444299114-21345-1-git-send-email-aschultz@tpip.net> X-Mailer: git-send-email 2.1.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org All users of iptunnel_xmit expect the return value to be the error code from ip_output_local, but currently the return value is length of the send data on success or zero on error. Change iptunnel_xmit returns to match the callers expectation. This bug was introduced when the ip_tunnel_core code was refactored. Fixes: 0e6fbc5b6c6218987c93b8c7ca60cf786062899d Signed-off-by: Andreas Schultz --- Change in v2: - remove unused variable pkt_len --- net/ipv4/ip_tunnel_core.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c index 84dce6a..c167c4a 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c @@ -52,9 +52,7 @@ int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, __be32 src, __be32 dst, __u8 proto, __u8 tos, __u8 ttl, __be16 df, bool xnet) { - int pkt_len = skb->len - skb_inner_network_offset(skb); struct iphdr *iph; - int err; skb_scrub_packet(skb, xnet); @@ -79,10 +77,7 @@ int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, __ip_select_ident(dev_net(rt->dst.dev), iph, skb_shinfo(skb)->gso_segs ?: 1); - err = ip_local_out_sk(sk, skb); - if (unlikely(net_xmit_eval(err))) - pkt_len = 0; - return pkt_len; + return ip_local_out_sk(sk, skb); } EXPORT_SYMBOL_GPL(iptunnel_xmit);