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
36840b90
Commit
36840b90
authored
6 years ago
by
Michael Tüxen
Browse files
Options
Downloads
Patches
Plain Diff
Add print support for HMAC_ALGO parameter.
parent
5fec2a7a
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
gtests/net/packetdrill/sctp.h
+9
-0
9 additions, 0 deletions
gtests/net/packetdrill/sctp.h
gtests/net/packetdrill/sctp_chunk_to_string.c
+43
-0
43 additions, 0 deletions
gtests/net/packetdrill/sctp_chunk_to_string.c
with
52 additions
and
0 deletions
gtests/net/packetdrill/sctp.h
+
9
−
0
View file @
36840b90
...
...
@@ -445,6 +445,15 @@ struct sctp_chunks_parameter {
__u8
chunk_type
[];
}
__packed
;
#define SCTP_HMAC_ID_SHA_1 1
#define SCTP_HMAC_ID_SHA_256 3
struct
sctp_hmac_algo_parameter
{
__be16
type
;
__be16
length
;
__be16
hmac_id
[];
}
__packed
;
struct
sctp_supported_extensions_parameter
{
__be16
type
;
__be16
length
;
...
...
This diff is collapsed.
Click to expand it.
gtests/net/packetdrill/sctp_chunk_to_string.c
+
43
−
0
View file @
36840b90
...
...
@@ -511,6 +511,44 @@ static int sctp_chunks_parameter_to_string(
return
STATUS_OK
;
}
static
int
sctp_hmac_algo_parameter_to_string
(
FILE
*
s
,
struct
sctp_hmac_algo_parameter
*
parameter
,
char
**
error
)
{
u16
i
,
length
,
nr_hmac_algos
;
length
=
ntohs
(
parameter
->
length
);
if
((
length
<
sizeof
(
struct
sctp_hmac_algo_parameter
))
||
((
length
&
0x0001
)
!=
0
))
{
asprintf
(
error
,
"HMAC_ALGO parameter illegal (length=%u)"
,
length
);
return
STATUS_ERR
;
}
nr_hmac_algos
=
(
length
-
sizeof
(
struct
sctp_hmac_algo_parameter
))
/
sizeof
(
u16
);
fputs
(
"HMAC_ALGO[types=["
,
s
);
for
(
i
=
0
;
i
<
nr_hmac_algos
;
i
++
)
{
if
(
i
>
0
)
fputs
(
", "
,
s
);
switch
(
ntohs
(
parameter
->
hmac_id
[
i
]))
{
case
SCTP_HMAC_ID_SHA_1
:
fputs
(
"SHA-1"
,
s
);
break
;
case
SCTP_HMAC_ID_SHA_256
:
fputs
(
"SHA-256"
,
s
);
break
;
default:
fprintf
(
s
,
"0x%04x"
,
ntohs
(
parameter
->
hmac_id
[
i
]));
break
;
}
}
fputs
(
"]]"
,
s
);
return
STATUS_OK
;
}
static
int
sctp_supported_extensions_parameter_to_string
(
FILE
*
s
,
struct
sctp_supported_extensions_parameter
*
parameter
,
...
...
@@ -765,6 +803,11 @@ static int sctp_parameter_to_string(FILE *s,
(
struct
sctp_chunks_parameter
*
)
parameter
,
error
);
break
;
case
SCTP_HMAC_ALGO_PARAMETER_TYPE
:
result
=
sctp_hmac_algo_parameter_to_string
(
s
,
(
struct
sctp_hmac_algo_parameter
*
)
parameter
,
error
);
break
;
case
SCTP_SUPPORTED_EXTENSIONS_PARAMETER_TYPE
:
result
=
sctp_supported_extensions_parameter_to_string
(
s
,
(
struct
sctp_supported_extensions_parameter
*
)
parameter
,
...
...
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