Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
map-topology
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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Multi-AP
map-topology
Commits
3ff2f6f3
Commit
3ff2f6f3
authored
4 years ago
by
Nevadita
Browse files
Options
Downloads
Patches
Plain Diff
map-topology: Added NULL checks
parent
eb3c174d
No related branches found
No related tags found
1 merge request
!12
map-topology: Added NULL checks
Pipeline
#3384
passed
4 years ago
Stage: static_code_analysis
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/topologyd.c
+18
-5
18 additions, 5 deletions
src/topologyd.c
with
18 additions
and
5 deletions
src/topologyd.c
+
18
−
5
View file @
3ff2f6f3
...
...
@@ -79,7 +79,7 @@ static void ieee1905_info_response_cb(struct ubus_request *req,
}
}
static
void
ieee1905_msg_from_ubus
(
struct
blob_attr
*
msg
,
uint16_t
*
msg_type
,
uint16_t
*
msg_mid
,
uint8_t
**
tlv
,
uint32_t
*
b_len
,
char
*
ingress_if_name
)
static
int
ieee1905_msg_from_ubus
(
struct
blob_attr
*
msg
,
uint16_t
*
msg_type
,
uint16_t
*
msg_mid
,
uint8_t
**
tlv
,
uint32_t
*
b_len
,
char
*
ingress_if_name
)
{
json_object
*
jroot
=
NULL
;
char
*
str
;
...
...
@@ -105,7 +105,7 @@ static void ieee1905_msg_from_ubus(struct blob_attr *msg, uint16_t *msg_type, ui
strncpy
(
ingress_if_name
,
if_name
,
strlen
(
if_name
));
tlv_str
=
_json_obj_get_string
(
jroot
,
"tlvs"
);
if
(
tlv_str
==
NULL
)
return
;
return
1
;
len
=
strlen
(
tlv_str
);
//dbg(" The TLV string is %s LENGTH Id %d", tlv_str, len);
*
b_len
=
(
len
/
2
);
...
...
@@ -113,11 +113,13 @@ static void ieee1905_msg_from_ubus(struct blob_attr *msg, uint16_t *msg_type, ui
*
tlv
=
(
uint8_t
*
)
malloc
((
*
b_len
)
*
sizeof
(
uint8_t
));
if
(
*
tlv
==
NULL
)
{
err
(
"No Memory
\n
"
);
return
;
return
1
;
}
strtob
(
tlv_str
,
len
,
*
tlv
);
json_safe_put
(
jroot
);
}
return
0
;
}
int
topologyd_get_ieee1905_macaddr
(
struct
topologyd_private
*
p
)
...
...
@@ -165,6 +167,7 @@ void topologyd_event_handler(struct ubus_context *ctx,
struct
ubus_event_handler
*
ev
,
const
char
*
type
,
struct
blob_attr
*
msg
)
{
int
ret
=
0
;
struct
cmdu_cstruct
*
cstruct
=
NULL
;
uint16_t
msg_type
=
0
;
uint16_t
msg_mid
=
0
;
...
...
@@ -179,7 +182,13 @@ void topologyd_event_handler(struct ubus_context *ctx,
return
;
//Calling the function to get the args from json msg
ieee1905_msg_from_ubus
(
msg
,
&
msg_type
,
&
msg_mid
,
&
tlv
,
&
len
,
itfr_name
);
ret
=
ieee1905_msg_from_ubus
(
msg
,
&
msg_type
,
&
msg_mid
,
&
tlv
,
&
len
,
itfr_name
);
if
(
ret
!=
0
)
{
err
(
"ieee1905_msg_from_ubus error
\n
"
);
if
(
tlv
!=
NULL
)
free
(
tlv
);
return
;
}
dbg
(
"Inside topology event handler %hu %hu %s"
,
msg_type
,
msg_mid
,
itfr_name
);
...
...
@@ -793,6 +802,7 @@ void topologyd_dump_node(struct blob_buf *bb, struct node *p, int is_self)
strcat
(
behind_mac_str
,
","
);
strcat
(
behind_mac_str
,
mac_str
);
}
blobmsg_add_string
(
bb
,
"behind_mac_id"
,
behind_mac_str
);
blobmsg_close_table
(
bb
,
table
);
}
blobmsg_close_array
(
bb
,
l2_neighbor
);
...
...
@@ -1020,7 +1030,7 @@ void topologyd_print_changelog(struct blob_buf *bb, struct topologyd_private *pr
blobmsg_add_string
(
bb
,
"neighbor"
,
nbr_macstr
);
blobmsg_add_string
(
bb
,
"is1905_neighbor"
,
log
->
is1905_nbr
?
"
true"
:
"false
"
);
log
->
is1905_nbr
?
"
IEEE1905"
:
"Non-IEEE1905
"
);
blobmsg_add_string
(
bb
,
"event_type"
,
log
->
type
?
"delete"
:
"add"
);
...
...
@@ -1274,6 +1284,9 @@ int topologyd_start(void)
priv
->
heartbeat
.
cb
=
topologyd_start_heartbeat
;
priv
->
topo
.
changelog
=
(
struct
topology_changelog
*
)
malloc
((
priv
->
config
.
maxlog
)
*
sizeof
(
struct
topology_changelog
));
if
(
priv
->
topo
.
changelog
==
NULL
)
goto
out_and_exit
;
topology_log_max
=
priv
->
config
.
maxlog
;
dbg
(
"Dynamic array size %d"
,
priv
->
config
.
maxlog
);
...
...
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