Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
easycwmp
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
CodeLinaro
qsdk
easycwmp
Commits
b413f933
Commit
b413f933
authored
8 years ago
by
Anis Ellouze
Browse files
Options
Downloads
Patches
Plain Diff
#0000179: [IPPing Diagnostics ] :8 DIAGNOSTICS COMPLETE event is not send when host is bad
parent
6abf93f6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ext/openwrt/scripts/functions/common/ipping_launch
+9
-8
9 additions, 8 deletions
ext/openwrt/scripts/functions/common/ipping_launch
with
9 additions
and
8 deletions
ext/openwrt/scripts/functions/common/ipping_launch
+
9
−
8
View file @
b413f933
...
...
@@ -32,11 +32,11 @@ ipping_launch() {
let
i++
res
=
$(
ping
-q
-c
1
-s
$dsize
-W
$timeout
$host
2>&1
)
ba
=
`
echo
"
$res
"
|
grep
"bad address"
`
[
-n
"
$ba
"
]
&&
{
$UCI_SET_VARSTATE
easycwmp.@local[0].DiagnosticsState
=
Error_CannotResolveHostName
;
return
;
}
[
-n
"
$ba
"
]
&&
{
$UCI_SET_VARSTATE
easycwmp.@local[0].DiagnosticsState
=
Error_CannotResolveHostName
;
event_dignostic
;
return
;
}
ba
=
`
echo
"
$res
"
|
grep
"unknown host"
`
[
-n
"
$ba
"
]
&&
{
$UCI_SET_VARSTATE
easycwmp.@local[0].DiagnosticsState
=
Error_CannotResolveHostName
;
return
;
}
[
-n
"
$ba
"
]
&&
{
$UCI_SET_VARSTATE
easycwmp.@local[0].DiagnosticsState
=
Error_CannotResolveHostName
;
event_dignostic
;
return
;
}
stc
=
`
echo
"
$res
"
|
grep
"received"
`
[
-z
"
$stc
"
]
&&
{
$UCI_SET_VARSTATE
easycwmp.@local[0].DiagnosticsState
=
Error_Other
;
return
;
}
[
-z
"
$stc
"
]
&&
{
$UCI_SET_VARSTATE
easycwmp.@local[0].DiagnosticsState
=
Error_Other
;
event_dignostic
;
return
;
}
times
=
`
echo
"
$res
"
|
grep
"min/avg/max"
`
[
-z
"
$times
"
]
&&
continue
sc1
=
`
echo
$stc
|
awk
'{print $4}'
`
...
...
@@ -49,9 +49,9 @@ ipping_launch() {
min_time
=
${
min_time
:-
0
}
avg_time
=
${
avg_time
:-
0
}
max_time
=
${
max_time
:-
0
}
min_time
=
$
(
awk
"BEGIN{print
$min_time
* 1000}"
)
avg_time
=
$
(
awk
"BEGIN{print
$avg_time
* 1000}"
)
max_time
=
$
(
awk
"BEGIN{print
$max_time
* 1000}"
)
min_time
=
$
{
min_time
%.*
}
avg_time
=
$
{
avg_time
%.*
}
max_time
=
$
{
max_time
%.*
}
[
$min_time
-lt
$min
]
&&
min
=
$min_time
[
$max_time
-gt
$max
]
&&
max
=
$max_time
avg_time_sum
=
$((
avg_time_sum+avg_time
))
...
...
@@ -82,11 +82,12 @@ event_dignostic() {
ipping_stop
()
{
local
pids
=
`
ps aux |
grep
ipping_launch |
grep
-v
grep
|
grep
-v
stop |
awk
'{print $2}'
`
[
-z
"
$pids
"
]
&&
pids
=
`
ps |
grep
ipping_launch |
grep
-v
grep
|
grep
-v
stop |
awk
'{print $2}'
`
if
[
-n
"
$pids
"
]
;
then
kill
-9
$pids
2>/dev/null
$UCI_SET_VARSTATE
easycwmp.@local[0].DiagnosticsState
=
None
fi
}
[
"
$1
"
==
"run"
]
&&
{
ipping_launch
;
exit
0
;
}
[
"
$1
"
==
"stop"
]
&&
ipping_stop
[
"
$1
"
==
"run"
]
&&
{
ipping_launch
2>/dev/null
;
exit
0
;
}
[
"
$1
"
==
"stop"
]
&&
ipping_stop
2>/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