From patchwork Mon Jan 26 15:27:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuseppe Longo X-Patchwork-Id: 432853 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 5E079140145 for ; Tue, 27 Jan 2015 02:27:41 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755964AbbAZP1k (ORCPT ); Mon, 26 Jan 2015 10:27:40 -0500 Received: from mail-we0-f170.google.com ([74.125.82.170]:34339 "EHLO mail-we0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755960AbbAZP1j (ORCPT ); Mon, 26 Jan 2015 10:27:39 -0500 Received: by mail-we0-f170.google.com with SMTP id w55so4261881wes.1 for ; Mon, 26 Jan 2015 07:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=vPj9MmiXvwtae0/hcGZ/E4neY1k6xoSx3WrLysigW7k=; b=0Z8hWFLVj3IxuIKc2Gfrtk81S2guA7b6/hTCMor+j8nt7bZw28k1r9FDDhZtd+Dlvb 1akURhKsAElUzrnhdHNt/hKQO4TIjqde5ss+tl3dbq5eP1/Hy7yi1bxfH3Iv5lhaTCbw g6A4dDuA6kkjmkehcr5JdVLTSB+xQC9wSzvWruvFv48vO+bbfnm+tMGrpDAVdOSbeciX IWAkk4bewcFqzSrun/RtZlPp1OPG23FVBoq9cbDRZgn0CtYUW2E0u6G5PsdJvuvnAXtH vnxaBWmLrz0qX4Y1f4ghVMIOGLsE8Y83H/8EvZXylh2zyi8xX85qJOcbc+7lcrayDo9m fyAQ== X-Received: by 10.180.8.169 with SMTP id s9mr25424928wia.72.1422286058744; Mon, 26 Jan 2015 07:27:38 -0800 (PST) Received: from localhost.localdomain (adsl-ull-205-3.45-151.net24.it. [151.45.3.205]) by mx.google.com with ESMTPSA id mz10sm6559760wic.9.2015.01.26.07.27.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Jan 2015 07:27:37 -0800 (PST) From: Giuseppe Longo To: netfilter-devel@vger.kernel.org Cc: Giuseppe Longo Subject: [nft_compat PATCH v3] nft_compat: adds support for ebtables match/target Date: Mon, 26 Jan 2015 16:27:21 +0100 Message-Id: <1422286041-5660-1-git-send-email-giuseppelng@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org This extends nft_compat to support ebtables matches/targets. Signed-off-by: Giuseppe Longo Tested-by: Arturo Borrero Gonzalez --- net/netfilter/nft_compat.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 265e190..b0635c4 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c @@ -19,6 +19,7 @@ #include #include #include +#include #include static int nft_compat_chain_validate_dependency(const char *tablename, @@ -40,6 +41,7 @@ static int nft_compat_chain_validate_dependency(const char *tablename, union nft_entry { struct ipt_entry e4; struct ip6t_entry e6; + struct ebt_entry ebt; }; static inline void @@ -100,6 +102,10 @@ nft_target_set_tgchk_param(struct xt_tgchk_param *par, entry->e6.ipv6.proto = proto; entry->e6.ipv6.invflags = inv ? IP6T_INV_PROTO : 0; break; + case NFPROTO_BRIDGE: + entry->ebt.ethproto = proto; + entry->ebt.invflags = inv ? EBT_IPROTO : 0; + break; } par->entryinfo = entry; par->target = target; @@ -307,6 +313,10 @@ nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx, entry->e6.ipv6.proto = proto; entry->e6.ipv6.invflags = inv ? IP6T_INV_PROTO : 0; break; + case NFPROTO_BRIDGE: + entry->ebt.ethproto = proto; + entry->ebt.invflags = inv ? EBT_IPROTO : 0; + break; } par->entryinfo = entry; par->match = match; @@ -490,6 +500,9 @@ nfnl_compat_get(struct sock *nfnl, struct sk_buff *skb, case AF_INET6: fmt = "ip6t_%s"; break; + case NFPROTO_BRIDGE: + fmt = "ebt_%s"; + break; default: pr_err("nft_compat: unsupported protocol %d\n", nfmsg->nfgen_family);