[PATCH] uefi: uefidump: dumping the new definitions for ipv4 ipv6 device path (LP: #1311538)

Colin Ian King colin.king at canonical.com
Wed Apr 23 09:20:09 UTC 2014


On 23/04/14 10:00, Ivan Hu wrote:
> 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.

If these are new fields added to these structures how do we handle
firmware without these fields?


> 
> This patch also fix the woring dumping size for ipv6 device path.
> 
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>  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:
> 




More information about the fwts-devel mailing list