diff --git a/miniupnpd/netfilter_nft/nftnlrdr_misc.c b/miniupnpd/netfilter_nft/nftnlrdr_misc.c index 373a30e..654f19d 100644 --- a/miniupnpd/netfilter_nft/nftnlrdr_misc.c +++ b/miniupnpd/netfilter_nft/nftnlrdr_misc.c @@ -569,31 +569,37 @@ table_cb(const struct nlmsghdr *nlh, void *data) return result; } -void +int refresh_nft_cache_filter(void) { if (rule_list_filter_validate != RULE_CACHE_VALID) { - refresh_nft_cache(&head_filter, nft_table, nft_forward_chain, NFPROTO_INET); + if (refresh_nft_cache(&head_filter, nft_table, nft_forward_chain, NFPROTO_INET) < 0) + return -1; rule_list_filter_validate = RULE_CACHE_VALID; } + return 0; } -void +int refresh_nft_cache_peer(void) { if (rule_list_peer_validate != RULE_CACHE_VALID) { - refresh_nft_cache(&head_peer, nft_table, nft_postrouting_chain, NFPROTO_IPV4); + if (refresh_nft_cache(&head_peer, nft_table, nft_postrouting_chain, NFPROTO_IPV4) < 0) + return -1; rule_list_peer_validate = RULE_CACHE_VALID; } + return 0; } -void +int refresh_nft_cache_redirect(void) { if (rule_list_redirect_validate != RULE_CACHE_VALID) { - refresh_nft_cache(&head_redirect, nft_table, nft_prerouting_chain, NFPROTO_IPV4); + if (refresh_nft_cache(&head_redirect, nft_table, nft_prerouting_chain, NFPROTO_IPV4) < 0) + return -1; rule_list_redirect_validate = RULE_CACHE_VALID; } + return 0; } void diff --git a/miniupnpd/netfilter_nft/nftnlrdr_misc.h b/miniupnpd/netfilter_nft/nftnlrdr_misc.h index dbb168f..b00a127 100644 --- a/miniupnpd/netfilter_nft/nftnlrdr_misc.h +++ b/miniupnpd/netfilter_nft/nftnlrdr_misc.h @@ -134,10 +134,10 @@ rule_set_filter_common(struct nftnl_rule *r, uint8_t family, const char * ifname uint8_t proto, unsigned short eport, unsigned short iport, unsigned short rport, const char *descr, const char *handle); struct nftnl_rule *rule_del_handle(rule_t *r); -void refresh_nft_cache_filter(void); -void refresh_nft_cache_redirect(void); -void refresh_nft_cache_peer(void); -void refresh_nft_cache(struct rule_list *head, const char *table, const char *chain, uint32_t family); +int refresh_nft_cache_filter(void); +int refresh_nft_cache_redirect(void); +int refresh_nft_cache_peer(void); +int refresh_nft_cache(struct rule_list *head, const char *table, const char *chain, uint32_t family); int table_op(enum nf_tables_msg_types op, uint16_t family, const char * name);