From patchwork Tue Jul 16 15:01:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1132825 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::33f; helo=mail-wm1-x33f.google.com; envelope-from=swupdate+bncbcxploxj6ikrbn6nw7uqkgqeforp7ki@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="f3TcfODz"; dkim-atps=neutral Received: from mail-wm1-x33f.google.com (mail-wm1-x33f.google.com [IPv6:2a00:1450:4864:20::33f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45p3WK6QdRz9sNC for ; Wed, 17 Jul 2019 01:01:15 +1000 (AEST) Received: by mail-wm1-x33f.google.com with SMTP id 21sf5556291wmj.4 for ; Tue, 16 Jul 2019 08:01:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1563289271; cv=pass; d=google.com; s=arc-20160816; b=l8PvjUmOyKDO0ZRwkJBHQmbutgZEn4FQoQGanu0zQFZAsL4JvQTzcOgE5A7+PN1tdm ixKvY48jyR0RFwEe8Ii7EC3nh3RRGjBqGr2wXo4ABpZh66DTksVHrE15hLN5fBH1EWSr fXZNkDWxLxYLdBN71fGXkm0ErwRLkmVJ8XA8PQgZlVCvykXugB5CmkKa5FJdyBHFMpMj Eh63wbmVDf/R1Uq8GWjyIqxal/M4Svb13e7qujP5ISFU2REYEvw04tFgShwFGDokjSbS W6gQCyhYzVSf5ua9/kZM5dohtT6jWNkWG/Z5QqBtWeN+awiky+io5uNfsfFaHZDjqdtx NaiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:message-id:date:subject:cc:to:from :mime-version:sender:dkim-signature; bh=nK20um8bqFvilFYrODUQ1lVacqSRz1rsYFvVA9berFA=; b=HXBCMAWKbCf8oBRA8a+MzCbScNel+Kf5bu8AmKZKRGtv2DkXAKMhB5ihQKkOuJUj19 nym1uUiFBYvu5+WZLTyLc/tFsnn7ICXIykbMiJLh22yv5/wnDA9A535rXGz/E2n3wb9A DZ7hFHFD6WyDdao6hEPY0gY9+H7lJkqtg1Wzo4r239y88Y7IVYpoF83kApWUFNew6vgJ tdSplTkQ+GOWeiOgTpAdmY/u1yT234v4YCh+bThsUF3hele2AmYSIBds+Fih59mTMb4Q wQvgvjStdbKrRg8WWjEz1h9o2jaArt/a1sS4rr/tndeKv6mVG5gYYgwoUH8FhtyNyOcx 7tOQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=nK20um8bqFvilFYrODUQ1lVacqSRz1rsYFvVA9berFA=; b=f3TcfODz0eluMmL6cHeI9xpV58v/SleoMuZnLWVSnhp41/kbyT8V5EIH/2Sw7plqsJ 0jd1Gi6DpicjXqE4/YBrMZvnr8WN3lkt3nAOrlXZotxtB/FI/+dUEYT6xkZ1I372ft+2 18icKyBSQCcdZKUeEFgQ2SByGI7Hpk8jzU1GPE9wPkBuutaupMntQn0sXosyXqoNUJoo yQU2RGHPUP8C+xF9Q4lkKoObzjutn2GmIa6RZ6x7qxLqTCPpAGK2k6KjeczC4WSJThDj chSZlVngMKjvbPbtpfbheok3fIn/MLVQzmvlMXU+k11I711ZxJJDv+UZeVD3fGxqWp6Z vCXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=nK20um8bqFvilFYrODUQ1lVacqSRz1rsYFvVA9berFA=; b=ZxfIJuBkNVrhGgUkVNPl6qKjzZrpaaHHH8CPNHvyRTlnkz6m9GLJt+ZmpG6foTaF1u ca65ePG95eCRML2v4xqWkbqWmI2YSh7WhgftEmuxGKRE0JHjcMBn8ht85weWdMlRGYM/ 0E3tc86qWAYxwyNoqzIfaPNe5iUQ1bqaHreRUYb/qqFSxuHMJ3b+hnWaC9/XqudhCsiK PzKeax4ASMANZOLe0ExK8xnpJnNsTqe8VvBG/ilQ68JFiXwIC70x7eA/b+d76bjKPxXH cFYu1k4zPOfr/AyCtXiG9P1eeQk6/lFGq1tmZgqbAZIsYllUDiYhDGb4DMYzwY+lGhr7 xNCQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: APjAAAXVVZSr+1rGcDAUGVgHOX5cs7SSdSULEBhC/aBA8YubnlwEKqCq etFTjca2b/R0XfSYiPVzbDE= X-Google-Smtp-Source: APXvYqxWUHNdN/UlZ7WP/BBv5QsJBruTa0tx5kNR+0PzTjnIGxEu33ZGIBAmKqFquH2r6Ww446N4DQ== X-Received: by 2002:a1c:be19:: with SMTP id o25mr29695408wmf.54.1563289271790; Tue, 16 Jul 2019 08:01:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a5d:428f:: with SMTP id k15ls6802388wrq.7.gmail; Tue, 16 Jul 2019 08:01:11 -0700 (PDT) X-Received: by 2002:adf:db46:: with SMTP id f6mr36676715wrj.212.1563289271127; Tue, 16 Jul 2019 08:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563289271; cv=none; d=google.com; s=arc-20160816; b=ZFWIGeXRg4npnafiD1hEgmj13iH7qAjXDlNQWrze4F49QO/bRI4cpYqbnIIhxB6tsv 0wgFFtb9zjqm5Cmyh2CrtwMdYstzu/XHj6CAcuv8WaGUecTs2rIdhk1wAh6h2+goopXU 1eTkEsIMjfWS3TsySeA5CwMLOw7vJY3gXov7mudpYGAPyJ6MJZIrhfJIIaC/YZiaPLOb PIsvK3hnP/u7qPAGDoA5uWA7aLfIXPEhU0Z0qEc4KwSpE1Nf/4e/NTox2DWQuYfx4E58 YvfwEzfhYrevK74Q2sV2fi3wN6o2MZAtGsccx6nQQqDu7lFQBPmTWk8gYudR1KEa9Wb7 yeaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=r2DLqWgnhW6jokP/8Zl0a6WaVIul+XmwfQX/152ydcc=; b=u8zfyleZxwm2b9qiJKdPotW5svgmJIaKCnd9IlLp3tZDOJ2izgQ5I7G7j3bh2k/z4G Aple1vSstsC/g6YsXPtsvv64FIb2QGGM6MQXExS2r8Rb7TbiQmV4EHk0jAGbR3E+bwxq Q/kxTrYicxj/4JD9JlAtJIrWjJZXdct/Tln5lX2hEJU5cuXxAXq3xeB8hPIdz5vjZnf5 1vUoIWwu2YblF2+5h9p0WFYbgmvBoOI+0fVVfPOkCAdHbi7V2YyqVPLxH+navdwYOuTZ eTyHW647ecMPn6jpyfE+F1BzDaDsgiIoK9VH1qDnTeMyLlehXg68rZpfZSnsxJs0Ucdi 8CTg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id s13si1458427wra.1.2019.07.16.08.01.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 08:01:11 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 45p3WB64Shz1rJhX; Tue, 16 Jul 2019 17:01:10 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 45p3WB51X7z1qqkJ; Tue, 16 Jul 2019 17:01:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id qdI-1a_ZxH-t; Tue, 16 Jul 2019 17:01:09 +0200 (CEST) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Tue, 16 Jul 2019 17:01:09 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id AD9734540410; Tue, 16 Jul 2019 17:01:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UlVeIXRCPArs; Tue, 16 Jul 2019 17:01:05 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 5E59645403BB; Tue, 16 Jul 2019 17:01:05 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH] swuforward: drop support for V1 Website Date: Tue, 16 Jul 2019 17:01:03 +0200 Message-Id: <20190716150103.32399-1-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Old version of Website is not suppoerted anymore, drop the test to check the Website on the remote. Signed-off-by: Stefano Babic --- handlers/swuforward_handler.c | 116 ---------------------------------- handlers/swuforward_handler.h | 8 --- 2 files changed, 124 deletions(-) diff --git a/handlers/swuforward_handler.c b/handlers/swuforward_handler.c index bd8afc9..4ddaf35 100644 --- a/handlers/swuforward_handler.c +++ b/handlers/swuforward_handler.c @@ -217,96 +217,6 @@ curl_thread_exit: pthread_exit(NULL); } - -static json_object *parse_reqstatus(json_object *reply, const char **json_path) -{ - json_object *json_data; - - json_data = json_get_path_key(reply, json_path); - if (json_data == NULL) { - ERROR("Got malformed JSON: Could not find path"); - DEBUG("Got JSON: %s", json_object_to_json_string(json_data)); - } - - return json_data; -} - -/* - * Send a GET to retrieve all traces from the connected board - */ -static int get_answer_V1(struct curlconn *conn, RECOVERY_STATUS *result, bool ignore) -{ - channel_data_t channel_cfg = { - .debug = false, - .retries = 0, - .retry_sleep = 0, - .usessl = false}; - channel_t *channel = channel_new(); - json_object *json_data; - int status; - - conn->response = CHANNEL_EIO; - /* - * Open a curl channel, do not connect yet - */ - if (channel->open(channel, &channel_cfg) != CHANNEL_OK) { - return -EIO; - } - - if (asprintf(&channel_cfg.url, "%s%s", - conn->url, STATUS_URL_V1) < 0) { - ERROR("Out of memory."); - return -ENOMEM; - } - - /* Retrieve last message */ - conn->response = channel->get(channel, (void *)&channel_cfg); - - if (conn->response != CHANNEL_OK) { - status = -EIO; - goto cleanup; - } - - /* Retrieve all fields */ - status = -EBADMSG; - if (!(json_data = parse_reqstatus(channel_cfg.json_reply, - (const char *[]){"Status", NULL}))) - goto cleanup; - status = json_object_get_int(json_data); - - if (!(json_data = parse_reqstatus(channel_cfg.json_reply, - (const char *[]){"Msg", NULL}))) - goto cleanup; - const char *msg = json_object_get_string(json_data); - - if (!(json_data = parse_reqstatus(channel_cfg.json_reply, - (const char *[]){"LastResult", NULL}))) - goto cleanup; - int lastResult = json_object_get_int(json_data); - - if (strlen(msg) > 0) - conn->gotMsg = (strlen(msg) > 0) ? true : false; - - if (!ignore) { - if (strlen(msg)) { - TRACE("Update to %s : %s", conn->url, msg); - } - if (status == IDLE) { - TRACE("Update to %s : %s", conn->url, - (lastResult == SUCCESS) ? "SUCCESS !" : "FAILURE"); - } - } - - *result = lastResult; - -cleanup: - free(channel_cfg.url); - channel->close(channel); - free(channel); - - return status; -} - static int retrieve_msgs(struct hnd_priv *priv) { struct curlconn *conn; int ret; @@ -432,32 +342,6 @@ static int install_remote_swu(struct img_type *img, conn->total_bytes = img->size; conn->SWUpdateStatus = IDLE; - /* - * Try to connect to check Webserver Version - * If there is an anwer, but with HTTP=404 - * it is V2 - * Just V2 is supported (TODO: support older versions, too ?) - */ - - ret = get_answer_V1(conn, &conn->SWUpdateStatus, true); - if (ret < 0 && (conn->response == CHANNEL_ENOTFOUND)) { - conn->ver = SWUPDATE_WWW_V2; - } else if (!ret) { - conn->ver = SWUPDATE_WWW_V1; - } else { - ERROR("Remote SWUpdate not answering"); - ret = FAILURE; - goto handler_exit; - } - TRACE("Found remote server V%d", - conn->ver == SWUPDATE_WWW_V2 ? SWUPDATE_WWW_V2 : SWUPDATE_WWW_V1); - - if (conn->ver == SWUPDATE_WWW_V1) { - ERROR("FAULT: there is no support for older website"); - ret = FAILURE; - goto handler_exit; - } - /* * Create one FIFO for each connection to be thread safe */ diff --git a/handlers/swuforward_handler.h b/handlers/swuforward_handler.h index f770ca0..865fabf 100644 --- a/handlers/swuforward_handler.h +++ b/handlers/swuforward_handler.h @@ -19,9 +19,7 @@ */ #define CUSTOM_HEADER "X_FILENAME: " #define MAX_WAIT_MS 3000 -#define POST_URL_V1 "/handle_post_request" #define POST_URL_V2 "/upload" -#define STATUS_URL_V1 "/getstatus.json" /* * The handler checks if a remote update was successful @@ -33,11 +31,6 @@ #define TIMEOUT_GET_ANSWER_SEC 900 /* 15 minutes */ #define POLLING_TIME_REQ_STATUS 50 /* in mSec */ -typedef enum { - SWUPDATE_WWW_V1 = 1, - SWUPDATE_WWW_V2 = 2, -} SWUPDATE_WEB_VER; - typedef enum { WS_UNKNOWN, WS_ESTABLISHED, @@ -59,7 +52,6 @@ struct curlconn { size_t total_bytes; /* size of SWU image */ int fifo[2]; /* Pipe for IPC */ char *url; /* URL for forwarding */ - SWUPDATE_WEB_VER ver; /* version of remote Webserver (V1 or V2) */ bool gotMsg; /* set if the remote board has sent a new msg */ RECOVERY_STATUS SWUpdateStatus; /* final status of update */ channel_op_res_t response;