Patchwork iptables-nftables nft: Removes if_nametoindex ,NFT_META_IIF, iniface

login
register
mail settings
Submitter Anand Raj Manickam
Date Oct. 11, 2013, 6:33 a.m.
Message ID <CAEyr1FQSk84f57Z=ep_DE_hJGee0vR9PqTGThjOkkH-=fE5ZCQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/282532/
State Superseded
Headers show

Comments

Anand Raj Manickam - Oct. 11, 2013, 6:33 a.m.
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

Patch

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);
 }