lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 26 Oct 2008 20:33:11 +0100
From:	Johannes Berg <johannes@...solutions.net>
To:	Harvey Harrison <harvey.harrison@...il.com>
Cc:	David Miller <davem@...emloft.net>, anders@...uras.de,
	netdev@...r.kernel.org
Subject: Re: [PATCH] add %pM printf format specifier

On Sun, 2008-10-26 at 12:01 -0700, Harvey Harrison wrote:
> On Sun, 2008-10-26 at 09:30 +0100, Johannes Berg wrote:
> > static char *ip6_string(char *buf, char *end, be16 *addr, int field_width, int precision, int flags)
> > {
> > 	char ip6[8*5];
> > 	char *p = ip6;
> > 	int i;
> > 	u16 tmp;
> > 
> > 	for (i=0; i<7; i++) {
> > 		tmp = cpu_to_le16(addr[i]);
> 
> 		tmp = be16_to_cpup(addr + i);
> 
> > 		p = pack_hex_byte(p, tmp >> 8);
> > 		p = pack_hex_byte(p, tmp & 0xFF);
> > 		if (!(flags & SPECIAL))
> > 			*p++ = ':';
> > 	}
> > 	tmp = cpu_to_le16(addr[7]);
> 
> 	tmp = be16_to_cpup(addr + 7);
> 
> Or maybe just cast addr to char * and avoid the byteswapping altogether.

Yeah, this was obviously not tested. Want to build it? I don't have
access to a fast build machine right now.

johannes

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ