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
3929550e
Commit
3929550e
authored
7 years ago
by
Martine Lenders
Browse files
Options
Downloads
Patches
Plain Diff
gnrc_netif2: make gnrc_netif2_create idempotent and crash on error
parent
c8a02563
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sys/include/net/gnrc/netif2.h
+4
-1
4 additions, 1 deletion
sys/include/net/gnrc/netif2.h
sys/include/net/gnrc/netif2/ethernet.h
+4
-1
4 additions, 1 deletion
sys/include/net/gnrc/netif2/ethernet.h
sys/net/gnrc/netif2/gnrc_netif2.c
+5
-7
5 additions, 7 deletions
sys/net/gnrc/netif2/gnrc_netif2.c
with
13 additions
and
9 deletions
sys/include/net/gnrc/netif2.h
+
4
−
1
View file @
3929550e
...
...
@@ -215,8 +215,11 @@ struct gnrc_netif2_ops {
* @note If @ref DEVELHELP is defined netif_params_t::name is used as the
* name of the network interface's thread.
*
* @attention Fails and crashes (assertion error with @ref DEVELHELP or
* segmentation fault without) if `GNRC_NETIF_NUMOF` is lower than
* the number of calls to this function.
*
* @return The network interface on success.
* @return NULL, on error.
*/
gnrc_netif2_t
*
gnrc_netif2_create
(
char
*
stack
,
int
stacksize
,
char
priority
,
const
char
*
name
,
netdev_t
*
dev
,
...
...
This diff is collapsed.
Click to expand it.
sys/include/net/gnrc/netif2/ethernet.h
+
4
−
1
View file @
3929550e
...
...
@@ -35,8 +35,11 @@ extern "C" {
*
* @see @ref gnrc_netif2_create()
*
* @attention Fails and crashes (assertion error with @ref DEVELHELP or
* segmentation fault without) if `GNRC_NETIF_NUMOF` is lower than
* the number of calls to this function.
*
* @return The network interface on success.
* @return NULL, on error.
*/
gnrc_netif2_t
*
gnrc_netif2_ethernet_create
(
char
*
stack
,
int
stacksize
,
char
priority
,
char
*
name
,
netdev_t
*
dev
);
...
...
This diff is collapsed.
Click to expand it.
sys/net/gnrc/netif2/gnrc_netif2.c
+
5
−
7
View file @
3929550e
...
...
@@ -51,16 +51,14 @@ gnrc_netif2_t *gnrc_netif2_create(char *stack, int stacksize, char priority,
int
res
;
for
(
int
i
=
0
;
i
<
GNRC_NETIF_NUMOF
;
i
++
)
{
if
(
_netifs
[
i
].
ops
==
NULL
)
{
if
(
_netifs
[
i
].
dev
==
netdev
)
{
return
&
_netifs
[
i
];
}
if
((
netif
==
NULL
)
&&
(
_netifs
[
i
].
ops
==
NULL
))
{
netif
=
&
_netifs
[
i
];
break
;
}
}
if
(
netif
==
NULL
)
{
LOG_ERROR
(
"gnrc_netif2: can not allocate network interface.
\n
"
"Set GNRC_NETIF_NUMOF to a higher value
\n
"
);
return
NULL
;
}
assert
(
netif
!=
NULL
);
rmutex_init
(
&
netif
->
mutex
);
netif
->
ops
=
ops
;
assert
(
netif
->
dev
==
NULL
);
...
...
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