diff --git a/miniupnpd/netfilter_nft/nftnlrdr.c b/miniupnpd/netfilter_nft/nftnlrdr.c index 5392f9e..2b3bebe 100644 --- a/miniupnpd/netfilter_nft/nftnlrdr.c +++ b/miniupnpd/netfilter_nft/nftnlrdr.c @@ -204,6 +204,26 @@ add_peer_dscp_rule2(const char * ifname, return 0; } +int +delete_filter_rule(const char * ifname, unsigned short port, int proto) +{ + rule_t *p; + struct nftnl_rule *r; + UNUSED(ifname); + + reflesh_nft_cache(NFPROTO_IPV4); + LIST_FOREACH(p, &head, entry) { + if (p->eport == port && p->proto == proto && p->type == RULE_FILTER) { + r = rule_del_handle(p); + /* Todo: send bulk request */ + nft_send_request(r, NFT_MSG_DELRULE); + break; + } + } + + return 0; +} + /* * Clear all rules corresponding eport/proto */ diff --git a/miniupnpd/netfilter_nft/nftnlrdr.h b/miniupnpd/netfilter_nft/nftnlrdr.h index 1acf4b3..b9e547f 100644 --- a/miniupnpd/netfilter_nft/nftnlrdr.h +++ b/miniupnpd/netfilter_nft/nftnlrdr.h @@ -36,6 +36,9 @@ add_filter_rule2(const char * ifname, int delete_redirect_and_filter_rules(unsigned short eport, int proto); +int +delete_filter_rule(const char * ifname, unsigned short port, int proto); + int add_peer_dscp_rule2(const char * ifname, const char * rhost, unsigned short rport,