Skip to content

Commit 344c344

Browse files
committed
Display warning upon ignored uplink
1 parent 078658a commit 344c344

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/lorawan_mac.erl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ ingest_frame(MAC, <<MType:3, _:3, 0:2, _/binary>> = PHYPayload) when byte_size(P
2727
end),
2828
Res;
2929
ingest_frame(MAC, PHYPayload) ->
30-
lager:debug("~s unknown frame protocol: ~p", [binary_to_hex(MAC), PHYPayload]),
30+
lager:warning("~s unknown frame protocol: ~p", [binary_to_hex(MAC), PHYPayload]),
3131
ignore.
3232

33-
ingest_frame0(_MAC, 2#000, <<_, AppEUI0:8/binary, DevEUI0:8/binary,
33+
ingest_frame0(MAC, 2#000, <<_, AppEUI0:8/binary, DevEUI0:8/binary,
3434
DevNonce:2/binary>> = Msg, MIC) ->
3535
{AppEUI, DevEUI} = {reverse(AppEUI0), reverse(DevEUI0)},
3636
case mnesia:read(device, DevEUI, read) of
@@ -41,7 +41,7 @@ ingest_frame0(_MAC, 2#000, <<_, AppEUI0:8/binary, DevEUI0:8/binary,
4141
[D] ->
4242
case aes_cmac:aes_cmac(D#device.appkey, Msg, 4) of
4343
MIC ->
44-
handle_join(D, DevNonce);
44+
handle_join(MAC, D, DevNonce);
4545
_MIC2 ->
4646
{error, {device, DevEUI}, bad_mic}
4747
end
@@ -59,7 +59,7 @@ ingest_frame0(MAC, MType, <<_, DevAddr0:4/binary, ADR:1, ADRACKReq:1, ACK:1, _RF
5959
ingest_data_frame(MAC, MType, Msg, FOpts, FRMPayload, MIC,
6060
#frame{conf=Confirm, devaddr=DevAddr, adr=ADR, adr_ack_req=ADRACKReq, ack=ACK, fcnt=FCnt, port=Port});
6161
ingest_frame0(MAC, MType, Msg, _MIC) ->
62-
lager:debug("~s bad frame (mtype ~.2B): ~p", [binary_to_hex(MAC), MType, Msg]),
62+
lager:warning("~s bad frame (mtype ~.2B): ~p", [binary_to_hex(MAC), MType, Msg]),
6363
ignore.
6464

6565
ingest_data_frame(_MAC, MType, Msg, FOpts, FRMPayload, MIC,
@@ -94,10 +94,10 @@ ingest_data_frame(_MAC, MType, Msg, FOpts, FRMPayload, MIC,
9494
{ignore, Frame}
9595
end;
9696
ingest_data_frame(MAC, MType, _Msg, _FOpts, _FRMPayload, _MIC, #frame{devaddr=DevAddr}) ->
97-
lager:debug("~s ~s downlink frame (mtype ~.2B)", [binary_to_hex(MAC), binary_to_hex(DevAddr), MType]),
97+
lager:warning("~s ~s downlink frame (mtype ~.2B)", [binary_to_hex(MAC), binary_to_hex(DevAddr), MType]),
9898
ignore.
9999

100-
handle_join(#device{deveui=DevEUI, profile=ProfID}=Device, DevNonce) ->
100+
handle_join(MAC, #device{deveui=DevEUI, profile=ProfID}=Device, DevNonce) ->
101101
case mnesia:read(profile, ProfID, read) of
102102
[] ->
103103
{error, {device, DevEUI}, {unknown_profile, ProfID}, aggregated};
@@ -106,7 +106,7 @@ handle_join(#device{deveui=DevEUI, profile=ProfID}=Device, DevNonce) ->
106106
[] ->
107107
{error, {device, DevEUI}, {unknown_group, GroupName}, aggregated};
108108
[#group{can_join=false}] ->
109-
lager:debug("Join ignored from DevEUI ~s", [binary_to_hex(DevEUI)]),
109+
lager:warning("~s join ignored from DevEUI ~s", [binary_to_hex(MAC), binary_to_hex(DevEUI)]),
110110
ignore;
111111
[#group{network=NetName, subid=SubID}] ->
112112
case mnesia:read(network, NetName, read) of

0 commit comments

Comments
 (0)