Fix compilation with nftables

Fixes #324
This commit is contained in:
Pali Rohár 2018-09-06 17:44:41 +02:00
parent ab4559a432
commit a2baa36312
2 changed files with 23 additions and 0 deletions

View File

@ -204,6 +204,26 @@ add_peer_dscp_rule2(const char * ifname,
return 0; 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 * Clear all rules corresponding eport/proto
*/ */

View File

@ -36,6 +36,9 @@ add_filter_rule2(const char * ifname,
int int
delete_redirect_and_filter_rules(unsigned short eport, int proto); delete_redirect_and_filter_rules(unsigned short eport, int proto);
int
delete_filter_rule(const char * ifname, unsigned short port, int proto);
int int
add_peer_dscp_rule2(const char * ifname, add_peer_dscp_rule2(const char * ifname,
const char * rhost, unsigned short rport, const char * rhost, unsigned short rport,