Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1547542

Re: [PATCH] net: fix incorrect original ingress device index in PKTINFO

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Newsgroups linux.kernel
Subject Re: [PATCH] net: fix incorrect original ingress device index in PKTINFO
Date Tue, 27 Dec 2016 11:10:02 +0100
Message-ID <sSWRI-FY-15@gated-at.bofh.it> (permalink)
References <sSUPT-7Eo-5@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=kvHkk05JhlpuCDhp55N8Bdp63EaZe6YKpUMhqi6Fck4=; b=BOeHBhtOrjsF89Q6OPj5EDMcg9kN7e43k8tUq7Evmk8qmEm7YDTY4jk9+bjZvKBs7V E5DAbe9n4Bd9jG487fAvWrkAhDzyoK1bfXLxIEdDv1bL3tvEYk3RIUqD7mf4ZuH1fW5O f/MkI6XUAR8UPtwBoQgNhumi5aFkwX3VUcgo4vjF1f3HbxtTgc9aaZLoZiIAMaIoa/jJ xtGtq/ZzR97nyDJOPH1NnCTFI2faO9FdFPYybuhXcp4ogBJfz0yvqLRpKDqfOxNYhvJf ux8L9H0sCDhqgAfYYspmU0oQvpX22Y3T9ARUiiVCE5XnVRKHn1qd2eX29qRzmCLWEWnV 3aAw==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=kvHkk05JhlpuCDhp55N8Bdp63EaZe6YKpUMhqi6Fck4=; b=sM1ZEOfevZP90eHiN7DXUbVAQmMsAunMUF+uT24i+jS9ZFjPNSRtEgVAOKX/sr7BYS m4Pl9Z1Tn766JuXNr4n5ZuLjMDPsrSYIhq9fRkRNsnwcI29UAM+UvQ6lC/8ww6bnlSJ0 sgtCe32HHriCSRPyZh8wuSEcxUJeNCdiClzYkYrL1m018HR8OcuBET9rPMBMBFBn9xuX R/SQf2X3FibpoOWeUdtKrqdndkaxO4z5cOOUwvq78aSbU5m+THmtNvE01uU5t080mr47 H8jtrWJUM4+FEBFdb5bRkkHzoptn2dWFGQYUyZ104dL9/zEsU5mz7ql/OonpjSunARzn dIbA==
X-Gm-Message-State AIkVDXKoOfXwB4W5yBKdkdX/l0dWweqELFkOdzW5XruSiHXHMGrFUm5FY1DugqatdRhyww==
X-Received by 10.25.25.71 with SMTP id 68mr11050870lfz.9.1482832890907; Tue, 27 Dec 2016 02:01:30 -0800 (PST)
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 45
Organization linux.* mail to news gateway
X-Original-Cc netdev@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Tue, 27 Dec 2016 13:01:29 +0300
X-Original-Message-ID <f6d9c559-cd3c-4f0e-6bb3-954f8e116e8e@cogentembedded.com>
X-Original-References <1482825138-2125-1-git-send-email-asuka.com@163.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1547542

Show key headers only | View raw


Hello!

On 12/27/2016 10:52 AM, Wei Zhang wrote:

> When we send a packet for our own local address on a non-loopback interface
> (e.g. eth0), due to the change had been introduced from commit 0b922b7a829c
> ("net: original ingress device index in PKTINFO"), the original ingress
> device index would be set as the loopback interface. However, the packet
> should be considered as if it is being arrived via the sending interface
> (eth0), otherwise it would break the expectation of the userspace
> application (e.g. the DHCPRELEASE message from dhcp_release binary would
> be ignored by the dnsmasq daemon)
>
> Signed-off-by: Wei Zhang <asuka.com@163.com>
> ---
>  net/ipv4/ip_sockglue.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
> index b8a2d63..b6a6d35 100644
> --- a/net/ipv4/ip_sockglue.c
> +++ b/net/ipv4/ip_sockglue.c
> @@ -1202,8 +1202,13 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)
>  		 * which has interface index (iif) as the first member of the
>  		 * underlying inet{6}_skb_parm struct. This code then overlays
>  		 * PKTINFO_SKB_CB and in_pktinfo also has iif as the first
> -		 * element so the iif is picked up from the prior IPCB
> +		 * element so the iif is picked up from the prior IPCB except
> +		 * iif is loopback interface which the packet should be

    Tail space.

> +		 * considered as if it is being arrived via the sending interface
>  		 */
> +		if (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX) {
> +			pktinfo->ipi_ifindex = inet_iif(skb);
> +		}

    {} not needed here.

>  		pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);
>  	} else {
>  		pktinfo->ipi_ifindex = 0;

MBR, Sergei

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] net: fix incorrect original ingress device index in PKTINFO Wei Zhang <asuka.com@163.com> - 2016-12-27 09:00 +0100
  Re:[PATCH] net: fix incorrect original ingress device index in  PKTINFO "wei zhang" <asuka.com@163.com> - 2016-12-27 09:50 +0100
  Re: [PATCH] net: fix incorrect original ingress device index in  PKTINFO Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-12-27 11:10 +0100

csiph-web