Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Packetdrill_tarr_ext
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
Stefan Gense
Packetdrill_tarr_ext
Commits
db779624
Commit
db779624
authored
8 years ago
by
Aomx
Browse files
Options
Downloads
Patches
Plain Diff
adjustments to run_packet.c
parent
bce0cb16
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gtests/net/packetdrill/run_packet.c
+63
-0
63 additions, 0 deletions
gtests/net/packetdrill/run_packet.c
with
63 additions
and
0 deletions
gtests/net/packetdrill/run_packet.c
+
63
−
0
View file @
db779624
...
...
@@ -653,6 +653,8 @@ static int map_inbound_sctp_packet(
struct
sctp_shutdown_complete_chunk
*
shutdown_complete
;
struct
sctp_i_data_chunk
*
i_data
;
struct
sctp_reconfig_chunk
*
reconfig
;
struct
sctp_forward_tsn_chunk
*
forward_tsn
;
u32
local_diff
,
remote_diff
;
u32
v_tag
;
u16
nr_gap_blocks
,
nr_dup_tsns
,
i
;
...
...
@@ -738,6 +740,10 @@ static int map_inbound_sctp_packet(
i_data
=
(
struct
sctp_i_data_chunk
*
)
chunk
;
i_data
->
tsn
=
htonl
(
ntohl
(
i_data
->
tsn
)
+
remote_diff
);
break
;
case
SCTP_FORWARD_TSN_CHUNK_TYPE
:
forward_tsn
=
(
struct
sctp_forward_tsn_chunk
*
)
chunk
;
forward_tsn
->
cum_tsn
=
htonl
(
ntohl
(
forward_tsn
->
cum_tsn
)
+
local_diff
);
break
;
case
SCTP_RECONFIG_CHUNK_TYPE
:
reconfig
=
(
struct
sctp_reconfig_chunk
*
)
chunk
;
if
(
htons
(
reconfig
->
length
)
>=
sizeof
(
struct
sctp_reconfig_chunk
)
+
4
)
{
...
...
@@ -948,6 +954,7 @@ static int map_outbound_live_sctp_packet(
struct
sctp_cwr_chunk
*
cwr
;
struct
sctp_i_data_chunk
*
i_data
;
struct
sctp_reconfig_chunk
*
reconfig
;
struct
sctp_forward_tsn_chunk
*
forward_tsn
;
u32
local_diff
,
remote_diff
;
u16
nr_gap_blocks
,
nr_dup_tsns
,
i
;
...
...
@@ -1008,6 +1015,10 @@ static int map_outbound_live_sctp_packet(
i_data
=
(
struct
sctp_i_data_chunk
*
)
chunk
;
i_data
->
tsn
=
htonl
(
ntohl
(
i_data
->
tsn
)
+
local_diff
);
break
;
case
SCTP_FORWARD_TSN_CHUNK_TYPE
:
forward_tsn
=
(
struct
sctp_forward_tsn_chunk
*
)
chunk
;
forward_tsn
->
cum_tsn
=
htonl
(
ntohl
(
forward_tsn
->
cum_tsn
)
+
local_diff
);
break
;
case
SCTP_RECONFIG_CHUNK_TYPE
:
reconfig
=
(
struct
sctp_reconfig_chunk
*
)
chunk
;
if
(
reconfig
->
length
>
sizeof
(
struct
sctp_reconfig_chunk
))
{
...
...
@@ -2034,6 +2045,53 @@ static int verify_reconfig_chunk(struct sctp_reconfig_chunk *actual_chunk,
error
);
}
static
u16
get_num_sid_blocks
(
u16
packet_length
)
{
return
(
packet_length
-
sizeof
(
struct
sctp_forward_tsn_chunk
))
/
sizeof
(
struct
sctp_stream_identifier_block
);
}
static
int
verify_forward_tsn_chunk
(
struct
sctp_forward_tsn_chunk
*
actual_chunk
,
struct
sctp_forward_tsn_chunk
*
script_chunk
,
u32
flags
,
char
**
error
)
{
u16
actual_packet_length
=
ntohs
(
script_chunk
->
length
);
u16
script_packet_length
=
ntohs
(
script_chunk
->
length
);
u16
actual_nr_sid_blocks
=
get_num_sid_blocks
(
actual_packet_length
);
u16
script_nr_sid_blocks
=
get_num_sid_blocks
(
script_packet_length
);
u16
i
;
if
((
flags
&
FLAG_FORWARD_TSN_CHUNK_CUM_TSN_NOCHECK
)
==
0
)
{
if
(
check_field
(
"sctp_forward_tsn_cum_tsn"
,
ntohl
(
script_chunk
->
cum_tsn
),
ntohl
(
actual_chunk
->
cum_tsn
),
error
)
==
STATUS_ERR
)
{
return
STATUS_ERR
;
}
}
if
((
flags
&
FLAG_FORWARD_TSN_CHUNK_SIDS_NOCHECK
)
==
0
)
{
if
(
check_field
(
"nr_sid_blocks"
,
actual_nr_sid_blocks
,
script_nr_sid_blocks
,
error
)
==
STATUS_ERR
)
{
return
STATUS_ERR
;
}
for
(
i
=
0
;
i
<
script_nr_sid_blocks
;
i
++
)
{
if
(
check_field
(
"sctp_forward_tsn_stream_identifier"
,
ntohs
(
script_chunk
->
stream_identifier_blocks
[
i
].
stream
),
ntohs
(
actual_chunk
->
stream_identifier_blocks
[
i
].
stream
),
error
)
==
STATUS_ERR
||
check_field
(
"sctp_forward_tsn_stream_sequence_number"
,
ntohs
(
script_chunk
->
stream_identifier_blocks
[
i
].
stream_sequence
),
ntohs
(
actual_chunk
->
stream_identifier_blocks
[
i
].
stream_sequence
),
error
)
==
STATUS_ERR
)
{
return
STATUS_ERR
;
}
}
}
return
STATUS_OK
;
}
/* Verify that required actual SCTP packet fields are as the script expected. */
static
int
verify_sctp
(
const
struct
packet
*
actual_packet
,
...
...
@@ -2179,6 +2237,11 @@ static int verify_sctp(
script_chunk_item
,
flags
,
error
);
break
;
case
SCTP_FORWARD_TSN_CHUNK_TYPE
:
result
=
verify_forward_tsn_chunk
((
struct
sctp_forward_tsn_chunk
*
)
actual_chunk
,
(
struct
sctp_forward_tsn_chunk
*
)
script_chunk
,
flags
,
error
);
break
;
default:
result
=
STATUS_ERR
;
assert
(
!
"unsupported SCTP chunk type"
);
...
...
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