From patchwork Tue Aug 6 10:45:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Timo Teras X-Patchwork-Id: 264994 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 67DD42C007B for ; Tue, 6 Aug 2013 20:45:24 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756078Ab3HFKpT (ORCPT ); Tue, 6 Aug 2013 06:45:19 -0400 Received: from mail-ea0-f179.google.com ([209.85.215.179]:47471 "EHLO mail-ea0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756063Ab3HFKpS (ORCPT ); Tue, 6 Aug 2013 06:45:18 -0400 Received: by mail-ea0-f179.google.com with SMTP id b10so133610eae.10 for ; Tue, 06 Aug 2013 03:45:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=Ovh5zgQuiykCPpIBZ2HAF3I4aOTAbz7mK2oTtG+zsEA=; b=ZPsVCzAI16iqfJKP6c7OgdnQH8wX0x6VzlM00I81J3GF6fb+56jUcLssXachH4Njwv 4IOWaeaToOxukxRMva7EJyywhYSxTalMTeabfvKXS36Oc7tODoFPMg+bkymhZU/gKs+W etuAeDAQrp8ka8Cm/Y+7wQkKPsbZXgqnVU61wvYeofTcKxLYor6CBmH8Vw9zVuFCuQvA 1loWF1aG7e7gHauG7l+yQtkx5JhYIVW0Ba/rtOJpvSUYweNVjZuqzANBoD2BuxrVl5N7 Z2AMMlL1ztXV2mYMu2b1y7aMHsSasEP/gcwx3FvgQh9M8AVrZmp5YiHSWgtBYAZjwI4K V5Ug== X-Received: by 10.15.93.134 with SMTP id w6mr766878eez.25.1375785916798; Tue, 06 Aug 2013 03:45:16 -0700 (PDT) Received: from vostro.util.wtbts.net ([83.145.235.199]) by mx.google.com with ESMTPSA id l42sm1295060eeo.14.2013.08.06.03.45.13 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 Aug 2013 03:45:14 -0700 (PDT) From: =?UTF-8?q?Timo=20Ter=C3=A4s?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Timo=20Ter=C3=A4s?= , Pravin B Shelar Subject: [PATCH net] ip_gre: fix ipgre_header to return correct offset Date: Tue, 6 Aug 2013 13:45:43 +0300 Message-Id: <1375785943-23908-1-git-send-email-timo.teras@iki.fi> X-Mailer: git-send-email 1.8.3.4 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Fix ipgre_header() (header_ops->create) to return the correct amount of bytes pushed. Most callers of dev_hard_header() seem to care only if it was success, but af_packet.c uses it as offset to the skb to copy from userspace only once. In practice this fixes packet socket sendto()/sendmsg() to gre tunnels. Regression introduced in c54419321455631079c7d6e60bc732dd0c5914c5 ("GRE: Refactor GRE tunneling code.") Cc: Pravin B Shelar Signed-off-by: Timo Teräs Acked-by: Eric Dumazet --- Should go to 3.10-stable too. Without this dmvpn setup does not work at all, as opennhrp uses packet sockets to send the nhrp packets. net/ipv4/ip_gre.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 855004f..c52fee0 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -572,7 +572,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, if (daddr) memcpy(&iph->daddr, daddr, 4); if (iph->daddr) - return t->hlen; + return t->hlen + sizeof(*iph); return -(t->hlen + sizeof(*iph)); }