summaryrefslogtreecommitdiffstats
path: root/tests/py/any/rawpayload.t.payload
blob: a2cc663568e0bfdf7bb82f7c0cbdc6ddcd917474 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# meta l4proto { tcp, udp, sctp} @th,16,16 { 22, 23, 80 }
__set%d test-inet 3 size 3
__set%d test-inet 0
	element 00000006  : 0 [end]	element 00000011  : 0 [end]	element 00000084  : 0 [end]
__set%d test-inet 3 size 3
__set%d test-inet 0
	element 00001600  : 0 [end]	element 00001700  : 0 [end]	element 00005000  : 0 [end]
inet test-inet input 
  [ meta load l4proto => reg 1 ]
  [ lookup reg 1 set __set%d ]
  [ payload load 2b @ transport header + 2 => reg 1 ]
  [ lookup reg 1 set __set%d ]

# meta l4proto tcp @th,16,16 { 22, 23, 80}
__set%d test-inet 3 size 3
__set%d test-inet 0
	element 00001600  : 0 [end]	element 00001700  : 0 [end]	element 00005000  : 0 [end]
inet test-inet input 
  [ meta load l4proto => reg 1 ]
  [ cmp eq reg 1 0x00000006 ]
  [ payload load 2b @ transport header + 2 => reg 1 ]
  [ lookup reg 1 set __set%d ]

# @nh,8,8 255
inet test-inet input
  [ payload load 1b @ network header + 1 => reg 1 ]
  [ cmp eq reg 1 0x000000ff ]

# @nh,8,16 0
inet test-inet input
  [ payload load 2b @ network header + 1 => reg 1 ]
  [ cmp eq reg 1 0x00000000 ]

# @ll,0,1 1
inet test-inet input
  [ payload load 1b @ link header + 0 => reg 1 ]
  [ bitwise reg 1 = (reg=1 & 0x00000080 ) ^ 0x00000000 ]
  [ cmp eq reg 1 0x00000080 ]

# @ll,0,8 and 0x80 eq 0x80
inet test-inet input
  [ payload load 1b @ link header + 0 => reg 1 ]
  [ bitwise reg 1 = (reg=1 & 0x00000080 ) ^ 0x00000000 ]
  [ cmp eq reg 1 0x00000080 ]

# @ll,0,128 0xfedcba987654321001234567890abcde
inet test-inet input
  [ payload load 16b @ link header + 0 => reg 1 ]
  [ cmp eq reg 1 0x98badcfe 0x10325476 0x67452301 0xdebc0a89 ]