Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934412AbdCJWuE (ORCPT ); Fri, 10 Mar 2017 17:50:04 -0500 Received: from chaos.universe-factory.net ([37.72.148.22]:41916 "EHLO chaos.universe-factory.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933059AbdCJWtg (ORCPT ); Fri, 10 Mar 2017 17:49:36 -0500 From: Matthias Schiffer To: davem@davemloft.net, jbenc@redhat.com, hannes@stressinduktion.org, pshelar@ovn.org, aduyck@mirantis.com, roopa@cumulusnetworks.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/3] vxlan: don't allow link-local IPv6 local/remote addresses without interface Date: Fri, 10 Mar 2017 23:39:42 +0100 Message-Id: <58db316c71cf5257ef5da86763c511f8c5938987.1489184335.git.mschiffer@universe-factory.net> X-Mailer: git-send-email 2.12.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 997 Lines: 30 Signed-off-by: Matthias Schiffer --- drivers/net/vxlan.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index e375560cc74e..cc0ace73d02e 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -2922,6 +2922,18 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, pr_info("multicast destination requires interface to be specified\n"); return -EINVAL; } +#if IS_ENABLED(CONFIG_IPV6) + else if (!conf->remote_ifindex && + ((conf->saddr.sa.sa_family == AF_INET6 && + (ipv6_addr_type(&conf->saddr.sin6.sin6_addr) & + IPV6_ADDR_LINKLOCAL)) || + (dst->remote_ip.sa.sa_family == AF_INET6 && + (ipv6_addr_type(&dst->remote_ip.sin6.sin6_addr) & + IPV6_ADDR_LINKLOCAL)))) { + pr_info("link-local local/remote addresses require interface to be specified\n"); + return -EINVAL; + } +#endif if (conf->mtu) { int max_mtu = ETH_MAX_MTU; -- 2.12.0