aboutsummaryrefslogtreecommitdiffstats
path: root/src/libvlr/vlr_auth_fsm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libvlr/vlr_auth_fsm.c')
-rw-r--r--src/libvlr/vlr_auth_fsm.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libvlr/vlr_auth_fsm.c b/src/libvlr/vlr_auth_fsm.c
index ccf3660..6026510 100644
--- a/src/libvlr/vlr_auth_fsm.c
+++ b/src/libvlr/vlr_auth_fsm.c
@@ -629,3 +629,18 @@ struct osmo_fsm_inst *auth_fsm_start(struct vlr_subscr *vsub,
return fi;
}
+
+bool auth_try_reuse_tuple(struct vlr_subscr *vsub, uint8_t key_seq)
+{
+ int max_reuse_count = vsub->vlr->cfg.auth_tuple_max_reuse_count;
+ struct vlr_auth_tuple *at = vsub->last_tuple;
+
+ if (!at)
+ return false;
+ if ((max_reuse_count >= 0) && (at->use_count > max_reuse_count))
+ return false;
+ if (at->key_seq != key_seq)
+ return false;
+ at->use_count++;
+ return true;
+}