allow DSCP values in ip rulesB
Subsystems (3)
PATCH 1/1 allow DSCP values in ip rulesB
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
--- net/ipv4/fib_rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/fib_rules.c +1 -1
@@ -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; }
Signature · 1 line
2.18.1
Re: [PATCH] allow DSCP values in ip rules
Quoted 36 lines · Pavel Balaev
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 testSigned-off-by Pavel Balaev <[email protected]>--- net/ipv4/fib_rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/ipv4/fib_rules.c +1
-1@@ -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; }Signature · 1 line
2.18.1
This patch adds ability to set newer RFC2597 values, they also presents in /etc/iproute2/rt_dsfield:
0x28 AF110x30 AF120x38 AF130x48 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.
Re: [PATCH] allow DSCP values in ip rules
In reply to Pavel BalaevQuoted 36 lines · Pavel Balaev
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 testSigned-off-by Pavel Balaev <[email protected]>--- net/ipv4/fib_rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/ipv4/fib_rules.c +1
-1@@ -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; }Signature · 1 line
2.18.1
In addition. This patch adds ability to set newer RFC2597 values. They also presents in /etc/iproute2/rt_dsfield:
# Newer RFC2597 values0x28 AF110x30 AF120x38 AF130x48 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.
David Miller
maintainerFrom: Pavel Balaev <[email protected]>
Date: Wed, 14 Nov 2018 17:30:37 +0300
Quoted 15 lines
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
Quoted 1 line
Signed-off-by Pavel Balaev <[email protected]>
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: ".