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]
Message-Id: <20071117.025708.29947074.yoshfuji@linux-ipv6.org>
Date:	Sat, 17 Nov 2007 02:57:08 +0900 (JST)
From:	YOSHIFUJI Hideaki / 吉藤英明 
	<yoshfuji@...ux-ipv6.org>
To:	penguin-kernel@...ove.SAKURA.ne.jp
Cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	linux-security-module@...r.kernel.org, takedakn@...data.co.jp,
	yoshfuji@...ux-ipv6.org
Subject: Re: [TOMOYO #5 11/18] Network access control functions.

Hello.

In article <20071116173527.282964575@...ove.SAKURA.ne.jp> (at Sat, 17 Nov 2007 02:34:50 +0900), penguin-kernel@...ove.SAKURA.ne.jp says:

> +	*cp++ = '\0';
> +	count = sscanf(cp,
> +		       NIP6_FMT "-" NIP6_FMT,
> +		       &min[0], &min[1], &min[2], &min[3],
> +		       &min[4], &min[5], &min[6], &min[7],
> +		       &max[0], &max[1], &max[2], &max[3],
> +		       &max[4], &max[5], &max[6], &max[7]);
> +

I think you can use in6_pton() here.

> +	count = sscanf(cp,
> +		       NIPQUAD_FMT "-" NIPQUAD_FMT,
> +		       &min[0], &min[1],
> +		       &min[2], &min[3],
> +		       &max[0], &max[1],
> +		       &max[2], &max[3]);
> +

in4_pton().

> +
> +/**
> + * tmy_print_ipv6 - print ipv6 address
> + * @buffer:     pointer to buffer to save the result.
> + * @buffer_len: sizeof @buffer .
> + * @ip:         pointer to an IPv6 address in network byte order.
> + *
> + * Returns @buffer .
> + */
> +char *tmy_print_ipv6(char *buffer, const int buffer_len, const u16 *ip)
> +{
> +	memset(buffer, 0, buffer_len);
> +	snprintf(buffer, buffer_len - 1, NIP6_FMT,
> +		 ntohs(ip[0]), ntohs(ip[1]), ntohs(ip[2]), ntohs(ip[3]),
> +		 ntohs(ip[4]), ntohs(ip[5]), ntohs(ip[6]), ntohs(ip[7]));
> +	return buffer;
> +}
> +

snprintf(buffer, buffer_len - 1, NIP6_FMT, NIP6(*(struct in6_addr *)ip));

> +	count = sscanf(cp2,
> +		       NIP6_FMT "-" NIP6_FMT,
> +		       &min[0], &min[1], &min[2], &min[3],
> +		       &min[4], &min[5], &min[6], &min[7],
> +		       &max[0], &max[1], &max[2], &max[3],
> +		       &max[4], &max[5], &max[6], &max[7]);
> +

again, in6_pton().

> +	count = sscanf(cp2,
> +		       NIPQUAD_FMT "-" NIPQUAD_FMT,
> +		       &min[0], &min[1], &min[2], &min[3],
> +		       &max[0], &max[1], &max[2], &max[3]);
> +

in4_pton().

--yoshfuji
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ