From patchwork Wed Apr 23 09:00:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 341731 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 776271400CF for ; Wed, 23 Apr 2014 19:00:50 +1000 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Wct2t-0000Z0-F1; Wed, 23 Apr 2014 09:00:47 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Wct2n-0000Yu-IS for fwts-devel@lists.ubuntu.com; Wed, 23 Apr 2014 09:00:41 +0000 Received: from [175.41.48.77] (helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Wct2m-0002t8-Mo; Wed, 23 Apr 2014 09:00:41 +0000 From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH] uefi: uefidump: dumping the new definitions for ipv4 ipv6 device path (LP: #1311538) Date: Wed, 23 Apr 2014 17:00:34 +0800 Message-Id: <1398243634-25182-1-git-send-email-ivan.hu@canonical.com> X-Mailer: git-send-email 1.7.9.5 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: fwts-devel-bounces@lists.ubuntu.com The definitions, GatewayIPAddress, Subnet Mask have been added to Ipv4 device path structure and PrefixLength, GatewayIPAddress have been added to Ipv6 device path structure on UEFI spec 2.3. Add to dump these information on uefidump tool. This patch also fix the woring dumping size for ipv6 device path. Signed-off-by: Ivan Hu --- src/lib/include/fwts_uefi.h | 4 ++++ src/uefi/uefidump/uefidump.c | 29 +++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/lib/include/fwts_uefi.h b/src/lib/include/fwts_uefi.h index da4556e..9d653a5 100644 --- a/src/lib/include/fwts_uefi.h +++ b/src/lib/include/fwts_uefi.h @@ -362,6 +362,8 @@ typedef struct { uint16_t remote_port; uint16_t protocol; uint8_t static_ip_address; + fwts_uefi_ipv4_addr gateway_ip_addr; + fwts_uefi_ipv4_addr subnet_mask; } __attribute__((packed)) fwts_uefi_ipv4_dev_path; typedef struct { @@ -372,6 +374,8 @@ typedef struct { uint16_t remote_port; uint16_t protocol; uint8_t static_ip_address; + uint8_t prefix_length; + fwts_uefi_ipv6_addr gateway_ip_addr; } __attribute__((packed)) fwts_uefi_ipv6_dev_path; typedef struct { diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c index e17731f..e885718 100644 --- a/src/uefi/uefidump/uefidump.c +++ b/src/uefi/uefidump/uefidump.c @@ -277,24 +277,32 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c path = uefidump_vprintf(path, "\\IPv4(" "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "," "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "," - "%" PRIu16 ",%" PRIu16 ",%" PRIx16 ",%" PRIx8 ")", + "%" PRIu16 ",%" PRIu16 ",%" PRIx16 ",%" PRIx8 "," + "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "," + "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 ")", i->local_ip_addr[0], i->local_ip_addr[1], i->local_ip_addr[2], i->local_ip_addr[3], i->remote_ip_addr[0], i->remote_ip_addr[1], i->remote_ip_addr[2], i->remote_ip_addr[3], i->local_port, i->remote_port, - i->protocol, i->static_ip_address); + i->protocol, i->static_ip_address, + i->gateway_ip_addr[0], i->gateway_ip_addr[1], + i->gateway_ip_addr[2], i->gateway_ip_addr[3], + i->subnet_mask[0], i->subnet_mask[1], + i->subnet_mask[2], i->subnet_mask[3]); } break; case FWTS_UEFI_IPV6_DEVICE_PATH_SUBTYPE: if (dev_path_len >= sizeof(fwts_uefi_ipv6_dev_path)) { fwts_uefi_ipv6_dev_path *i = (fwts_uefi_ipv6_dev_path*)dev_path; path = uefidump_vprintf(path, "\\IPv6(" - "%" PRIx8 ":%" PRIx8 ":%" PRIx8 ":%" PRIx8 - ":%" PRIx8 ":%" PRIx8 ":%" PRIx8 ":%" PRIx8 "," - "%" PRIx8 ":%" PRIx8 ":%" PRIx8 ":%" PRIx8 - ":%" PRIx8 ":%" PRIx8 ":%" PRIx8 ":%" PRIx8 "," - "%" PRIu16 ",%" PRIu16 ",%" PRIx16 ",%" PRIx8 ")", + "%" PRIx16 ":%" PRIx16 ":%" PRIx16 ":%" PRIx16 + ":%" PRIx16 ":%" PRIx16 ":%" PRIx16 ":%" PRIx16 "," + "%" PRIx16 ":%" PRIx16 ":%" PRIx16 ":%" PRIx16 + ":%" PRIx16 ":%" PRIx16 ":%" PRIx16 ":%" PRIx16 "," + "%" PRIu16 ",%" PRIu16 ",%" PRIx16 ",%" PRIx8 "," "%" PRIu8 "," + "%" PRIx16 ":%" PRIx16 ":%" PRIx16 ":%" PRIx16 + ":%" PRIx16 ":%" PRIx16 ":%" PRIx16 ":%" PRIx16 ")", i->local_ip_addr[0], i->local_ip_addr[1], i->local_ip_addr[2], i->local_ip_addr[3], i->local_ip_addr[4], i->local_ip_addr[5], @@ -304,7 +312,12 @@ static char *uefidump_build_dev_path(char *path, fwts_uefi_dev_path *dev_path, c i->remote_ip_addr[4], i->remote_ip_addr[5], i->remote_ip_addr[6], i->remote_ip_addr[7], i->local_port, i->remote_port, - i->protocol, i->static_ip_address); + i->protocol, i->static_ip_address, + i->prefix_length, + i->gateway_ip_addr[0], i->gateway_ip_addr[1], + i->gateway_ip_addr[2], i->gateway_ip_addr[3], + i->gateway_ip_addr[4], i->gateway_ip_addr[5], + i->gateway_ip_addr[6], i->gateway_ip_addr[7]); } break; case FWTS_UEFI_INFINIBAND_DEVICE_PATH_SUBTYPE: