diff options
Diffstat (limited to 'iptables/xtables-translate.c')
-rw-r--r-- | iptables/xtables-translate.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c index 9044d27c..3c577ed2 100644 --- a/iptables/xtables-translate.c +++ b/iptables/xtables-translate.c @@ -34,6 +34,23 @@ #include "xshared.h" #include "nft-shared.h" +void xlate_ifname(struct xt_xlate *xl, const char *nftmeta, const char *ifname, + bool invert) +{ + char iface[IFNAMSIZ]; + int ifaclen; + + if (ifname[0] == '\0') + return; + + strcpy(iface, ifname); + ifaclen = strlen(iface); + if (iface[ifaclen - 1] == '+') + iface[ifaclen - 1] = '*'; + + xt_xlate_add(xl, "%s %s%s ", nftmeta, invert ? "!= " : "", iface); +} + int xlate_action(const struct iptables_command_state *cs, bool goto_set, struct xt_xlate *xl) { |