From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Balaev Subject: [PATCH] allow DSCP values in ip rulesB Date: Wed, 14 Nov 2018 17:30:37 +0300 Message-ID: <20181114143037.GA4650@rnd.infotecs.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 To: netdev@vger.kernel.org Return-path: Received: from forward105p.mail.yandex.net ([77.88.28.108]:45643 "EHLO forward105p.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727357AbeKOAez (ORCPT ); Wed, 14 Nov 2018 19:34:55 -0500 Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward105p.mail.yandex.net (Yandex) with ESMTP id CFB068C03E2 for ; Wed, 14 Nov 2018 17:31:23 +0300 (MSK) Content-Disposition: inline Sender: netdev-owner@vger.kernel.org List-ID: 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 --- 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