From patchwork Fri Oct 11 06:33:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Raj Manickam X-Patchwork-Id: 282532 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 AEAFD2C010C for ; Fri, 11 Oct 2013 17:33:35 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752570Ab3JKGdd (ORCPT ); Fri, 11 Oct 2013 02:33:33 -0400 Received: from mail-qa0-f54.google.com ([209.85.216.54]:58651 "EHLO mail-qa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751762Ab3JKGdd (ORCPT ); Fri, 11 Oct 2013 02:33:33 -0400 Received: by mail-qa0-f54.google.com with SMTP id j15so389347qaq.20 for ; Thu, 10 Oct 2013 23:33:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=clK1sCkdbnyQ1LQnHrwUUwpnCf+oDyfQV+IqrVCP+ks=; b=Msbuux18QN9Di/Z0oCeeAehdw2KWmcdI+hBeHePSoyRAl1OBDHHZ72j/HG95OfwCDn wt/C/XSgujIMHxawGhjGVGO7yvm5LUzjc0lQPPMRCMARhLTSfltrtqOeS1dzpcs4EOBH Uu2O1ger7JzeEPYgsVaha+i3M6INAKq2lOAvz6g2FGXTGWW0y26hVdCtwJ3aX4IKMdtz 6yNrZzOX88zHVhYj/dlrsNm0XLf0U2SzWroPphTLu1wbz32VMkU1L018M+BkVZyyxKwN SUj5ci2Ee1coILiemfgjSjqS4KMuZ8mRfRjTsaBtA92veENLIb+qjar4Je2ys4zahKiV uU9g== MIME-Version: 1.0 X-Received: by 10.224.25.8 with SMTP id x8mr1568564qab.77.1381473212472; Thu, 10 Oct 2013 23:33:32 -0700 (PDT) Received: by 10.140.25.98 with HTTP; Thu, 10 Oct 2013 23:33:32 -0700 (PDT) Date: Fri, 11 Oct 2013 12:03:32 +0530 Message-ID: Subject: [PATCH] iptables-nftables nft: Removes if_nametoindex , NFT_META_IIF, iniface From: Anand Raj Manickam To: Pablo Neira Ayuso , netfilter-devel@vger.kernel.org, Tomasz Bursztyka Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org This patch takes care of in interfaces . void add_addr(struct nft_rule *r, int offset, @@ -251,15 +242,14 @@ void parse_meta(struct nft_rule_expr *e, uint8_t key, char *iniface, *invflags |= IPT_INV_VIA_IN; memcpy(iniface, ifname, len); - iniface[len] = '\0'; - /* If zero, then this is an interface mask */ - if (if_nametoindex(iniface) == 0) { - iniface[len] = '+'; - iniface[len+1] = '\0'; + if (iniface[len-1] == '+') { + iniface[len] = '\0'; + memset(iniface_mask, 0xff, (len - 1)); + } else { + iniface[len + 1] = '\0'; + memset(iniface_mask, 0xff, (len + 1)); } - - memset(iniface_mask, 0xff, len); break; --- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/iptables/nft-shared.c b/iptables/nft-shared.c index 25cb177..49a9890 100644 --- a/iptables/nft-shared.c +++ b/iptables/nft-shared.c @@ -124,13 +124,8 @@ void add_iniface(struct nft_rule *r, char *iface, int invflags) else op = NFT_CMP_EQ; - if (iface[iface_len - 1] == '+') { - add_meta(r, NFT_META_IIFNAME); - add_cmp_ptr(r, op, iface, iface_len - 1); - } else { - add_meta(r, NFT_META_IIF); - add_cmp_u32(r, if_nametoindex(iface), op); - } + add_meta(r, NFT_META_IIFNAME); + add_cmp_ptr(r, op, iface, iface_len); }