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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88EFBC433F5 for ; Mon, 25 Apr 2022 16:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243673AbiDYRBp (ORCPT ); Mon, 25 Apr 2022 13:01:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237367AbiDYRBp (ORCPT ); Mon, 25 Apr 2022 13:01:45 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9058238DBB for ; Mon, 25 Apr 2022 09:58:40 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6400,9594,10328"; a="245870523" X-IronPort-AV: E=Sophos;i="5.90,289,1643702400"; d="scan'208";a="245870523" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2022 09:58:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,289,1643702400"; d="scan'208";a="532207917" Received: from silpixa00396680.ir.intel.com (HELO silpixa00396680.ger.corp.intel.com) ([10.237.223.54]) by orsmga006.jf.intel.com with ESMTP; 25 Apr 2022 09:58:30 -0700 From: Ray Kinsella To: netdev@vger.kernel.org Cc: daniel@iogearbox.net, stephen@networkplumber.org, Ray Kinsella Subject: [PATCH 1/1] tc-bpf: added instructions to build cbpf generator Date: Mon, 25 Apr 2022 17:57:33 +0100 Message-Id: <20220425165733.240902-2-mdr@ashroe.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220425165733.240902-1-mdr@ashroe.eu> References: <20220425165733.240902-1-mdr@ashroe.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Updated the man page for tc-bpf, detailing how to build to the cbpf generator and using it in the subsequent example. Signed-off-by: Ray Kinsella --- man/man8/tc-bpf.8 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/man/man8/tc-bpf.8 b/man/man8/tc-bpf.8 index e4f68aaa..1d3ab633 100644 --- a/man/man8/tc-bpf.8 +++ b/man/man8/tc-bpf.8 @@ -892,13 +892,21 @@ int main(int argc, char **argv) .fi .in +Build this helper by compiling the source above, and linking with +.B libpcap +as follows: + +.in +4n +.B clang -g -O2 cbpf-gen.c -lpcap -o cbpf-gen +.in + Given this small helper, any .B tcpdump(8) filter expression can be abused as a classifier where a match will result in the default classid: .in +4n -.B bpftool EN10MB 'tcp[tcpflags] & tcp-syn != 0' > /var/bpf/tcp-syn +.B cbpf-gen 'tcp[tcpflags] & tcp-syn != 0' > /var/bpf/tcp-syn .br .B tc filter add dev em1 parent 1: bpf bytecode-file /var/bpf/tcp-syn flowid 1:1 .in -- 2.26.2