netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests: shell: fetch rule handle with '-a' option and then delete
@ 2018-01-23 23:17 Harsha Sharma
  2018-01-23 23:28 ` Dmitry V. Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Harsha Sharma @ 2018-01-23 23:17 UTC (permalink / raw)
  To: pablo, harshasharmaiitr; +Cc: netfilter-devel

Fetch rule handle and then delete rule via that rule handle.

Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
 tests/shell/testcases/cache/0001_cache_handling_0 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/shell/testcases/cache/0001_cache_handling_0 b/tests/shell/testcases/cache/0001_cache_handling_0
index 9a73769..2bcb8c5 100755
--- a/tests/shell/testcases/cache/0001_cache_handling_0
+++ b/tests/shell/testcases/cache/0001_cache_handling_0
@@ -24,6 +24,7 @@ table inet test {
 set -e
 
 $NFT -f $tmpfile
-$NFT delete rule inet test test handle 2
+rule_handle=$($NFT list ruleset -a | grep "saddr" | awk '{print $NF}')
+$NFT delete rule inet test test handle $rule_handle
 $NFT delete set inet test test
 $NFT -f $tmpfile
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tests: shell: fetch rule handle with '-a' option and then delete
  2018-01-23 23:17 [PATCH] tests: shell: fetch rule handle with '-a' option and then delete Harsha Sharma
@ 2018-01-23 23:28 ` Dmitry V. Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry V. Levin @ 2018-01-23 23:28 UTC (permalink / raw)
  To: Harsha Sharma; +Cc: pablo, netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 992 bytes --]

On Wed, Jan 24, 2018 at 04:47:39AM +0530, Harsha Sharma wrote:
> Fetch rule handle and then delete rule via that rule handle.
> 
> Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
> ---
>  tests/shell/testcases/cache/0001_cache_handling_0 | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/shell/testcases/cache/0001_cache_handling_0 b/tests/shell/testcases/cache/0001_cache_handling_0
> index 9a73769..2bcb8c5 100755
> --- a/tests/shell/testcases/cache/0001_cache_handling_0
> +++ b/tests/shell/testcases/cache/0001_cache_handling_0
> @@ -24,6 +24,7 @@ table inet test {
>  set -e
>  
>  $NFT -f $tmpfile
> -$NFT delete rule inet test test handle 2
> +rule_handle=$($NFT list ruleset -a | grep "saddr" | awk '{print $NF}')
> +$NFT delete rule inet test test handle $rule_handle

No need to use both grep and awk in the same pipeline.

If you prefer awk, then
  awk '/saddr/ {print $NF}'
would do the same thing.


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-23 23:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-23 23:17 [PATCH] tests: shell: fetch rule handle with '-a' option and then delete Harsha Sharma
2018-01-23 23:28 ` Dmitry V. Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).