Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scapy
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
public-release-test-restored
platform
external
scapy
Commits
b7a4e40b
Commit
b7a4e40b
authored
9 years ago
by
Pierre LALET
Browse files
Options
Downloads
Patches
Plain Diff
LLTD: add UT for Large TLVs
parent
f2b083f0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
scapy/layers/lltd.py
+1
-0
1 addition, 0 deletions
scapy/layers/lltd.py
test/regression.uts
+30
-0
30 additions, 0 deletions
test/regression.uts
with
31 additions
and
0 deletions
scapy/layers/lltd.py
+
1
−
0
View file @
b7a4e40b
...
...
@@ -17,6 +17,7 @@ from scapy.fields import BitField, FlagsField, ByteField, ByteEnumField, \
LongField
,
MultiEnumField
,
FieldLenField
,
FieldListField
,
\
PacketListField
,
StrLenField
,
StrLenFieldUtf16
,
ConditionalField
,
MACField
from
scapy.packet
import
Packet
,
Padding
,
bind_layers
from
scapy.plist
import
PacketList
from
scapy.layers.l2
import
Ether
from
scapy.layers.inet
import
IPField
from
scapy.layers.inet6
import
IP6Field
...
...
This diff is collapsed.
Click to expand it.
test/regression.uts
+
30
−
0
View file @
b7a4e40b
...
...
@@ -4436,6 +4436,36 @@ assert pkt.src == pkt.real_src
assert pkt.tos == 0
assert pkt.function == 0
= Large TLV
m1, m2, seq = RandMAC()._fix(), RandMAC()._fix(), 123
preqbase = Ether(src=m1, dst=m2) / LLTD() / \
LLTDQueryLargeTlv(type="Detailed Icon Image")
prespbase = Ether(src=m2, dst=m1) / LLTD() / \
LLTDQueryLargeTlvResp()
plist = []
pkt = preqbase.copy()
pkt.seq = seq
plist.append(Ether(str(pkt)))
pkt = prespbase.copy()
pkt.seq = seq
pkt.flags = "M"
pkt.value = "abcd"
plist.append(Ether(str(pkt)))
pkt = preqbase.copy()
pkt.seq = seq + 1
pkt.offset = 4
plist.append(Ether(str(pkt)))
pkt = prespbase.copy()
pkt.seq = seq + 1
pkt.value = "efg"
plist.append(Ether(str(pkt)))
builder = LargeTlvBuilder()
builder.parse(plist)
data = builder.get_data()
assert len(data) == 1
assert data.keys()[0].endswith(' [Detailed Icon Image]')
assert data.values()[0] == 'abcdefg'
############
############
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment