* [PATCH] allow DSCP values in ip rulesB
@ 2018-11-14 14:30 Pavel Balaev
2018-11-15 14:59 ` [PATCH] allow DSCP values in ip rules Pavel Balaev
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Pavel Balaev @ 2018-11-14 14:30 UTC (permalink / raw)
To: netdev
Hello, for now IP rules supports only old TOS values and we cannot use
DSCP.
This patch adds support for DSCP values in IP rules:
$ ip r add default via 192.168.0.6 table test
$ ip ru add tos 0x80 table test
$ ip ru
0: from all lookup local
32764: from all tos CS4 lookup test
32766: from all lookup main
32767: from all lookup default
$ ip r get fibmatch 8.8.8.9 tos 0x80
default tos CS4 via 192.168.0.6 dev lan table test
Signed-off-by: Pavel Balaev <mail@void.so>
---
net/ipv4/fib_rules.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index f8eb78d0..7a6c5bfe 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -220,7 +220,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
int err = -EINVAL;
struct fib4_rule *rule4 = (struct fib4_rule *) rule;
- if (frh->tos & ~IPTOS_TOS_MASK) {
+ if (frh->tos & ~(IPTOS_TOS_MASK | IPTOS_PREC_MASK)) {
NL_SET_ERR_MSG(extack, "Invalid tos");
goto errout;
}
--
2.18.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] allow DSCP values in ip rules
2018-11-14 14:30 [PATCH] allow DSCP values in ip rulesB Pavel Balaev
@ 2018-11-15 14:59 ` Pavel Balaev
2018-11-15 15:04 ` Pavel Balaev
2018-11-17 4:29 ` [PATCH] allow DSCP values in ip rulesB David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Pavel Balaev @ 2018-11-15 14:59 UTC (permalink / raw)
To: netdev
On Wed, Nov 14, 2018 at 05:30:37PM +0300, Pavel Balaev wrote:
> Hello, for now IP rules supports only old TOS values and we cannot use
> DSCP.
>
> This patch adds support for DSCP values in IP rules:
>
> $ ip r add default via 192.168.0.6 table test
> $ ip ru add tos 0x80 table test
> $ ip ru
> 0: from all lookup local
> 32764: from all tos CS4 lookup test
> 32766: from all lookup main
> 32767: from all lookup default
> $ ip r get fibmatch 8.8.8.9 tos 0x80
> default tos CS4 via 192.168.0.6 dev lan table test
>
> Signed-off-by: Pavel Balaev <mail@void.so>
> ---
> net/ipv4/fib_rules.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
> index f8eb78d0..7a6c5bfe 100644
> --- a/net/ipv4/fib_rules.c
> +++ b/net/ipv4/fib_rules.c
> @@ -220,7 +220,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
> int err = -EINVAL;
> struct fib4_rule *rule4 = (struct fib4_rule *) rule;
>
> - if (frh->tos & ~IPTOS_TOS_MASK) {
> + if (frh->tos & ~(IPTOS_TOS_MASK | IPTOS_PREC_MASK)) {
> NL_SET_ERR_MSG(extack, "Invalid tos");
> goto errout;
> }
> --
> 2.18.1
>
In addition. This patch adds ability to set newer RFC2597 values. They
also presents in /etc/iproute2/rt_dsfield:
# Newer RFC2597 values
0x28 AF11
0x30 AF12
0x38 AF13
0x48 AF21
....
If one tries to apply this values with iproure2 (ip rule add tos 0x28
...) he will get error from netlink: "Invalid tos" for this moment.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] allow DSCP values in ip rules
2018-11-14 14:30 [PATCH] allow DSCP values in ip rulesB Pavel Balaev
2018-11-15 14:59 ` [PATCH] allow DSCP values in ip rules Pavel Balaev
@ 2018-11-15 15:04 ` Pavel Balaev
2018-11-17 4:29 ` [PATCH] allow DSCP values in ip rulesB David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Pavel Balaev @ 2018-11-15 15:04 UTC (permalink / raw)
To: netdev
On Wed, Nov 14, 2018 at 05:30:37PM +0300, Pavel Balaev wrote:
> Hello, for now IP rules supports only old TOS values and we cannot use
> DSCP.
>
> This patch adds support for DSCP values in IP rules:
>
> $ ip r add default via 192.168.0.6 table test
> $ ip ru add tos 0x80 table test
> $ ip ru
> 0: from all lookup local
> 32764: from all tos CS4 lookup test
> 32766: from all lookup main
> 32767: from all lookup default
> $ ip r get fibmatch 8.8.8.9 tos 0x80
> default tos CS4 via 192.168.0.6 dev lan table test
>
> Signed-off-by: Pavel Balaev <mail@void.so>
> ---
> net/ipv4/fib_rules.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
> index f8eb78d0..7a6c5bfe 100644
> --- a/net/ipv4/fib_rules.c
> +++ b/net/ipv4/fib_rules.c
> @@ -220,7 +220,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
> int err = -EINVAL;
> struct fib4_rule *rule4 = (struct fib4_rule *) rule;
>
> - if (frh->tos & ~IPTOS_TOS_MASK) {
> + if (frh->tos & ~(IPTOS_TOS_MASK | IPTOS_PREC_MASK)) {
> NL_SET_ERR_MSG(extack, "Invalid tos");
> goto errout;
> }
> --
> 2.18.1
>
This patch adds ability to set newer RFC2597 values, they also presents
in /etc/iproute2/rt_dsfield:
0x28 AF11
0x30 AF12
0x38 AF13
0x48 AF21
...
If one tries to apply this values with iproure2 (ip rule add tos 0x28
...) he will get error from netlink: "Invalid tos" for this moment.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] allow DSCP values in ip rulesB
2018-11-14 14:30 [PATCH] allow DSCP values in ip rulesB Pavel Balaev
2018-11-15 14:59 ` [PATCH] allow DSCP values in ip rules Pavel Balaev
2018-11-15 15:04 ` Pavel Balaev
@ 2018-11-17 4:29 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-11-17 4:29 UTC (permalink / raw)
To: mail; +Cc: netdev
From: Pavel Balaev <mail@void.so>
Date: Wed, 14 Nov 2018 17:30:37 +0300
> Hello, for now IP rules supports only old TOS values and we cannot use
> DSCP.
>
> This patch adds support for DSCP values in IP rules:
>
> $ ip r add default via 192.168.0.6 table test
> $ ip ru add tos 0x80 table test
> $ ip ru
> 0: from all lookup local
> 32764: from all tos CS4 lookup test
> 32766: from all lookup main
> 32767: from all lookup default
> $ ip r get fibmatch 8.8.8.9 tos 0x80
> default tos CS4 via 192.168.0.6 dev lan table test
>
> Signed-off-by: Pavel Balaev <mail@void.so>
Please repost this with all of your follow-up comments added to
the commit message.
And provide a proper subsystem prefix in your Subject line, such
as "ipv4: ".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-17 14:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-14 14:30 [PATCH] allow DSCP values in ip rulesB Pavel Balaev
2018-11-15 14:59 ` [PATCH] allow DSCP values in ip rules Pavel Balaev
2018-11-15 15:04 ` Pavel Balaev
2018-11-17 4:29 ` [PATCH] allow DSCP values in ip rulesB David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox