From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26F10C43381 for ; Fri, 22 Feb 2019 09:51:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E6EFC2081B for ; Fri, 22 Feb 2019 09:51:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b="VIoUWB+x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726267AbfBVJvV (ORCPT ); Fri, 22 Feb 2019 04:51:21 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55791 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725889AbfBVJvV (ORCPT ); Fri, 22 Feb 2019 04:51:21 -0500 Received: by mail-wm1-f65.google.com with SMTP id q187so1358805wme.5 for ; Fri, 22 Feb 2019 01:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YMSWdlsYEp8Y0VKaAf+S6MzHZi1JHU6u4keXZxw9W38=; b=VIoUWB+xp/xIbsiJXHPR703XGYWWjPTlUSzMIRcmlEYFqpuDVFOZM2vBVrJBoi8Gma NCq4OY6DV5R+OiGso5bSfbLLgRLGeCsHJwP3KnvMRwCg+lhkszNtMvoae1ByytA8K8Te T0rQh+Eeclqov66huE32SL8VkjW/44fOlW2cQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YMSWdlsYEp8Y0VKaAf+S6MzHZi1JHU6u4keXZxw9W38=; b=YnjT50BEJfaagXdG63ZAEsitez2HOsjZdQ0CUKgXwfGzz2cYnLvHYeeTKzfCDc25e1 D66UXlUt/4w2Crow9PO18Zc/Hm91q0jjXjgcUYPT+TwJST2EQIth0yiVwL1PoLhGIB8+ lcG9W3n+l82mrwt/xeKa0cUncLjwQoWOYYzzWg4xfQdNeLx1KJq2k579NZQnSydCQ04d pK1a6FrLexT4MfayL8Loiz2Fb77PIplf2Lsip3Izpls7gepoIHPxC7BZ7fy/rP6eyC4g wstQXzKdLk18Uua/Jgo/seBWY9KCQfkqTIt2qpU6WiTzskEmXnDdsPHEun0yJM+asGl7 83Ww== X-Gm-Message-State: AHQUAublKwUYvusP205vewuNGGvtBi6Avk6A5e+gJJ07gNbh+9aUwJD3 eDY5CNx78E7Uqpn1XHevg8tr0Q== X-Google-Smtp-Source: AHgI3IbAfbaUU+WyMBiZwEWCJzDDEDqEWVMWEypqgjYyZNVP1n+oAspEhE/t9vUAbxHxl6FadH70Sg== X-Received: by 2002:a1c:41c5:: with SMTP id o188mr1846982wma.147.1550829079214; Fri, 22 Feb 2019 01:51:19 -0800 (PST) Received: from localhost.localdomain (9.6.e.f.2.f.3.d.e.1.8.a.3.e.5.2.0.0.0.0.3.c.c.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:cc3:0:25e3:a81e:d3f2:fe69]) by smtp.gmail.com with ESMTPSA id f68sm2680492wmg.5.2019.02.22.01.51.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 01:51:18 -0800 (PST) From: Lorenz Bauer To: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org Cc: linux-api@vger.kernel.org, Lorenz Bauer Subject: [PATCH 0/3] Allow checking SYN cookies from XDP and tc cls act Date: Fri, 22 Feb 2019 09:50:54 +0000 Message-Id: <20190222095057.9442-1-lmb@cloudflare.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This series adds a helper bpf_sk_check_syncookie, which allows checking whether a packet is a valid SYN cookie for a given socket. This is useful for implementing load-balancing approaches like glb-director [1] or Beamer [2] in pure eBPF. Specifically, we'd like to replace the functionality of the glb-redirect kernel module by an XDP program or tc classifier. 1: https://github.com/github/glb-director 2: https://www.usenix.org/conference/nsdi18/presentation/olteanu Lorenz Bauer (3): bpf: add helper to check for a valid SYN cookie tools: sync changes to uapi/linux/bpf.h selftests/bpf: add tests for bpf_sk_check_syncookie include/uapi/linux/bpf.h | 18 +- net/core/filter.c | 68 ++++++ tools/include/uapi/linux/bpf.h | 18 +- tools/testing/selftests/bpf/.gitignore | 1 + tools/testing/selftests/bpf/Makefile | 5 +- tools/testing/selftests/bpf/bpf_helpers.h | 3 + .../bpf/progs/test_sk_syncookie_kern.c | 119 ++++++++++ .../selftests/bpf/test_sk_syncookie.sh | 81 +++++++ .../selftests/bpf/test_sk_syncookie_user.c | 212 ++++++++++++++++++ 9 files changed, 521 insertions(+), 4 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/test_sk_syncookie_kern.c create mode 100755 tools/testing/selftests/bpf/test_sk_syncookie.sh create mode 100644 tools/testing/selftests/bpf/test_sk_syncookie_user.c -- 2.19.1