mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
To: penguin-kernel@I-love.SAKURA.ne.jp
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, takedakn@nttdata.co.jp,
	yoshfuji@linux-ipv6.org
Subject: Re: [TOMOYO #5 11/18] Network access control functions.
Date: Sat, 17 Nov 2007 02:57:08 +0900 (JST)	[thread overview]
Message-ID: <20071117.025708.29947074.yoshfuji@linux-ipv6.org> (raw)
In-Reply-To: <20071116173527.282964575@I-love.SAKURA.ne.jp>

Hello.

In article <20071116173527.282964575@I-love.SAKURA.ne.jp> (at Sat, 17 Nov 2007 02:34:50 +0900), penguin-kernel@I-love.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

  reply	other threads:[~2007-11-16 17:57 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-16 17:34 [TOMOYO #5 00/18] TOMOYO Linux - MAC based on process invocation history penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 01/18] Add struct vfsmount to struct task_struct penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 02/18] Add wrapper functions for VFS helper functions penguin-kernel
2007-11-16 17:47   ` Trond Myklebust
2007-11-16 18:20     ` [TOMOYO #5 02/18] Add wrapper functions for VFS helperfunctions Tetsuo Handa
2007-11-16 18:33       ` Trond Myklebust
2007-11-17  4:04         ` [TOMOYO #5 02/18] Add wrapper functions for VFShelperfunctions Tetsuo Handa
2007-11-17  4:46           ` Trond Myklebust
2007-11-17  5:23             ` Tetsuo Handa
2007-11-19 12:53     ` [TOMOYO #5 02/18] Add wrapper functions for VFS helper functions Christoph Hellwig
2007-11-19 13:18       ` Tetsuo Handa
2007-11-16 17:34 ` [TOMOYO #5 03/18] Replace VFS with wrapper functions penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 04/18] Data structures and prototype defitions penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 05/18] Memory and pathname management functions penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 06/18] Utility functions and policy manipulation interface penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 07/18] Domain transition functions penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 08/18] Auditing interface penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 09/18] File access control functions penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 10/18] argv0 check functions penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 11/18] Network access control functions penguin-kernel
2007-11-16 17:57   ` YOSHIFUJI Hideaki / 吉藤英明 [this message]
2007-11-16 18:22     ` Tetsuo Handa
2007-11-16 17:34 ` [TOMOYO #5 12/18] Namespace manipulation " penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 13/18] Signal " penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 14/18] Capability access " penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 15/18] LSM adapter functions penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 16/18] Conditional permission support penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 17/18] Kconfig and Makefile penguin-kernel
2007-11-16 17:34 ` [TOMOYO #5 18/18] LSM expansion for TOMOYO Linux penguin-kernel
2007-11-16 19:23   ` Paul Moore
2007-11-17  3:45     ` Tetsuo Handa
2007-11-17 23:09       ` Paul Moore
2007-11-18  4:00         ` Tetsuo Handa
2007-11-19 13:36           ` Paul Moore
2007-11-19 14:29             ` Tetsuo Handa
2007-11-19 15:39               ` Paul Moore
2007-11-20  0:04                 ` Tetsuo Handa
2007-11-20  0:52                   ` James Morris
2007-11-20  4:50                     ` [PATCH] Add packet filtering based on process\'s security context Tetsuo Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071117.025708.29947074.yoshfuji@linux-ipv6.org \
    --to=yoshfuji@linux-ipv6.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=takedakn@nttdata.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®