From patchwork Fri Jan 25 02:33:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Leitner X-Patchwork-Id: 1030788 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43m34S4nNjz9s7T for ; Fri, 25 Jan 2019 13:34:00 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728832AbfAYCd7 (ORCPT ); Thu, 24 Jan 2019 21:33:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37046 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728808AbfAYCdy (ORCPT ); Thu, 24 Jan 2019 21:33:54 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F97554381; Fri, 25 Jan 2019 02:33:53 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-7.gru2.redhat.com [10.97.116.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 990315D739; Fri, 25 Jan 2019 02:33:47 +0000 (UTC) Received: by localhost.localdomain (Postfix, from userid 1000) id 2B2FB180CF6; Fri, 25 Jan 2019 00:33:46 -0200 (-02) From: Marcelo Ricardo Leitner To: Guy Shattah , Marcelo Leitner , Aaron Conole , John Hurley , Simon Horman , Justin Pettit , Gregory Rose , Eelco Chaudron , Flavio Leitner , Florian Westphal , Jiri Pirko , Rashid Khan , Sushil Kulkarni , Andy Gospodarek , Roi Dayan , Yossi Kuperman , Or Gerlitz , Rony Efraim , "davem@davemloft.net" Cc: netdev@vger.kernel.org Subject: [RFC PATCH iproute2 2/5] act_ct: first import Date: Fri, 25 Jan 2019 00:33:30 -0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 25 Jan 2019 02:33:53 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Marcelo Ricardo Leitner --- include/uapi/linux/tc_act/tc_ct.h | 30 +++ tc/Makefile | 1 + tc/m_ct.c | 314 ++++++++++++++++++++++++++++++ 3 files changed, 345 insertions(+) create mode 100644 include/uapi/linux/tc_act/tc_ct.h create mode 100644 tc/m_ct.c diff --git a/include/uapi/linux/tc_act/tc_ct.h b/include/uapi/linux/tc_act/tc_ct.h new file mode 100644 index 0000000000000000000000000000000000000000..d08a5afdc4b453c5388ad2ae63a00fd3b48457f0 --- /dev/null +++ b/include/uapi/linux/tc_act/tc_ct.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __LINUX_TC_CT_H +#define __LINUX_TC_CT_H + +#include +#include + +#define TCA_ACT_CT 27 + +enum { + TCA_CT_UNSPEC, + TCA_CT_TM, + TCA_CT_PARMS, + TCA_CT_PAD, + TCA_CT_ZONE, + TCA_CT_MARK, + TCA_CT_MARK_MASK, + TCA_CT_LABEL, + TCA_CT_LABEL_MASK, + TCA_CT_CHAIN, + TCA_CT_FLAGS, + __TCA_CT_MAX +}; +#define TCA_CT_MAX (__TCA_CT_MAX - 1) + +struct tc_ct { + tc_gen; +}; + +#endif diff --git a/tc/Makefile b/tc/Makefile index 2edaf2c8836475c78e713e789a05203e1c598327..79e10a1a5493bbc9703b47660aa145f98e533aea 100644 --- a/tc/Makefile +++ b/tc/Makefile @@ -51,6 +51,7 @@ TCMODULES += m_connmark.o TCMODULES += m_bpf.o TCMODULES += m_tunnel_key.o TCMODULES += m_sample.o +TCMODULES += m_ct.o TCMODULES += p_ip.o TCMODULES += p_ip6.o TCMODULES += p_icmp.o diff --git a/tc/m_ct.c b/tc/m_ct.c new file mode 100644 index 0000000000000000000000000000000000000000..e20837ba4f9c49d1603b14721cabca1fbeca0c74 --- /dev/null +++ b/tc/m_ct.c @@ -0,0 +1,314 @@ +/* + * m_ct.c Connection Tracking target module + * + * This program is free software; you can distribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Authors: Marcelo Ricardo Leitner + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "utils.h" +#include "tc_util.h" +#include "tc_common.h" +#include + +static void +explain(void) +{ + fprintf(stderr, + "Usage: ct [mark ] [zone ] [label