Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bio-rd
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
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
danet
bio-rd
Commits
79d4324f
Commit
79d4324f
authored
5 years ago
by
Marcus Weiner
Browse files
Options
Downloads
Patches
Plain Diff
Test Database description with LSAs
parent
d1c2ee56
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Packet/ospfv3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
protocols/ospf/packetv3/packet_test.go
+162
-0
162 additions, 0 deletions
protocols/ospf/packetv3/packet_test.go
with
162 additions
and
0 deletions
protocols/ospf/packetv3/packet_test.go
+
162
−
0
View file @
79d4324f
...
@@ -365,6 +365,168 @@ func TestDecodeDBDesc(t *testing.T) {
...
@@ -365,6 +365,168 @@ func TestDecodeDBDesc(t *testing.T) {
},
},
},
},
},
},
{
name
:
"WithLSAs"
,
input
:
[]
byte
{
// Header
0x03
,
// Version
0x02
,
// Type: Database Description
0x00
,
0xbc
,
// Length
0x01
,
0x01
,
0x01
,
0x01
,
// Router ID
0x00
,
0x00
,
0x00
,
0x00
,
// Area ID
0xb6
,
0xd0
,
// Checksum
0x00
,
// Instance ID
0x00
,
// Reserved
// Payload
0x00
,
// Reserved
0x00
,
0x00
,
0x13
,
// Options
0x05
,
0xdc
,
// Link MTU
0x00
,
// Reserved
0x02
,
// Flags
0x00
,
0x00
,
0x0b
,
0xbd
,
// Seq Num
// LSA Header
0x00
,
0x1d
,
0x20
,
0x01
,
// Type: Router-LSA
0x00
,
0x00
,
0x00
,
0x00
,
// LS ID
0x01
,
0x01
,
0x01
,
0x01
,
// Router ID
0x80
,
0x00
,
0x00
,
0x12
,
// Seq Num
0xb1
,
0x4a
,
// Checksum
0x00
,
0x18
,
// Length
// LSA Header
0x01
,
0xb4
,
0x20
,
0x01
,
// Type: Router-LSA
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0x02
,
0x02
,
0x02
,
0x80
,
0x00
,
0x00
,
0x0f
,
0x02
,
0x8e
,
0x00
,
0x28
,
// LSA Header: Network-LSA
0x01
,
0xdc
,
0x20
,
0x02
,
0x00
,
0x00
,
0x00
,
0x06
,
0x03
,
0x03
,
0x03
,
0x03
,
0x80
,
0x00
,
0x00
,
0x02
,
0x6d
,
0x6c
,
0x00
,
0x24
,
// LSA-Header: Inter-Area-Prefix-LSA
0x00
,
0x1e
,
0x20
,
0x03
,
0x00
,
0x00
,
0x00
,
0x05
,
0x01
,
0x01
,
0x01
,
0x01
,
0x80
,
0x00
,
0x00
,
0x01
,
0xdb
,
0x0f
,
0x00
,
0x24
,
// LSA-Header: Inter-Area-Prefix-LSA
0x03
,
0x2a
,
0x20
,
0x03
,
0x00
,
0x00
,
0x00
,
0x04
,
0x02
,
0x02
,
0x02
,
0x02
,
0x80
,
0x00
,
0x00
,
0x01
,
0xc7
,
0x20
,
0x00
,
0x24
,
// LSA-Header: Link-LSA
0x00
,
0x1d
,
0x00
,
0x08
,
0x00
,
0x00
,
0x00
,
0x06
,
0x01
,
0x01
,
0x01
,
0x01
,
0x80
,
0x00
,
0x00
,
0x01
,
0x86
,
0xd0
,
0x00
,
0x38
,
// LSA-Header: Intra-Area-Prefix-LSA
0x00
,
0x1d
,
0x20
,
0x09
,
0x00
,
0x00
,
0x00
,
0x00
,
0x01
,
0x01
,
0x01
,
0x01
,
0x80
,
0x00
,
0x00
,
0x01
,
0x74
,
0x18
,
0x00
,
0x34
,
// LSA-Header: Unknown type
0x00
,
0x1d
,
0x20
,
0x22
,
// Type: Unknown
0x00
,
0x00
,
0x00
,
0x00
,
0x01
,
0x01
,
0x01
,
0x01
,
0x80
,
0x00
,
0x00
,
0x01
,
0x74
,
0x18
,
0x00
,
0x34
,
},
expected
:
&
ospf
.
OSPFv3Message
{
Version
:
3
,
Type
:
ospf
.
MsgTypeDatabaseDescription
,
Checksum
:
0xb6d0
,
PacketLength
:
188
,
RouterID
:
routerID
(
1
,
1
,
1
,
1
),
AreaID
:
0
,
InstanceID
:
0
,
Body
:
&
ospf
.
DatabaseDescription
{
Options
:
ospf
.
OptionsFromFlags
(
ospf
.
RouterOptR
,
ospf
.
RouterOptE
,
ospf
.
RouterOptV6
),
InterfaceMTU
:
1500
,
DBFlags
:
ospf
.
DBFlagMore
,
DDSequenceNumber
:
3005
,
LSAHeaders
:
[]
*
ospf
.
LSA
{
{
Type
:
ospf
.
LSATypeRouter
,
Age
:
29
,
ID
:
0
,
AdvertisingRouter
:
routerID
(
1
,
1
,
1
,
1
),
SequenceNumber
:
0x80000012
,
Checksum
:
0xb14a
,
Length
:
0x18
,
},
{
Type
:
ospf
.
LSATypeRouter
,
Age
:
436
,
ID
:
0
,
AdvertisingRouter
:
routerID
(
2
,
2
,
2
,
2
),
SequenceNumber
:
0x8000000f
,
Checksum
:
0x028e
,
Length
:
0x28
,
},
{
Type
:
ospf
.
LSATypeNetwork
,
Age
:
476
,
ID
:
6
,
AdvertisingRouter
:
routerID
(
3
,
3
,
3
,
3
),
SequenceNumber
:
0x80000002
,
Checksum
:
0x6d6c
,
Length
:
0x24
,
},
{
Type
:
ospf
.
LSATypeInterAreaPrefix
,
Age
:
30
,
ID
:
5
,
AdvertisingRouter
:
routerID
(
1
,
1
,
1
,
1
),
SequenceNumber
:
0x80000001
,
Checksum
:
0xdb0f
,
Length
:
0x24
,
},
{
Type
:
ospf
.
LSATypeInterAreaPrefix
,
Age
:
0x032a
,
ID
:
4
,
AdvertisingRouter
:
routerID
(
2
,
2
,
2
,
2
),
SequenceNumber
:
0x80000001
,
Checksum
:
0xc720
,
Length
:
0x24
,
},
{
Type
:
ospf
.
LSATypeLink
,
Age
:
0x001d
,
ID
:
6
,
AdvertisingRouter
:
routerID
(
1
,
1
,
1
,
1
),
SequenceNumber
:
0x80000001
,
Checksum
:
0x86d0
,
Length
:
0x38
,
},
{
Type
:
ospf
.
LSATypeIntraAreaPrefix
,
Age
:
0x001d
,
ID
:
0
,
AdvertisingRouter
:
routerID
(
1
,
1
,
1
,
1
),
SequenceNumber
:
0x80000001
,
Checksum
:
0x7418
,
Length
:
0x34
,
},
{
Type
:
0x2022
,
// Unknown
Age
:
0x001d
,
ID
:
0
,
AdvertisingRouter
:
routerID
(
1
,
1
,
1
,
1
),
SequenceNumber
:
0x80000001
,
Checksum
:
0x7418
,
Length
:
0x34
,
},
},
},
},
},
}
}
src
,
err
:=
net
.
IPFromString
(
"fe80::3"
)
src
,
err
:=
net
.
IPFromString
(
"fe80::3"
)
...
...
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