summaryrefslogtreecommitdiffstats
path: root/tests/py/any/rawpayload.t.payload
blob: fe2377e65a7712f488cac3e017c2a037e510d8f4 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# 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 0xff
inet test-inet input
  [ payload load 1b @ network header + 1 => reg 1 ]
  [ cmp eq reg 1 0x000000ff ]

# @nh,8,16 0x0
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 & 0x80 == 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 ]

# meta l4proto 91 @th,400,16 0x0 accept
inet test-inet input
  [ meta load l4proto => reg 1 ]
  [ cmp eq reg 1 0x0000005b ]
  [ payload load 2b @ transport header + 50 => reg 1 ]
  [ cmp eq reg 1 0x00000000 ]
  [ immediate reg 0 accept ]

# @ih,32,32 0x14000000
inet test-inet input
  [ payload load 4b @ inner header + 4 => reg 1 ]
  [ cmp eq reg 1 0x00000014 ]