mirror of
https://github.com/espressif/openthread.git
synced 2026-07-08 21:30:24 +00:00
[cli] extend ping to allow hoplimit configuration (#4370)
This commit is contained in:
@@ -2033,6 +2033,7 @@ void Interpreter::ProcessPing(int argc, char *argv[])
|
||||
|
||||
VerifyOrExit(!mPingTimer.IsRunning(), error = OT_ERROR_BUSY);
|
||||
|
||||
mMessageInfo = Ip6::MessageInfo();
|
||||
SuccessOrExit(error = mMessageInfo.GetPeerAddr().FromString(argv[0]));
|
||||
|
||||
mLength = 8;
|
||||
@@ -2059,6 +2060,16 @@ void Interpreter::ProcessPing(int argc, char *argv[])
|
||||
mInterval = interval;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
SuccessOrExit(error = ParseLong(argv[index], value));
|
||||
VerifyOrExit(0 <= value && value <= 255, error = OT_ERROR_INVALID_ARGS);
|
||||
mMessageInfo.mHopLimit = static_cast<uint8_t>(value);
|
||||
if (value == 0)
|
||||
{
|
||||
mMessageInfo.mAllowZeroHopLimit = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ExitNow(error = OT_ERROR_INVALID_ARGS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user