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

Commit 6f247bb5 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov Committed by android-build-merger
Browse files

Merge "Disable PAN Reverse Tethering when connection originated by the Remote" into oc-dev

am: c2debfa5

Change-Id: I8b07362df027405279f0f37f7f207609fc5ac292
parents acfbf500 c2debfa5
Loading
Loading
Loading
Loading
+33 −0
Original line number Original line Diff line number Diff line
@@ -215,6 +215,39 @@ void pan_conn_ind_cb(uint16_t handle, const RawAddress& p_bda,
    return;
    return;
  }
  }


  /* Check for valid interactions between the three PAN profile roles */
  /*
   * For reference, see Table 1 in PAN Profile v1.0 spec.
   * Note: the remote is the initiator.
   */
  bool is_valid_interaction = false;
  switch (remote_uuid->uu.uuid16) {
    case UUID_SERVCLASS_NAP:
    case UUID_SERVCLASS_GN:
      if (local_uuid->uu.uuid16 == UUID_SERVCLASS_PANU)
        is_valid_interaction = true;
      break;
    case UUID_SERVCLASS_PANU:
      is_valid_interaction = true;
      break;
  }
  /*
   * Explicitly disable connections to the local PANU if the remote is
   * not PANU.
   */
  if ((local_uuid->uu.uuid16 == UUID_SERVCLASS_PANU) &&
      (remote_uuid->uu.uuid16 != UUID_SERVCLASS_PANU)) {
    is_valid_interaction = false;
  }
  if (!is_valid_interaction) {
    PAN_TRACE_ERROR(
        "PAN Connection failed because of invalid PAN profile roles "
        "interaction: Remote UUID 0x%x Local UUID 0x%x",
        remote_uuid->uu.uuid16, local_uuid->uu.uuid16);
    BNEP_ConnectResp(handle, BNEP_CONN_FAILED_SRC_UUID);
    return;
  }

  /* Requested destination role is */
  /* Requested destination role is */
  if (local_uuid->uu.uuid16 == UUID_SERVCLASS_PANU)
  if (local_uuid->uu.uuid16 == UUID_SERVCLASS_PANU)
    req_role = PAN_ROLE_CLIENT;
    req_role = PAN_ROLE_CLIENT;