Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate current channels length #6445

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -7145,7 +7145,7 @@
"file": "errors.go"
}
},
"error:pkg/networkserver/internal:unknown_chanel": {
"error:pkg/networkserver/internal:unknown_channel": {
"translations": {
"en": "channel is unknown"
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/networkserver/internal/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (
ErrCorruptedMACState = errors.DefineCorruption("corrupted_mac_state", "MAC state is corrupted")
ErrInvalidDataRate = errors.DefineInvalidArgument("data_rate", "invalid data rate")
ErrInvalidPayload = errors.DefineInvalidArgument("payload", "invalid payload")
ErrUnknownChannel = errors.Define("unknown_chanel", "channel is unknown")
ErrUnknownChannel = errors.Define("unknown_channel", "channel is unknown")

ErrNetworkDownlinkSlot = errors.DefineCorruption("network_downlink_slot", "could not generate network initiated downlink slot")
ErrUplinkChannel = errors.DefineCorruption("uplink_channel", "channel does not allow downlinks")
Expand Down
2 changes: 1 addition & 1 deletion pkg/networkserver/mac/dl_channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ func TestHandleDLChannelAns(t *testing.T) {
Error: ErrNoPayload,
},
{
Name: "frequency ack/chanel index ack/no request",
Name: "frequency ack/channel index ack/no request",
InputDevice: &ttnpb.EndDevice{
MacState: &ttnpb.MACState{
CurrentParameters: &ttnpb.MACParameters{},
Expand Down
8 changes: 8 additions & 0 deletions pkg/networkserver/mac/link_adr.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ func generateLinkADRReq(ctx context.Context, dev *ttnpb.EndDevice, phy *band.Ban
).
WithCause(internal.ErrUnknownChannel)
}
if len(currentParameters.Channels) > int(phy.MaxUplinkChannels) {
return linkADRReqParameters{}, false, internal.ErrCorruptedMACState.
WithAttributes(
"current_channels_len", len(currentParameters.Channels),
"phy_max_uplink_channels", phy.MaxUplinkChannels,
).
WithCause(internal.ErrUnknownChannel)
}

currentChs := make([]bool, phy.MaxUplinkChannels)
for i, ch := range currentParameters.Channels {
Expand Down
4 changes: 2 additions & 2 deletions pkg/webui/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@
"error:pkg/networkserver/internal:data_rate": "無効なデータレート",
"error:pkg/networkserver/internal:no_band_version": "帯域 `{id}` の指定されたバージョン `{ver}` が存在しません",
"error:pkg/networkserver/internal:payload": "無効なペイロード",
"error:pkg/networkserver/internal:unknown_chanel": "不明なチャネル",
"error:pkg/networkserver/internal:unknown_channel": "不明なチャネル",
"error:pkg/networkserver/mac:class_a_multicast": "クラスAモードでのマルチキャストデバイス",
"error:pkg/networkserver/mac:no_payload": "メッセージペイロードが特定できません",
"error:pkg/networkserver/mac:request_not_found": "MACレスポンスを受信しましたが、対応するリクエストが見つかりません",
Expand Down Expand Up @@ -1611,7 +1611,7 @@
"error:pkg/networkserver:retransmission_delay_exceeded": "再通信遅延が最大値を超えています",
"error:pkg/networkserver:schedule": "全てのスケジュールされたダウンリンクが失敗に終わりました",
"error:pkg/networkserver:transmission_number_exceeded": "通信回数が最大値を超えました",
"error:pkg/networkserver:unknown_chanel": "不明なチャネル",
"error:pkg/networkserver:unknown_channel": "不明なチャネル",
"error:pkg/networkserver:unknown_f_nwk_s_int_key": "不明なFNwkSIntKey",
"error:pkg/networkserver:unknown_mac_state": "不明なMAC状態",
"error:pkg/networkserver:unknown_nwk_s_enc_key": "不明なNwkSEncKey",
Expand Down
Loading