Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2454168imd; Fri, 2 Nov 2018 11:40:43 -0700 (PDT) X-Google-Smtp-Source: AJdET5e77/kjnr0kdp3AKpAGGZo/6LlBVIaALFHKzGCzjZCeeh0HNPu8HMkRNFfii41jWnhX1IaC X-Received: by 2002:a17:902:4624:: with SMTP id o33-v6mr12873674pld.285.1541184043602; Fri, 02 Nov 2018 11:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184043; cv=none; d=google.com; s=arc-20160816; b=W05WcLXfUpdZPv+WzofRxhH7a+nKlSbA3AW0kylECpo4mMi1c+7k5IyxbuoRKlQAAx CxrmGrkDUknD8NQB4PKB8Ik3SF0r+EE6SbCcpYmyilaOXqZBKibxRxjJ0KlLqb33bP6m N21ojnE/FW08zQ776HVQzJS3x4e4zLliW9kIeoyc6+uN11Zsm7nSFxkFhq4/Ke7x+uuG 9Uzn7Pf5LWVZSZ6M1xRnCZuDyKwEaz9ZbSPuBG86lbJQRqWjRItNrfjl7tsioJszKnqh KPDDu6d8rFMyrNjyGCwPWx63kwY1R7auN8CPxQct8Vy7e8rXgXCU7RI4Nz1JKvXOwHLq oqZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3PG031a7VOw62jPcPgzb7NW8ticQlAYv4KGOXsTqwNM=; b=ZT+bbyzKBniNUJUMA2d2RJkj/LXFbDl2KVavoQKEdDMU68WF5X0c4zx9H7zqEhaHO2 2nt6n2W/C3Ho3PUp9eyumZvtaLfsotwWPAqcqeKaloq2lYY09SwJp9blJYjkBW8JDdC8 vhdYf82IT4YnUEyR78BZSMU729B99NL+uRyYL3A7n4sKAMXURY3cpg0htJCKjrvSiiX7 D+BSuBfV2axb7jy0E/pNBP3K5VgNYqkL3YGID8QskbCxMREF0kwvF4Ik/IwPkQjhDNZ0 pGoMR2A19/qxQsH5ZKRgMP40R2QFSr5Hus5EJINtIgrPswOMpQr3JVYjK40wqhL51NPV abPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="m2Bm/IFC"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11-v6si36244631pla.408.2018.11.02.11.40.29; Fri, 02 Nov 2018 11:40:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="m2Bm/IFC"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729148AbeKCDrm (ORCPT + 99 others); Fri, 2 Nov 2018 23:47:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:41792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728102AbeKCDrl (ORCPT ); Fri, 2 Nov 2018 23:47:41 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 87E862082E; Fri, 2 Nov 2018 18:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541183969; bh=PKRUdq8gpYOPtSMRn9BUjF42MHDYFRiQKlQRh2ERDBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m2Bm/IFCfK2tG5bx/uUFkj06t4n0KmLPDr8VzKTqtXoYL1bPiu8+5zYylVys5CJBD vaxz7iwWtuqoXwqMg4GPCwrFIESoe2is+594cx1UjnfAVUaxXApRMGaCWEF4pC1jKl bbkHIZrvRplKAIjBPkRoreueZaciz4saxZcdk7a4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Sasha Levin Subject: [PATCH 4.18 038/150] rxrpc: Fix transport sockopts to get IPv4 errors on an IPv6 socket Date: Fri, 2 Nov 2018 19:33:20 +0100 Message-Id: <20181102182905.990300511@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 37a675e768d7606fe8a53e0c459c9b53e121ac20 ] It seems that enabling IPV6_RECVERR on an IPv6 socket doesn't also turn on IP_RECVERR, so neither local errors nor ICMP-transported remote errors from IPv4 peer addresses are returned to the AF_RXRPC protocol. Make the sockopt setting code in rxrpc_open_socket() fall through from the AF_INET6 case to the AF_INET case to turn on all the AF_INET options too in the AF_INET6 case. Fixes: f2aeed3a591f ("rxrpc: Fix error reception on AF_INET6 sockets") Signed-off-by: David Howells Signed-off-by: Sasha Levin --- net/rxrpc/local_object.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c index 5d89ea5c1976..386dc1f20c73 100644 --- a/net/rxrpc/local_object.c +++ b/net/rxrpc/local_object.c @@ -135,10 +135,10 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) } switch (local->srx.transport.family) { - case AF_INET: - /* we want to receive ICMP errors */ + case AF_INET6: + /* we want to receive ICMPv6 errors */ opt = 1; - ret = kernel_setsockopt(local->socket, SOL_IP, IP_RECVERR, + ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_RECVERR, (char *) &opt, sizeof(opt)); if (ret < 0) { _debug("setsockopt failed"); @@ -146,19 +146,22 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) } /* we want to set the don't fragment bit */ - opt = IP_PMTUDISC_DO; - ret = kernel_setsockopt(local->socket, SOL_IP, IP_MTU_DISCOVER, + opt = IPV6_PMTUDISC_DO; + ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER, (char *) &opt, sizeof(opt)); if (ret < 0) { _debug("setsockopt failed"); goto error; } - break; - case AF_INET6: + /* Fall through and set IPv4 options too otherwise we don't get + * errors from IPv4 packets sent through the IPv6 socket. + */ + + case AF_INET: /* we want to receive ICMP errors */ opt = 1; - ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_RECVERR, + ret = kernel_setsockopt(local->socket, SOL_IP, IP_RECVERR, (char *) &opt, sizeof(opt)); if (ret < 0) { _debug("setsockopt failed"); @@ -166,8 +169,8 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net) } /* we want to set the don't fragment bit */ - opt = IPV6_PMTUDISC_DO; - ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER, + opt = IP_PMTUDISC_DO; + ret = kernel_setsockopt(local->socket, SOL_IP, IP_MTU_DISCOVER, (char *) &opt, sizeof(opt)); if (ret < 0) { _debug("setsockopt failed"); -- 2.17.1