From patchwork Tue Apr 23 22:39:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 13640806 X-Patchwork-Delegate: kuba@kernel.org Received: from mail.netfilter.org (mail.netfilter.org [217.70.188.207]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33C622C1AE for ; Tue, 23 Apr 2024 22:39:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.188.207 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713911978; cv=none; b=hwhauQB2QEnN8NO5gdSeezAGEsxLzaAgMBXi8ZD2AoTP1bXB7eDaFG1WQbxYY1+L9Jb437xDseIRhD/QysGPrRt3ByKf0n1kOBJY8t8NoXxRftWW+TJypjLivw0ppNXagM16y/o+M7D5NxEAqaCpCpqIDT96eIxCKw9bFmCI4qQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713911978; c=relaxed/simple; bh=kRYHVesnCL6lusCF3yKfyW24XGjQesdZBz7sCIpDA9s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=h60gcoaHV7tDervpzQu3PyXPZx1JH6gMEniwBlGRZZB28CmApSEpr295JGDLF7avkn/7OMgAlVSIHPwd2pCj9ysz4gusH8oGGysLzs4NIKuSXoecmfdO4UunxRHx3SuIhDYXiuEey6Nieum9MrqKLgmdSYSYQUKRHY6ESgNUPKw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=netfilter.org; spf=pass smtp.mailfrom=netfilter.org; arc=none smtp.client-ip=217.70.188.207 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=netfilter.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netfilter.org From: Pablo Neira Ayuso To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, laforge@osmocom.org, pespin@sysmocom.de, osmith@sysmocom.de Subject: [PATCH net-next 06/12] gtp: pass up link local traffic to userspace socket Date: Wed, 24 Apr 2024 00:39:13 +0200 Message-Id: <20240423223919.3385493-7-pablo@netfilter.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240423223919.3385493-1-pablo@netfilter.org> References: <20240423223919.3385493-1-pablo@netfilter.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org According to TS 29.061, it is possible to see IPv6 link-local traffic in the GTP tunnel, see 11.2.1.3.2 IPv6 Stateless Address Autoconfiguration (IPv6 SLAAC). Pass up these packets to the userspace daemon to handle them as control GTP traffic. Signed-off-by: Pablo Neira Ayuso --- drivers/net/gtp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index 2fde4f2268c5..2afcf1887592 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c @@ -250,6 +250,10 @@ static bool gtp_check_ms_ipv6(struct sk_buff *skb, struct pdp_ctx *pctx, ip6h = (struct ipv6hdr *)(skb->data + hdrlen); + if ((ipv6_addr_type(&ip6h->saddr) & IPV6_ADDR_LINKLOCAL) || + (ipv6_addr_type(&ip6h->daddr) & IPV6_ADDR_LINKLOCAL)) + return false; + if (role == GTP_ROLE_SGSN) { ret = ipv6_pdp_addr_equal(&ip6h->daddr, &pctx->ms.addr6); } else {