From: Stephen Hemminger <shemminger@vyatta.com>
To: Petr Lautrbach <plautrba@redhat.com>
Cc: shemminger@osdl.org, netdev@vger.kernel.org
Subject: Re: [PATCH] iproute: fix tc generating ipv6 priority filter
Date: Fri, 23 Jul 2010 13:21:30 -0700 [thread overview]
Message-ID: <20100723132130.5be76830@nehalam> (raw)
In-Reply-To: <1276522588-23727-1-git-send-email-plautrba@redhat.com>
On Mon, 14 Jun 2010 15:36:28 +0200
Petr Lautrbach <plautrba@redhat.com> wrote:
> This patch adds ipv6 filter priority/traffic class function
> static int parse_ip6_class(int *argc_p, char ***argv_p, struct tc_u32_sel *sel)
> shifting filter value to 5th bit and ignoring "at" as header position
> is exactly given.
>
> Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
> ---
> Hello,
>
> According to [1], tc doesn't generate right filters for IPv6
> "priority".
>
> Priority or Traffic Classes is 8 bits starting at 5th bit
> based on RFC 2460 [2]. There is parse_u8(&argc, &argv, sel, 4, 0)
> function used in current version, which shifts filter by 4 bytes
> instead of 4 bits.
>
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=584913
> [2] http://www.faqs.org/rfcs/rfc2460.html
>
> tc/f_u32.c | 39 ++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 38 insertions(+), 1 deletions(-)
>
> diff --git a/tc/f_u32.c b/tc/f_u32.c
> index 4f5f74e..31e13b5 100644
> --- a/tc/f_u32.c
> +++ b/tc/f_u32.c
> @@ -403,6 +403,43 @@ static int parse_ip6_addr(int *argc_p, char ***argv_p,
> return res;
> }
>
> +static int parse_ip6_class(int *argc_p, char ***argv_p, struct tc_u32_sel *sel)
> +{
> + int res = -1;
> + int argc = *argc_p;
> + char **argv = *argv_p;
> + __u32 key;
> + __u32 mask;
> + int off = 0;
> + int offmask = 0;
> +
> + if (argc < 2)
> + return -1;
> +
> + if (get_u32(&key, *argv, 0))
> + return -1;
> + argc--; argv++;
> +
> + if (get_u32(&mask, *argv, 16))
> + return -1;
> + argc--; argv++;
> +
> + if (key > 0xFF || mask > 0xFF)
> + return -1;
> +
> + key <<= 20;
> + mask <<= 20;
> + key = htonl(key);
> + mask = htonl(mask);
> +
> + if (res = pack_key(sel, key, mask, off, offmask) < 0)
> + return -1;
> +
> + *argc_p = argc;
> + *argv_p = argv;
> + return 0;
> +}
> +
> static int parse_ether_addr(int *argc_p, char ***argv_p,
> struct tc_u32_sel *sel, int off)
> {
> @@ -522,7 +559,7 @@ static int parse_ip6(int *argc_p, char ***argv_p, struct tc_u32_sel *sel)
> res = parse_ip6_addr(&argc, &argv, sel, 24);
> } else if (strcmp(*argv, "priority") == 0) {
> NEXT_ARG();
> - res = parse_u8(&argc, &argv, sel, 4, 0);
> + res = parse_ip6_class(&argc, &argv, sel);
> } else if (strcmp(*argv, "protocol") == 0) {
> NEXT_ARG();
> res = parse_u8(&argc, &argv, sel, 6, 0);
Applied
--
prev parent reply other threads:[~2010-07-23 20:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-14 13:36 [PATCH] iproute: fix tc generating ipv6 priority filter Petr Lautrbach
2010-07-23 20:21 ` Stephen Hemminger [this message]
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=20100723132130.5be76830@nehalam \
--to=shemminger@vyatta.com \
--cc=netdev@vger.kernel.org \
--cc=plautrba@redhat.com \
--cc=shemminger@osdl.org \
/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