|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright (c) 2011, 2013-2017, 2019-2020 The Linux Foundation. All rights reserved.
|
|
|
+ * Copyright (c) 2011, 2013-2017, 2019-2021 The Linux Foundation. All rights reserved.
|
|
|
*
|
|
|
* Permission to use, copy, modify, and/or distribute this software for
|
|
|
* any purpose with or without fee is hereby granted, provided that the
|
|
@@ -37,25 +37,36 @@
|
|
|
} while (0)
|
|
|
|
|
|
int ol_rx_pn_cmp24(union htt_rx_pn_t *new_pn,
|
|
|
- union htt_rx_pn_t *old_pn, int is_unicast, int opmode)
|
|
|
+ union htt_rx_pn_t *old_pn, int is_unicast, int opmode,
|
|
|
+ bool strict_chk)
|
|
|
{
|
|
|
- int rc = ((new_pn->pn24 & 0xffffff) <= (old_pn->pn24 & 0xffffff));
|
|
|
- return rc;
|
|
|
+ if (strict_chk)
|
|
|
+ return ((new_pn->pn24 & 0xffffff) - (old_pn->pn24 & 0xffffff)
|
|
|
+ != 1);
|
|
|
+ else
|
|
|
+ return ((new_pn->pn24 & 0xffffff) <= (old_pn->pn24 & 0xffffff));
|
|
|
}
|
|
|
|
|
|
int ol_rx_pn_cmp48(union htt_rx_pn_t *new_pn,
|
|
|
- union htt_rx_pn_t *old_pn, int is_unicast, int opmode)
|
|
|
+ union htt_rx_pn_t *old_pn, int is_unicast, int opmode,
|
|
|
+ bool strict_chk)
|
|
|
{
|
|
|
- int rc = ((new_pn->pn48 & 0xffffffffffffULL) <=
|
|
|
- (old_pn->pn48 & 0xffffffffffffULL));
|
|
|
- return rc;
|
|
|
+ if (strict_chk)
|
|
|
+ return ((new_pn->pn48 & 0xffffffffffffULL) -
|
|
|
+ (old_pn->pn48 & 0xffffffffffffULL) != 1);
|
|
|
+ else
|
|
|
+ return ((new_pn->pn48 & 0xffffffffffffULL) <=
|
|
|
+ (old_pn->pn48 & 0xffffffffffffULL));
|
|
|
}
|
|
|
|
|
|
int ol_rx_pn_wapi_cmp(union htt_rx_pn_t *new_pn,
|
|
|
- union htt_rx_pn_t *old_pn, int is_unicast, int opmode)
|
|
|
+ union htt_rx_pn_t *old_pn, int is_unicast, int opmode,
|
|
|
+ bool strict_chk)
|
|
|
{
|
|
|
int pn_is_replay = 0;
|
|
|
|
|
|
+ /* TODO Strick check for WAPI is not implemented*/
|
|
|
+
|
|
|
if (new_pn->pn128[1] == old_pn->pn128[1])
|
|
|
pn_is_replay = (new_pn->pn128[0] <= old_pn->pn128[0]);
|
|
|
else
|
|
@@ -73,7 +84,7 @@ int ol_rx_pn_wapi_cmp(union htt_rx_pn_t *new_pn,
|
|
|
qdf_nbuf_t
|
|
|
ol_rx_pn_check_base(struct ol_txrx_vdev_t *vdev,
|
|
|
struct ol_txrx_peer_t *peer,
|
|
|
- unsigned int tid, qdf_nbuf_t msdu_list)
|
|
|
+ unsigned int tid, qdf_nbuf_t msdu_list, bool strict_chk)
|
|
|
{
|
|
|
struct ol_txrx_pdev_t *pdev = vdev->pdev;
|
|
|
union htt_rx_pn_t *last_pn;
|
|
@@ -132,7 +143,7 @@ ol_rx_pn_check_base(struct ol_txrx_vdev_t *vdev,
|
|
|
pn_is_replay =
|
|
|
pdev->rx_pn[peer->security[index].sec_type].
|
|
|
cmp(&new_pn, last_pn, index == txrx_sec_ucast,
|
|
|
- vdev->opmode);
|
|
|
+ vdev->opmode, strict_chk);
|
|
|
} else {
|
|
|
last_pn_valid = peer->tids_last_pn_valid[tid] = 1;
|
|
|
}
|
|
@@ -249,7 +260,7 @@ ol_rx_pn_check(struct ol_txrx_vdev_t *vdev,
|
|
|
struct ol_txrx_peer_t *peer, unsigned int tid,
|
|
|
qdf_nbuf_t msdu_list)
|
|
|
{
|
|
|
- msdu_list = ol_rx_pn_check_base(vdev, peer, tid, msdu_list);
|
|
|
+ msdu_list = ol_rx_pn_check_base(vdev, peer, tid, msdu_list, false);
|
|
|
ol_rx_fwd_check(vdev, peer, tid, msdu_list);
|
|
|
}
|
|
|
|
|
@@ -258,7 +269,7 @@ ol_rx_pn_check_only(struct ol_txrx_vdev_t *vdev,
|
|
|
struct ol_txrx_peer_t *peer,
|
|
|
unsigned int tid, qdf_nbuf_t msdu_list)
|
|
|
{
|
|
|
- msdu_list = ol_rx_pn_check_base(vdev, peer, tid, msdu_list);
|
|
|
+ msdu_list = ol_rx_pn_check_base(vdev, peer, tid, msdu_list, false);
|
|
|
ol_rx_deliver(vdev, peer, tid, msdu_list);
|
|
|
}
|
|
|
|