* [PATCH iproute2] tc: fix ipv6 filter selector attribute for some prefix lengths @ 2017-09-25 18:12 Yulia Kartseva 2017-09-27 8:26 ` Stephen Hemminger 0 siblings, 1 reply; 5+ messages in thread From: Yulia Kartseva @ 2017-09-25 18:12 UTC (permalink / raw) To: netdev; +Cc: shemminger Wrong TCA_U32_SEL attribute packing if prefixLen AND 0x1f equals 0x1f. These are /31, /63, /95 and /127 prefix lengths. Example: # tc filter add dev eth0 protocol ipv6 parent b: prio 2307 u32 match ip6 dst face:b00f::/31 # tc filter show dev eth0 filter parent b: protocol ipv6 pref 2307 u32 filter parent b: protocol ipv6 pref 2307 u32 fh 800: ht divisor 1 filter parent b: protocol ipv6 pref 2307 u32 fh 800::800 order 2048 key ht 800 bkt 0 match faceb00f/ffffffff at 24 The correct match would be "faceb00e/fffffffe": don't count the last bit of the 4th byte as the network prefix. With fix: # tc filter show dev eth0 filter parent b: protocol ipv6 pref 2307 u32 filter parent b: protocol ipv6 pref 2307 u32 fh 800: ht divisor 1 filter parent b: protocol ipv6 pref 2307 u32 fh 800::800 order 2048 key ht 800 bkt 0 match faceb00e/fffffffe at 24 tc/f_u32.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tc/f_u32.c b/tc/f_u32.c index 5815be9..14b9588 100644 --- a/tc/f_u32.c +++ b/tc/f_u32.c @@ -385,8 +385,7 @@ static int parse_ip6_addr(int *argc_p, char ***argv_p, plen = addr.bitlen; for (i = 0; i < plen; i += 32) { - /* if (((i + 31) & ~0x1F) <= plen) { */ - if (i + 31 <= plen) { + if (i + 31 < plen) { res = pack_key(sel, addr.data[i / 32], 0xFFFFFFFF, off + 4 * (i / 32), offmask); if (res < 0) ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] tc: fix ipv6 filter selector attribute for some prefix lengths 2017-09-25 18:12 [PATCH iproute2] tc: fix ipv6 filter selector attribute for some prefix lengths Yulia Kartseva @ 2017-09-27 8:26 ` Stephen Hemminger 2017-09-28 3:47 ` Yulia Kartseva 2017-10-01 3:18 ` [PATCH v2 " Yulia Kartseva 0 siblings, 2 replies; 5+ messages in thread From: Stephen Hemminger @ 2017-09-27 8:26 UTC (permalink / raw) To: Yulia Kartseva; +Cc: netdev, shemminger On Mon, 25 Sep 2017 11:12:38 -0700 Yulia Kartseva <yulia.kartseva@gmail.com> wrote: > Wrong TCA_U32_SEL attribute packing if prefixLen AND 0x1f equals 0x1f. > These are /31, /63, /95 and /127 prefix lengths. > > Example: > # tc filter add dev eth0 protocol ipv6 parent b: prio 2307 u32 match > ip6 dst face:b00f::/31 > # tc filter show dev eth0 > filter parent b: protocol ipv6 pref 2307 u32 > filter parent b: protocol ipv6 pref 2307 u32 fh 800: ht divisor 1 > filter parent b: protocol ipv6 pref 2307 u32 fh 800::800 order 2048 > key ht 800 bkt 0 > match faceb00f/ffffffff at 24 > > > The correct match would be "faceb00e/fffffffe": don't count the last > bit of the 4th byte as the network prefix. With fix: > > # tc filter show dev eth0 > filter parent b: protocol ipv6 pref 2307 u32 > filter parent b: protocol ipv6 pref 2307 u32 fh 800: ht divisor 1 > filter parent b: protocol ipv6 pref 2307 u32 fh 800::800 order 2048 > key ht 800 bkt 0 > match faceb00e/fffffffe at 24 > > tc/f_u32.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/tc/f_u32.c b/tc/f_u32.c > index 5815be9..14b9588 100644 > --- a/tc/f_u32.c > +++ b/tc/f_u32.c > @@ -385,8 +385,7 @@ static int parse_ip6_addr(int *argc_p, char ***argv_p, > > plen = addr.bitlen; > for (i = 0; i < plen; i += 32) { > - /* if (((i + 31) & ~0x1F) <= plen) { */ > - if (i + 31 <= plen) { > + if (i + 31 < plen) { > res = pack_key(sel, addr.data[i / 32], > 0xFFFFFFFF, off + 4 * (i / 32), offmask); > if (res < 0) This patch looks correct, but will not apply cleanly because the mail system that you submitted it with is removing whitespace. If possible use a different client, or send as an attachment. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] tc: fix ipv6 filter selector attribute for some prefix lengths 2017-09-27 8:26 ` Stephen Hemminger @ 2017-09-28 3:47 ` Yulia Kartseva 2017-10-01 3:18 ` [PATCH v2 " Yulia Kartseva 1 sibling, 0 replies; 5+ messages in thread From: Yulia Kartseva @ 2017-09-28 3:47 UTC (permalink / raw) To: Stephen Hemminger, netdev [-- Attachment #1: Type: text/plain, Size: 1999 bytes --] Hello Stephen, Sending as an attachment. Thank you! On Wed, Sep 27, 2017 at 1:26 AM, Stephen Hemminger <stephen@networkplumber.org> wrote: > On Mon, 25 Sep 2017 11:12:38 -0700 > Yulia Kartseva <yulia.kartseva@gmail.com> wrote: > >> Wrong TCA_U32_SEL attribute packing if prefixLen AND 0x1f equals 0x1f. >> These are /31, /63, /95 and /127 prefix lengths. >> >> Example: >> # tc filter add dev eth0 protocol ipv6 parent b: prio 2307 u32 match >> ip6 dst face:b00f::/31 >> # tc filter show dev eth0 >> filter parent b: protocol ipv6 pref 2307 u32 >> filter parent b: protocol ipv6 pref 2307 u32 fh 800: ht divisor 1 >> filter parent b: protocol ipv6 pref 2307 u32 fh 800::800 order 2048 >> key ht 800 bkt 0 >> match faceb00f/ffffffff at 24 >> >> >> The correct match would be "faceb00e/fffffffe": don't count the last >> bit of the 4th byte as the network prefix. With fix: >> >> # tc filter show dev eth0 >> filter parent b: protocol ipv6 pref 2307 u32 >> filter parent b: protocol ipv6 pref 2307 u32 fh 800: ht divisor 1 >> filter parent b: protocol ipv6 pref 2307 u32 fh 800::800 order 2048 >> key ht 800 bkt 0 >> match faceb00e/fffffffe at 24 >> >> tc/f_u32.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/tc/f_u32.c b/tc/f_u32.c >> index 5815be9..14b9588 100644 >> --- a/tc/f_u32.c >> +++ b/tc/f_u32.c >> @@ -385,8 +385,7 @@ static int parse_ip6_addr(int *argc_p, char ***argv_p, >> >> plen = addr.bitlen; >> for (i = 0; i < plen; i += 32) { >> - /* if (((i + 31) & ~0x1F) <= plen) { */ >> - if (i + 31 <= plen) { >> + if (i + 31 < plen) { >> res = pack_key(sel, addr.data[i / 32], >> 0xFFFFFFFF, off + 4 * (i / 32), offmask); >> if (res < 0) > > This patch looks correct, but will not apply cleanly because > the mail system that you submitted it with is removing whitespace. > If possible use a different client, or send as an attachment. > -- C уважением, Юлия [-- Attachment #2: f_u32.c.patch --] [-- Type: application/octet-stream, Size: 417 bytes --] diff --git a/tc/f_u32.c b/tc/f_u32.c index 479b3f1..a8d07b3 100644 --- a/tc/f_u32.c +++ b/tc/f_u32.c @@ -382,8 +382,7 @@ static int parse_ip6_addr(int *argc_p, char ***argv_p, plen = addr.bitlen; for (i=0; i<plen; i+=32) { -// if (((i+31)&~0x1F)<=plen) { - if (i + 31 <= plen) { + if (i + 31 < plen) { res = pack_key(sel, addr.data[i/32], 0xFFFFFFFF, off+4*(i/32), offmask); if (res < 0) ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 iproute2] tc: fix ipv6 filter selector attribute for some prefix lengths 2017-09-27 8:26 ` Stephen Hemminger 2017-09-28 3:47 ` Yulia Kartseva @ 2017-10-01 3:18 ` Yulia Kartseva 2017-10-01 20:42 ` Stephen Hemminger 1 sibling, 1 reply; 5+ messages in thread From: Yulia Kartseva @ 2017-10-01 3:18 UTC (permalink / raw) To: stephen; +Cc: netdev, yulia.kartseva, hex Wrong TCA_U32_SEL attribute packing if prefixLen AND 0x1f equals 0x1f. These are /31, /63, /95 and /127 prefix lengths. Example: ip6 dst face:b00f::/31 filter parent b: protocol ipv6 pref 2307 u32 filter parent b: protocol ipv6 pref 2307 u32 fh 800: ht divisor 1 filter parent b: protocol ipv6 pref 2307 u32 fh 800::800 order 2048 key ht 800 bkt 0 match faceb00f/ffffffff at 24 v2: previous patch was made with a wrong repo Signed-off-by: Yulia Kartseva <hex@fb.com> --- tc/f_u32.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tc/f_u32.c b/tc/f_u32.c index 5815be9..14b9588 100644 --- a/tc/f_u32.c +++ b/tc/f_u32.c @@ -385,8 +385,7 @@ static int parse_ip6_addr(int *argc_p, char ***argv_p, plen = addr.bitlen; for (i = 0; i < plen; i += 32) { - /* if (((i + 31) & ~0x1F) <= plen) { */ - if (i + 31 <= plen) { + if (i + 31 < plen) { res = pack_key(sel, addr.data[i / 32], 0xFFFFFFFF, off + 4 * (i / 32), offmask); if (res < 0) -- 2.9.5 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 iproute2] tc: fix ipv6 filter selector attribute for some prefix lengths 2017-10-01 3:18 ` [PATCH v2 " Yulia Kartseva @ 2017-10-01 20:42 ` Stephen Hemminger 0 siblings, 0 replies; 5+ messages in thread From: Stephen Hemminger @ 2017-10-01 20:42 UTC (permalink / raw) To: Yulia Kartseva; +Cc: netdev, yulia.kartseva On Sat, 30 Sep 2017 20:18:40 -0700 Yulia Kartseva <hex@fb.com> wrote: > Wrong TCA_U32_SEL attribute packing if prefixLen AND 0x1f equals 0x1f. > These are /31, /63, /95 and /127 prefix lengths. > > Example: > ip6 dst face:b00f::/31 > filter parent b: protocol ipv6 pref 2307 u32 > filter parent b: protocol ipv6 pref 2307 u32 fh 800: ht divisor 1 > filter parent b: protocol ipv6 pref 2307 u32 fh 800::800 order 2048 > key ht 800 bkt 0 > match faceb00f/ffffffff at 24 > > v2: previous patch was made with a wrong repo > > Signed-off-by: Yulia Kartseva <hex@fb.com> That came through correctly. Applied. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-01 20:42 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-09-25 18:12 [PATCH iproute2] tc: fix ipv6 filter selector attribute for some prefix lengths Yulia Kartseva 2017-09-27 8:26 ` Stephen Hemminger 2017-09-28 3:47 ` Yulia Kartseva 2017-10-01 3:18 ` [PATCH v2 " Yulia Kartseva 2017-10-01 20:42 ` Stephen Hemminger
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).