Network order or Host order for raw xlat style

Dmitry V. Levin ldv at altlinux.org
Fri Jan 4 22:38:41 UTC 2019


Hi,

On Thu, Jan 03, 2019 at 11:13:39PM -0800, shankarapailoor wrote:
> Hi again,
> 
> I've added support to properly handle xlat styles when decoding both
> sockaddr_in6 (sin6_port, sin6_addr, sin6_flowinfo) as well as
> sockaddr_in (sin_port, sin_addr). I merged the two into one patch
> which is attached. Let me know what you all think!

Thanks,

[...]
> diff --git a/print_fields.h b/print_fields.h
> index bcab1b73..05be8389 100644
> --- a/print_fields.h
> +++ b/print_fields.h
> @@ -159,9 +159,28 @@
>  				sizeof((where_).field_), #field_);	\
>  	} while (0)
>  
> -# define PRINT_FIELD_INET4_ADDR(prefix_, where_, field_)			\
> -	STRACE_PRINTF("%s%s=inet_addr(\"%s\")", (prefix_), #field_,	\
> -		      inet_ntoa((where_).field_))
> +#define PRINT_FIELD_INET4_ADDR(prefix_, where_, field_)			\
> +	do {								\
> +		if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW) {	\
> +			STRACE_PRINTF("%s%s=%#x",			\
> +					(prefix_), #field_,		\
> +					ntohl((where_).field_.s_addr));	\

Why do you print s_addr converted to host order?
If I understand correctly, XLAT_STYLE_RAW is expected to print values as is.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20190105/657b36de/attachment.bin>


More information about the Strace-devel mailing list