File: erspan.uts

package info (click to toggle)
scapy 2.6.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,956 kB
  • sloc: python: 163,618; sh: 90; makefile: 11
file content (44 lines) | stat: -rw-r--r-- 1,129 bytes parent folder | download | duplicates (2)
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
% ERSPAN

+ ERSPAN I
= Build & dissect ERSPAN 1

pkt = GRE()/ERSPAN_I()/Ether()
pkt = GRE(bytes(pkt))
assert ERSPAN in pkt
assert pkt.proto == 0x88be
assert pkt.seqnum_present == 0

+ ERSPAN II
= Build ERSPAN II

pkt = GRE()/ERSPAN_II()/Ether(src="11:11:11:11:11:11", dst="ff:ff:ff:ff:ff:ff")
b = bytes(pkt)
assert b == b'\x10\x00\x88\xbe\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\x11\x11\x11\x11\x11\x11\x90\x00'

= Dissect ERSPAN II

pkt = GRE(b)
assert pkt[GRE].proto == 0x88be
assert pkt[GRE].seqnum_present == 1
assert pkt[GRE][ERSPAN].ver == 1
assert pkt[Ether].src == "11:11:11:11:11:11"

+ ERSPAN III
= Build & dissect ERSPAN III with platform specific

pkt = GRE()/ERSPAN_III()/ERSPAN_PlatformSpecific()/Ether()
pkt = GRE(bytes(pkt))
assert pkt[GRE].proto == 0x22eb
assert pkt[ERSPAN_III].o == 1
assert ERSPAN_PlatformSpecific in pkt
assert Ether in pkt

= Build & dissect ERSPAN III without platform specific
pkt = GRE()/ERSPAN_III()/Ether()
pkt = GRE(bytes(pkt))
assert pkt[GRE].proto == 0x22eb
assert pkt[ERSPAN_III].o == 0
assert ERSPAN_PlatformSpecific not in pkt
assert Ether in pkt