Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Network Manager
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
network
Network Manager
Commits
539c2369
Commit
539c2369
authored
11 months ago
by
Vivek Dutta
Browse files
Options
Downloads
Patches
Plain Diff
Updated logic for IP Interface status
parent
f7ac5f96
Branches
Branches containing commit
No related tags found
1 merge request
!12
Updated logic for IP Interface status
Pipeline
#184019
passed
11 months ago
Stage: static_code_analysis
Changes
1
Pipelines
3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ip.c
+26
-2
26 additions, 2 deletions
src/ip.c
with
26 additions
and
2 deletions
src/ip.c
+
26
−
2
View file @
539c2369
...
...
@@ -1257,10 +1257,34 @@ static int set_IPInterface_ULAEnable(char *refparam, struct dmctx *ctx, void *da
return
0
;
}
// ifstatus = Down and devstatus = Down => Status=Down
// ifstatus = Down and devstatus = Up => Status=Dormant
// ifstatus = Up and devstatus = Up => Status=Up
// ifstatus not available => Status=Unknown
// devstatus != Up => Status=LowerLayerDown
static
int
get_IPInterface_Status
(
char
*
refparam
,
struct
dmctx
*
ctx
,
void
*
data
,
char
*
instance
,
char
**
value
)
{
char
*
device
=
get_device
(
section_name
(((
struct
dm_data
*
)
data
)
->
config_section
));
return
get_net_device_status
(
device
,
value
);
json_object
*
res
=
NULL
;
char
*
if_name
=
section_name
(((
struct
dm_data
*
)
data
)
->
config_section
);
char
*
device
=
get_device
(
if_name
);
char
*
devstatus
=
NULL
;
bool
ifstatus
=
false
;
dmubus_call
(
"network.interface"
,
"status"
,
UBUS_ARGS
{{
"interface"
,
if_name
,
String
}},
1
,
&
res
);
DM_ASSERT
(
res
,
*
value
=
dmstrdup
(
"Unknown"
));
string_to_bool
(
dmjson_get_value
(
res
,
1
,
"up"
),
&
ifstatus
);
get_net_device_status
(
device
,
&
devstatus
);
if
((
ifstatus
==
false
)
&&
(
DM_STRNCMP
(
devstatus
,
"Up"
,
2
)
==
0
))
{
*
value
=
dmstrdup
(
"Dormant"
);
}
else
if
(
DM_STRNCMP
(
devstatus
,
"Up"
,
2
)
!=
0
)
{
*
value
=
dmstrdup
(
"LowerLayerDown"
);
}
else
{
*
value
=
devstatus
;
}
return
0
;
}
/*#Device.IP.Interface.{i}.Alias!UCI:dmmap_network/interface,@i-1/ip_int_alias*/
...
...
...
...
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
sign in
to comment