linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 4.17 34/66] net/ipv6: Fix linklocal to global address with VRF
Date: Fri, 27 Jul 2018 11:45:27 +0200	[thread overview]
Message-ID: <20180727093812.960566568@linuxfoundation.org> (raw)
In-Reply-To: <20180727093809.043856530@linuxfoundation.org>

4.17-stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Ahern <dsahern@gmail.com>

[ Upstream commit 24b711edfc34bc45777a3f068812b7d1ed004a5d ]

Example setup:
    host: ip -6 addr add dev eth1 2001:db8:104::4
           where eth1 is enslaved to a VRF

    switch: ip -6 ro add 2001:db8:104::4/128 dev br1
            where br1 only has an LLA

           ping6 2001:db8:104::4
           ssh   2001:db8:104::4

(NOTE: UDP works fine if the PKTINFO has the address set to the global
address and ifindex is set to the index of eth1 with a destination an
LLA).

For ICMP, icmp6_iif needs to be updated to check if skb->dev is an
L3 master. If it is then return the ifindex from rt6i_idev similar
to what is done for loopback.

For TCP, restore the original tcp_v6_iif definition which is needed in
most places and add a new tcp_v6_iif_l3_slave that considers the
l3_slave variability. This latter check is only needed for socket
lookups.

Fixes: 9ff74384600a ("net: vrf: Handle ipv6 multicast and link-local addresses")
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/net/tcp.h   |    5 +++++
 net/ipv6/icmp.c     |    5 +++--
 net/ipv6/tcp_ipv6.c |    6 ++++--
 3 files changed, 12 insertions(+), 4 deletions(-)

--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -829,6 +829,11 @@ struct tcp_skb_cb {
  */
 static inline int tcp_v6_iif(const struct sk_buff *skb)
 {
+	return TCP_SKB_CB(skb)->header.h6.iif;
+}
+
+static inline int tcp_v6_iif_l3_slave(const struct sk_buff *skb)
+{
 	bool l3_slave = ipv6_l3mdev_skb(TCP_SKB_CB(skb)->header.h6.flags);
 
 	return l3_slave ? skb->skb_iif : TCP_SKB_CB(skb)->header.h6.iif;
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -402,9 +402,10 @@ static int icmp6_iif(const struct sk_buf
 
 	/* for local traffic to local address, skb dev is the loopback
 	 * device. Check if there is a dst attached to the skb and if so
-	 * get the real device index.
+	 * get the real device index. Same is needed for replies to a link
+	 * local address on a device enslaved to an L3 master device
 	 */
-	if (unlikely(iif == LOOPBACK_IFINDEX)) {
+	if (unlikely(iif == LOOPBACK_IFINDEX || netif_is_l3_master(skb->dev))) {
 		const struct rt6_info *rt6 = skb_rt6_info(skb);
 
 		if (rt6)
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -934,7 +934,8 @@ static void tcp_v6_send_reset(const stru
 					   &tcp_hashinfo, NULL, 0,
 					   &ipv6h->saddr,
 					   th->source, &ipv6h->daddr,
-					   ntohs(th->source), tcp_v6_iif(skb),
+					   ntohs(th->source),
+					   tcp_v6_iif_l3_slave(skb),
 					   tcp_v6_sdif(skb));
 		if (!sk1)
 			goto out;
@@ -1605,7 +1606,8 @@ do_time_wait:
 					    skb, __tcp_hdrlen(th),
 					    &ipv6_hdr(skb)->saddr, th->source,
 					    &ipv6_hdr(skb)->daddr,
-					    ntohs(th->dest), tcp_v6_iif(skb),
+					    ntohs(th->dest),
+					    tcp_v6_iif_l3_slave(skb),
 					    sdif);
 		if (sk2) {
 			struct inet_timewait_sock *tw = inet_twsk(sk);



  parent reply	other threads:[~2018-07-27  9:49 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27  9:44 [PATCH 4.17 00/66] 4.17.11-stable review Greg Kroah-Hartman
2018-07-27  9:44 ` [PATCH 4.17 01/66] KVM: VMX: support MSR_IA32_ARCH_CAPABILITIES as a feature MSR Greg Kroah-Hartman
2018-07-27  9:44 ` [PATCH 4.17 02/66] Revert "iommu/intel-iommu: Enable CONFIG_DMA_DIRECT_OPS=y and clean up intel_{alloc,free}_coherent()" Greg Kroah-Hartman
2018-07-27  9:44 ` [PATCH 4.17 03/66] MIPS: ath79: fix register address in ath79_ddr_wb_flush() Greg Kroah-Hartman
2018-07-27  9:44 ` [PATCH 4.17 04/66] MIPS: Fix off-by-one in pci_resource_to_user() Greg Kroah-Hartman
2018-07-27  9:44 ` [PATCH 4.17 05/66] clk: mvebu: armada-37xx-periph: Fix switching CPU rate from 300Mhz to 1.2GHz Greg Kroah-Hartman
2018-07-27  9:44 ` [PATCH 4.17 06/66] clk: aspeed: Mark bclk (PCIe) and dclk (VGA) as critical Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 08/66] xen/PVH: Set up GS segment for stack canary Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 09/66] KVM: PPC: Check if IOMMU page is contained in the pinned physical page Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 10/66] drm/nouveau/drm/nouveau: Fix runtime PM leak in nv50_disp_atomic_commit() Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 11/66] drm/nouveau: Set DRIVER_ATOMIC cap earlier to fix debugfs Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 12/66] clk: meson-gxbb: set fclk_div2 as CLK_IS_CRITICAL Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 13/66] bonding: set default miimon value for non-arp modes if not set Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 14/66] ip: hash fragments consistently Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 15/66] ip: in cmsg IP(V6)_ORIGDSTADDR call pskb_may_pull Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 17/66] net/mlx4_core: Save the qpn from the input modifier in RST2INIT wrapper Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 18/66] net-next/hinic: fix a problem in hinic_xmit_frame() Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 19/66] net: skb_segment() should not return NULL Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 20/66] tcp: fix dctcp delayed ACK schedule Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 21/66] tcp: helpers to send special DCTCP ack Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 22/66] tcp: do not cancel delay-AcK on DCTCP special ACK Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 23/66] tcp: do not delay ACK in DCTCP upon CE status change Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 24/66] net/mlx5: E-Switch, UBSAN fix undefined behavior in mlx5_eswitch_mode Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 25/66] r8169: restore previous behavior to accept BIOS WoL settings Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 26/66] tls: check RCV_SHUTDOWN in tls_wait_data Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 27/66] net/mlx5e: Add ingress/egress indication for offloaded TC flows Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 28/66] net/mlx5e: Only allow offloading decap egress (egdev) flows Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 29/66] net/mlx5e: Refine ets validation function Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 30/66] nfp: flower: ensure dead neighbour entries are not offloaded Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 31/66] sock: fix sg page frag coalescing in sk_alloc_sg Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 32/66] net: phy: consider PHY_IGNORE_INTERRUPT in phy_start_aneg_priv Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 33/66] multicast: do not restore deleted record source filter mode to new one Greg Kroah-Hartman
2018-07-27  9:45 ` Greg Kroah-Hartman [this message]
2018-07-27  9:45 ` [PATCH 4.17 35/66] net/mlx5e: Dont allow aRFS for encapsulated packets Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 36/66] net/mlx5e: Fix quota counting in aRFS expire flow Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 37/66] net/mlx5: Adjust clock overflow work period Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 38/66] rtnetlink: add rtnl_link_state check in rtnl_configure_link Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 39/66] vxlan: add new fdb alloc and create helpers Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 40/66] vxlan: make netlink notify in vxlan_fdb_destroy optional Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 41/66] vxlan: fix default fdb entry netlink notify ordering during netdev create Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 42/66] tcp: free batches of packets in tcp_prune_ofo_queue() Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 43/66] tcp: avoid collapses in tcp_prune_queue() if possible Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 44/66] tcp: detect malicious patterns in tcp_collapse_ofo_queue() Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 45/66] tcp: call tcp_drop() from tcp_data_queue_ofo() Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 46/66] tcp: add tcp_ooo_try_coalesce() helper Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 47/66] Revert "staging:r8188eu: Use lib80211 to support TKIP" Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 48/66] staging: speakup: fix wraparound in uaccess length check Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 49/66] usb: cdc_acm: Add quirk for Castles VEGA3000 Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 50/66] usb: core: handle hub C_PORT_OVER_CURRENT condition Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 52/66] usb: xhci: Fix memory leak in xhci_endpoint_reset() Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 53/66] usb: gadget: Fix OS descriptors support Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 54/66] usb: gadget: f_fs: Only return delayed status when len is 0 Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 55/66] ACPICA: AML Parser: ignore dispatcher error status during table load Greg Kroah-Hartman
2018-07-30  9:52   ` Rafael J. Wysocki
2018-07-30 11:44     ` Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 56/66] driver core: Partially revert "driver core: correct devices shutdown order" Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 57/66] can: xilinx_can: fix RX loop if RXNEMP is asserted without RXOK Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 58/66] can: xilinx_can: fix power management handling Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 59/66] can: xilinx_can: fix recovery from error states not being propagated Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 60/66] can: xilinx_can: fix device dropping off bus on RX overrun Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 61/66] can: xilinx_can: keep only 1-2 frames in TX FIFO to fix TX accounting Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 62/66] can: xilinx_can: fix incorrect clear of non-processed interrupts Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 63/66] can: xilinx_can: fix RX overflow interrupt not being enabled Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 64/66] can: peak_canfd: fix firmware < v3.3.0: limit allocation to 32-bit DMA addr only Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 65/66] can: m_can: Fix runtime resume call Greg Kroah-Hartman
2018-07-27  9:45 ` [PATCH 4.17 66/66] can: m_can.c: fix setup of CCCR register: clear CCCR NISO bit before checking can.ctrlmode Greg Kroah-Hartman
2018-07-27 17:31 ` [PATCH 4.17 00/66] 4.17.11-stable review Guenter Roeck
2018-07-28  5:41   ` Greg Kroah-Hartman
2018-07-27 19:49 ` Shuah Khan
2018-07-28  5:41   ` Greg Kroah-Hartman
2018-07-28  6:54 ` Naresh Kamboju
2018-07-28  7:20   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180727093812.960566568@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).