Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81c24ecf authored by howardchung's avatar howardchung Committed by Yun-hao Chung
Browse files

Floss: Disallow retring non-basic mode

If our preferred mode is ERTM and the peer wants something else and not basic mode, we should not compromise.

Bug: 270529845
Test: run L2CAP/CMC/BV-03-C and L2CAP/CMC/BV-07-C

Change-Id: I0c5a97c1a485f022ad8e8f96255a14bb6f66cc2f
parent e6e483ff
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -1804,12 +1804,13 @@ uint8_t l2c_fcr_process_peer_cfg_req(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg) {
  if (p_cfg->fcr.mode != p_ccb->p_rcb->ertm_info.preferred_mode) {
    /* If peer wants a mode that we don't support then retry our mode (ex.
     *rtx/flc), OR
    ** If we want ERTM and they wanted streaming retry our mode.
     ** If we want ERTM and they want non-basic mode, retry our mode.
     ** Note: If we have already determined they support our mode previously
     **       from their EXF mask.
     */
    if ((((1 << p_cfg->fcr.mode) & L2CAP_FCR_CHAN_OPT_ALL_MASK) == 0) ||
        (p_ccb->p_rcb->ertm_info.preferred_mode == L2CAP_FCR_ERTM_MODE)) {
        ((p_ccb->p_rcb->ertm_info.preferred_mode == L2CAP_FCR_ERTM_MODE) &&
         (p_cfg->fcr.mode != L2CAP_FCR_BASIC_MODE))) {
      p_cfg->fcr.mode = p_ccb->our_cfg.fcr.mode;
      p_cfg->fcr.tx_win_sz = p_ccb->our_cfg.fcr.tx_win_sz;
      p_cfg->fcr.max_transmit = p_ccb->our_cfg.fcr.max_transmit;