Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
cm-projects
RIOT
Commits
36617f37
Commit
36617f37
authored
6 years ago
by
Martine Lenders
Browse files
Options
Downloads
Patches
Plain Diff
gnrc_icmpv6_error: make input pointers constant
parent
6ec456b0
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
sys/include/net/gnrc/icmpv6/error.h
+6
-4
6 additions, 4 deletions
sys/include/net/gnrc/icmpv6/error.h
sys/net/gnrc/network_layer/icmpv6/error/gnrc_icmpv6_error.c
+13
-10
13 additions, 10 deletions
sys/net/gnrc/network_layer/icmpv6/error/gnrc_icmpv6_error.c
with
19 additions
and
14 deletions
sys/include/net/gnrc/icmpv6/error.h
+
6
−
4
View file @
36617f37
...
@@ -39,7 +39,7 @@ extern "C" {
...
@@ -39,7 +39,7 @@ extern "C" {
* @param[in] code The code for the message @see net/icmpv6.h.
* @param[in] code The code for the message @see net/icmpv6.h.
* @param[in] orig_pkt The invoking packet.
* @param[in] orig_pkt The invoking packet.
*/
*/
void
gnrc_icmpv6_error_dst_unr_send
(
uint8_t
code
,
gnrc_pktsnip_t
*
orig_pkt
);
void
gnrc_icmpv6_error_dst_unr_send
(
uint8_t
code
,
const
gnrc_pktsnip_t
*
orig_pkt
);
/**
/**
* @brief Sends an ICMPv6 packet too big message for sending.
* @brief Sends an ICMPv6 packet too big message for sending.
...
@@ -47,7 +47,8 @@ void gnrc_icmpv6_error_dst_unr_send(uint8_t code, gnrc_pktsnip_t *orig_pkt);
...
@@ -47,7 +47,8 @@ void gnrc_icmpv6_error_dst_unr_send(uint8_t code, gnrc_pktsnip_t *orig_pkt);
* @param[in] mtu The maximum transission unit of the next-hop link.
* @param[in] mtu The maximum transission unit of the next-hop link.
* @param[in] orig_pkt The invoking packet.
* @param[in] orig_pkt The invoking packet.
*/
*/
void
gnrc_icmpv6_error_pkt_too_big_send
(
uint32_t
mtu
,
gnrc_pktsnip_t
*
orig_pkt
);
void
gnrc_icmpv6_error_pkt_too_big_send
(
uint32_t
mtu
,
const
gnrc_pktsnip_t
*
orig_pkt
);
/**
/**
* @brief Sends an ICMPv6 time exceeded message for sending.
* @brief Sends an ICMPv6 time exceeded message for sending.
...
@@ -55,7 +56,8 @@ void gnrc_icmpv6_error_pkt_too_big_send(uint32_t mtu, gnrc_pktsnip_t *orig_pkt);
...
@@ -55,7 +56,8 @@ void gnrc_icmpv6_error_pkt_too_big_send(uint32_t mtu, gnrc_pktsnip_t *orig_pkt);
* @param[in] code The code for the message @see net/icmpv6.h.
* @param[in] code The code for the message @see net/icmpv6.h.
* @param[in] orig_pkt The invoking packet.
* @param[in] orig_pkt The invoking packet.
*/
*/
void
gnrc_icmpv6_error_time_exc_send
(
uint8_t
code
,
gnrc_pktsnip_t
*
orig_pkt
);
void
gnrc_icmpv6_error_time_exc_send
(
uint8_t
code
,
const
gnrc_pktsnip_t
*
orig_pkt
);
/**
/**
* @brief Sends an ICMPv6 parameter problem message for sending.
* @brief Sends an ICMPv6 parameter problem message for sending.
...
@@ -65,7 +67,7 @@ void gnrc_icmpv6_error_time_exc_send(uint8_t code, gnrc_pktsnip_t *orig_pkt);
...
@@ -65,7 +67,7 @@ void gnrc_icmpv6_error_time_exc_send(uint8_t code, gnrc_pktsnip_t *orig_pkt);
* @param[in] orig_pkt The invoking packet.
* @param[in] orig_pkt The invoking packet.
*/
*/
void
gnrc_icmpv6_error_param_prob_send
(
uint8_t
code
,
void
*
ptr
,
void
gnrc_icmpv6_error_param_prob_send
(
uint8_t
code
,
void
*
ptr
,
gnrc_pktsnip_t
*
orig_pkt
);
const
gnrc_pktsnip_t
*
orig_pkt
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
This diff is collapsed.
Click to expand it.
sys/net/gnrc/network_layer/icmpv6/error/gnrc_icmpv6_error.c
+
13
−
10
View file @
36617f37
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
/* TODO: generalize and centralize (see https://github.com/RIOT-OS/RIOT/pull/3184) */
/* TODO: generalize and centralize (see https://github.com/RIOT-OS/RIOT/pull/3184) */
#define MIN(a, b) ((a) < (b)) ? (a) : (b)
#define MIN(a, b) ((a) < (b)) ? (a) : (b)
static
inline
size_t
_fit
(
gnrc_pktsnip_t
*
pkt
)
static
inline
size_t
_fit
(
const
gnrc_pktsnip_t
*
pkt
)
{
{
/* TODO: replace IPV6_MIN_MTU with known path MTU? */
/* TODO: replace IPV6_MIN_MTU with known path MTU? */
return
MIN
((
gnrc_pkt_len
(
pkt
)
+
ICMPV6_ERROR_SZ
),
IPV6_MIN_MTU
);
return
MIN
((
gnrc_pkt_len
(
pkt
)
+
ICMPV6_ERROR_SZ
),
IPV6_MIN_MTU
);
...
@@ -34,7 +34,8 @@ static inline size_t _fit(gnrc_pktsnip_t *pkt)
...
@@ -34,7 +34,8 @@ static inline size_t _fit(gnrc_pktsnip_t *pkt)
/* Build a generic error message */
/* Build a generic error message */
static
gnrc_pktsnip_t
*
_icmpv6_error_build
(
uint8_t
type
,
uint8_t
code
,
static
gnrc_pktsnip_t
*
_icmpv6_error_build
(
uint8_t
type
,
uint8_t
code
,
gnrc_pktsnip_t
*
orig_pkt
,
uint32_t
value
)
const
gnrc_pktsnip_t
*
orig_pkt
,
uint32_t
value
)
{
{
gnrc_pktsnip_t
*
pkt
=
gnrc_icmpv6_build
(
NULL
,
type
,
code
,
_fit
(
orig_pkt
));
gnrc_pktsnip_t
*
pkt
=
gnrc_icmpv6_build
(
NULL
,
type
,
code
,
_fit
(
orig_pkt
));
...
@@ -55,19 +56,19 @@ static gnrc_pktsnip_t *_icmpv6_error_build(uint8_t type, uint8_t code,
...
@@ -55,19 +56,19 @@ static gnrc_pktsnip_t *_icmpv6_error_build(uint8_t type, uint8_t code,
}
}
static
inline
gnrc_pktsnip_t
*
_dst_unr_build
(
uint8_t
code
,
static
inline
gnrc_pktsnip_t
*
_dst_unr_build
(
uint8_t
code
,
gnrc_pktsnip_t
*
orig_pkt
)
const
gnrc_pktsnip_t
*
orig_pkt
)
{
{
return
_icmpv6_error_build
(
ICMPV6_DST_UNR
,
code
,
orig_pkt
,
0
);
return
_icmpv6_error_build
(
ICMPV6_DST_UNR
,
code
,
orig_pkt
,
0
);
}
}
static
inline
gnrc_pktsnip_t
*
_pkt_too_big_build
(
uint32_t
mtu
,
static
inline
gnrc_pktsnip_t
*
_pkt_too_big_build
(
uint32_t
mtu
,
gnrc_pktsnip_t
*
orig_pkt
)
const
gnrc_pktsnip_t
*
orig_pkt
)
{
{
return
_icmpv6_error_build
(
ICMPV6_PKT_TOO_BIG
,
0
,
orig_pkt
,
mtu
);
return
_icmpv6_error_build
(
ICMPV6_PKT_TOO_BIG
,
0
,
orig_pkt
,
mtu
);
}
}
static
inline
gnrc_pktsnip_t
*
_time_exc_build
(
uint8_t
code
,
static
inline
gnrc_pktsnip_t
*
_time_exc_build
(
uint8_t
code
,
gnrc_pktsnip_t
*
orig_pkt
)
const
gnrc_pktsnip_t
*
orig_pkt
)
{
{
return
_icmpv6_error_build
(
ICMPV6_TIME_EXC
,
code
,
orig_pkt
,
0
);
return
_icmpv6_error_build
(
ICMPV6_TIME_EXC
,
code
,
orig_pkt
,
0
);
}
}
...
@@ -78,7 +79,7 @@ static inline bool _in_range(uint8_t *ptr, uint8_t *start, size_t sz)
...
@@ -78,7 +79,7 @@ static inline bool _in_range(uint8_t *ptr, uint8_t *start, size_t sz)
}
}
static
gnrc_pktsnip_t
*
_param_prob_build
(
uint8_t
code
,
void
*
ptr
,
static
gnrc_pktsnip_t
*
_param_prob_build
(
uint8_t
code
,
void
*
ptr
,
gnrc_pktsnip_t
*
orig_pkt
)
const
gnrc_pktsnip_t
*
orig_pkt
)
{
{
gnrc_pktsnip_t
*
pkt
=
gnrc_icmpv6_build
(
NULL
,
ICMPV6_PARAM_PROB
,
code
,
gnrc_pktsnip_t
*
pkt
=
gnrc_icmpv6_build
(
NULL
,
ICMPV6_PARAM_PROB
,
code
,
_fit
(
orig_pkt
));
_fit
(
orig_pkt
));
...
@@ -121,7 +122,7 @@ static gnrc_pktsnip_t *_param_prob_build(uint8_t code, void *ptr,
...
@@ -121,7 +122,7 @@ static gnrc_pktsnip_t *_param_prob_build(uint8_t code, void *ptr,
return
pkt
;
return
pkt
;
}
}
void
gnrc_icmpv6_error_dst_unr_send
(
uint8_t
code
,
gnrc_pktsnip_t
*
orig_pkt
)
void
gnrc_icmpv6_error_dst_unr_send
(
uint8_t
code
,
const
gnrc_pktsnip_t
*
orig_pkt
)
{
{
gnrc_pktsnip_t
*
pkt
=
_dst_unr_build
(
code
,
orig_pkt
);
gnrc_pktsnip_t
*
pkt
=
_dst_unr_build
(
code
,
orig_pkt
);
...
@@ -130,7 +131,8 @@ void gnrc_icmpv6_error_dst_unr_send(uint8_t code, gnrc_pktsnip_t *orig_pkt)
...
@@ -130,7 +131,8 @@ void gnrc_icmpv6_error_dst_unr_send(uint8_t code, gnrc_pktsnip_t *orig_pkt)
}
}
}
}
void
gnrc_icmpv6_error_pkt_too_big_send
(
uint32_t
mtu
,
gnrc_pktsnip_t
*
orig_pkt
)
void
gnrc_icmpv6_error_pkt_too_big_send
(
uint32_t
mtu
,
const
gnrc_pktsnip_t
*
orig_pkt
)
{
{
gnrc_pktsnip_t
*
pkt
=
_pkt_too_big_build
(
mtu
,
orig_pkt
);
gnrc_pktsnip_t
*
pkt
=
_pkt_too_big_build
(
mtu
,
orig_pkt
);
...
@@ -139,7 +141,8 @@ void gnrc_icmpv6_error_pkt_too_big_send(uint32_t mtu, gnrc_pktsnip_t *orig_pkt)
...
@@ -139,7 +141,8 @@ void gnrc_icmpv6_error_pkt_too_big_send(uint32_t mtu, gnrc_pktsnip_t *orig_pkt)
}
}
}
}
void
gnrc_icmpv6_error_time_exc_send
(
uint8_t
code
,
gnrc_pktsnip_t
*
orig_pkt
)
void
gnrc_icmpv6_error_time_exc_send
(
uint8_t
code
,
const
gnrc_pktsnip_t
*
orig_pkt
)
{
{
gnrc_pktsnip_t
*
pkt
=
_time_exc_build
(
code
,
orig_pkt
);
gnrc_pktsnip_t
*
pkt
=
_time_exc_build
(
code
,
orig_pkt
);
...
@@ -149,7 +152,7 @@ void gnrc_icmpv6_error_time_exc_send(uint8_t code, gnrc_pktsnip_t *orig_pkt)
...
@@ -149,7 +152,7 @@ void gnrc_icmpv6_error_time_exc_send(uint8_t code, gnrc_pktsnip_t *orig_pkt)
}
}
void
gnrc_icmpv6_error_param_prob_send
(
uint8_t
code
,
void
*
ptr
,
void
gnrc_icmpv6_error_param_prob_send
(
uint8_t
code
,
void
*
ptr
,
gnrc_pktsnip_t
*
orig_pkt
)
const
gnrc_pktsnip_t
*
orig_pkt
)
{
{
gnrc_pktsnip_t
*
pkt
=
_param_prob_build
(
code
,
ptr
,
orig_pkt
);
gnrc_pktsnip_t
*
pkt
=
_param_prob_build
(
code
,
ptr
,
orig_pkt
);
...
...
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