summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/chains/0016delete_handle_0
blob: 4633d771c619ef1a36cdcc0e01f5d2bb742a16f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

set -e
$NFT add table test-ip
$NFT add chain test-ip x
$NFT add chain test-ip y
$NFT add chain test-ip z
$NFT add table ip6 test-ip6
$NFT add chain ip6 test-ip6 x
$NFT add chain ip6 test-ip6 y
$NFT add chain ip6 test-ip6 z

chain_y_handle=$($NFT list ruleset -a | awk -v n=1 '/chain y/ && !--n {print $NF; exit}');
chain_z_handle=$($NFT list ruleset -a | awk -v n=2 '/chain z/ && !--n {print $NF; exit}');

$NFT delete chain test-ip handle $chain_y_handle
$NFT delete chain ip6 test-ip6 handle $chain_z_handle