]> git.proxmox.com Git - mirror_iproute2.git/blob - testsuite/tests/ss/ssfilter.t
Merge branch 'iproute2-master' into iproute2-next
[mirror_iproute2.git] / testsuite / tests / ss / ssfilter.t
1 #!/bin/sh
2
3 . lib/generic.sh
4
5 # % ./misc/ss -Htna
6 # LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
7 # ESTAB 0 0 10.0.0.1:22 10.0.0.1:36266
8 # ESTAB 0 0 10.0.0.1:36266 10.0.0.1:22
9 # ESTAB 0 0 10.0.0.1:22 10.0.0.2:50312
10 export TCPDIAG_FILE="$(dirname $0)/ss1.dump"
11
12 ts_log "[Testing ssfilter]"
13
14 ts_ss "$0" "Match dport = 22" -Htna dport = 22
15 test_on "ESTAB 0 0 10.0.0.1:36266 10.0.0.1:22"
16
17 ts_ss "$0" "Match dport 22" -Htna dport 22
18 test_on "ESTAB 0 0 10.0.0.1:36266 10.0.0.1:22"
19
20 ts_ss "$0" "Match (dport)" -Htna '( dport = 22 )'
21 test_on "ESTAB 0 0 10.0.0.1:36266 10.0.0.1:22"
22
23 ts_ss "$0" "Match src = 0.0.0.0" -Htna src = 0.0.0.0
24 test_on "LISTEN 0 128 0.0.0.0:22 0.0.0.0:*"
25
26 ts_ss "$0" "Match src 0.0.0.0" -Htna src 0.0.0.0
27 test_on "LISTEN 0 128 0.0.0.0:22 0.0.0.0:*"
28
29 ts_ss "$0" "Match src sport" -Htna src 0.0.0.0 sport = 22
30 test_on "LISTEN 0 128 0.0.0.0:22 0.0.0.0:*"
31
32 ts_ss "$0" "Match src and sport" -Htna src 0.0.0.0 and sport = 22
33 test_on "LISTEN 0 128 0.0.0.0:22 0.0.0.0:*"
34
35 ts_ss "$0" "Match src and sport and dport" -Htna src 10.0.0.1 and sport = 22 and dport = 50312
36 test_on "ESTAB 0 0 10.0.0.1:22 10.0.0.2:50312"
37
38 ts_ss "$0" "Match src and sport and (dport)" -Htna 'src 10.0.0.1 and sport = 22 and ( dport = 50312 )'
39 test_on "ESTAB 0 0 10.0.0.1:22 10.0.0.2:50312"
40
41 ts_ss "$0" "Match src and (sport and dport)" -Htna 'src 10.0.0.1 and ( sport = 22 and dport = 50312 )'
42 test_on "ESTAB 0 0 10.0.0.1:22 10.0.0.2:50312"
43
44 ts_ss "$0" "Match (src and sport) and dport" -Htna '( src 10.0.0.1 and sport = 22 ) and dport = 50312'
45 test_on "ESTAB 0 0 10.0.0.1:22 10.0.0.2:50312"
46
47 ts_ss "$0" "Match (src or src) and dst" -Htna '( src 0.0.0.0 or src 10.0.0.1 ) and dst 10.0.0.2'
48 test_on "ESTAB 0 0 10.0.0.1:22 10.0.0.2:50312"