]>
Commit | Line | Data |
---|---|---|
d67eb4fb PS |
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 | |
6d1af9ab | 15 | test_on "ESTAB 0 0 10.0.0.1:36266 10.0.0.1:22" |
d67eb4fb PS |
16 | |
17 | ts_ss "$0" "Match dport 22" -Htna dport 22 | |
6d1af9ab | 18 | test_on "ESTAB 0 0 10.0.0.1:36266 10.0.0.1:22" |
d67eb4fb PS |
19 | |
20 | ts_ss "$0" "Match (dport)" -Htna '( dport = 22 )' | |
6d1af9ab | 21 | test_on "ESTAB 0 0 10.0.0.1:36266 10.0.0.1:22" |
d67eb4fb PS |
22 | |
23 | ts_ss "$0" "Match src = 0.0.0.0" -Htna src = 0.0.0.0 | |
6d1af9ab | 24 | test_on "LISTEN 0 128 0.0.0.0:22 0.0.0.0:*" |
d67eb4fb PS |
25 | |
26 | ts_ss "$0" "Match src 0.0.0.0" -Htna src 0.0.0.0 | |
6d1af9ab | 27 | test_on "LISTEN 0 128 0.0.0.0:22 0.0.0.0:*" |
d67eb4fb PS |
28 | |
29 | ts_ss "$0" "Match src sport" -Htna src 0.0.0.0 sport = 22 | |
6d1af9ab | 30 | test_on "LISTEN 0 128 0.0.0.0:22 0.0.0.0:*" |
d67eb4fb PS |
31 | |
32 | ts_ss "$0" "Match src and sport" -Htna src 0.0.0.0 and sport = 22 | |
6d1af9ab | 33 | test_on "LISTEN 0 128 0.0.0.0:22 0.0.0.0:*" |
d67eb4fb PS |
34 | |
35 | ts_ss "$0" "Match src and sport and dport" -Htna src 10.0.0.1 and sport = 22 and dport = 50312 | |
6d1af9ab | 36 | test_on "ESTAB 0 0 10.0.0.1:22 10.0.0.2:50312" |
d67eb4fb PS |
37 | |
38 | ts_ss "$0" "Match src and sport and (dport)" -Htna 'src 10.0.0.1 and sport = 22 and ( dport = 50312 )' | |
6d1af9ab | 39 | test_on "ESTAB 0 0 10.0.0.1:22 10.0.0.2:50312" |
d67eb4fb PS |
40 | |
41 | ts_ss "$0" "Match src and (sport and dport)" -Htna 'src 10.0.0.1 and ( sport = 22 and dport = 50312 )' | |
6d1af9ab | 42 | test_on "ESTAB 0 0 10.0.0.1:22 10.0.0.2:50312" |
d67eb4fb PS |
43 | |
44 | ts_ss "$0" "Match (src and sport) and dport" -Htna '( src 10.0.0.1 and sport = 22 ) and dport = 50312' | |
6d1af9ab | 45 | test_on "ESTAB 0 0 10.0.0.1:22 10.0.0.2:50312" |
d67eb4fb PS |
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' | |
6d1af9ab | 48 | test_on "ESTAB 0 0 10.0.0.1:22 10.0.0.2:50312" |