#!/bin/sh
#
# Undo the things nft_init.sh did
#
# Do not disturb other existing structures in nftables, e.g. those created by firewalld
#

. "$(dirname "$0")/miniupnpd_functions.sh"

if $NFT --check list table inet $TABLE >/dev/null 2>&1; then
	echo "removeall: removing nftable $TABLE"
	$NFT delete table inet $TABLE
fi

if [ "$NAT_TABLE" != "$TABLE" ]; then
	if $NFT --check list table inet $NAT_TABLE >/dev/null 2>&1; then
		echo "removeall: removing nftable $NAT_TABLE"
		$NFT delete table inet $NAT_TABLE
	fi
fi
