From 18a44f17013ae1086c15c5e3acd4f7585e7f1942 Mon Sep 17 00:00:00 2001 From: Adrian-Stefan Mares Date: Mon, 16 Oct 2023 17:56:29 +0200 Subject: [PATCH] ns: Reject unexpected RekeyInd --- pkg/networkserver/mac/rekey.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/networkserver/mac/rekey.go b/pkg/networkserver/mac/rekey.go index cba67a09234..0561c33bbe2 100644 --- a/pkg/networkserver/mac/rekey.go +++ b/pkg/networkserver/mac/rekey.go @@ -42,10 +42,12 @@ func HandleRekeyInd(ctx context.Context, dev *ttnpb.EndDevice, pld *ttnpb.MACCom evs := events.Builders{ EvtReceiveRekeyIndication.With(events.WithData(pld)), } - if !dev.SupportsJoin { + if !dev.SupportsJoin || !macspec.UseRekeyInd(dev.LorawanVersion) { return evs, nil } - if dev.PendingSession != nil && dev.MacState.PendingJoinRequest != nil && types.MustDevAddr(dev.PendingSession.DevAddr).OrZero().Equal(devAddr) { + if dev.PendingSession != nil && + dev.MacState.PendingJoinRequest != nil && + types.MustDevAddr(dev.PendingSession.DevAddr).OrZero().Equal(devAddr) { dev.Ids.DevAddr = dev.PendingSession.DevAddr dev.Session = dev.PendingSession }