Fail upgrade on active bank

This commit is contained in:
Vivek Kumar Dutta 2026-01-27 15:32:15 +05:30
parent 60bc2108b5
commit 257c9fac69
No known key found for this signature in database
GPG key ID: 4E09F5AD8265FD4C

View file

@ -280,6 +280,15 @@ static int bbf_fw_image_download(struct ubus_context *ctx, struct fw_download_da
char fault_msg[128] = {0};
time_t complete_time = 0;
time_t start_time = time(NULL);
char *active_bank_id = NULL;
// Check if trying to download in active bank
active_bank_id = get_fwbank_bank_id("active");
if (DM_STRCMP(dw_data->bank_id, active_bank_id) == 0 ) {
res = -1;
snprintf(fault_msg, sizeof(fault_msg), "Trying to download in active bank %s", active_bank_id);
goto end;
}
DM_STRNCPY(fw_image_path, "/tmp/firmware-XXXXXX", sizeof(fw_image_path));
@ -661,8 +670,7 @@ static int operate_DeviceInfoFirmwareImage_Download(char *refparam, struct dmctx
dw_data.obj_path = dmstrdup(obj_path);
int res = bbf_fw_image_download(ctx->ubus_ctx, &dw_data);
if (res == 1) {
if (res != 0) {
bbfdm_set_fault_message(ctx, "Firmware validation failed");
}