[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <e1fa5169db254301bc3b5b766c2df76a@poessinger.com>
Date: Wed, 16 Nov 2022 17:46:09 +0000
From: Christian Pössinger <christian@...ssinger.com>
To: "'netdev@...r.kernel.org'" <netdev@...r.kernel.org>
Subject: iproute2/tc invalid JSON in v6.0.0-42-g49c63bc7 for "tc filter"
Dear Maintainers,
using revision v6.0.0-42-g49c63bc7 I noticed an invalid JSON output when invoking tc -json filter.
To reproduce the issue:
$ tc qdisc add dev eth1 handle ffff: ingress
$ tc filter add dev eth1 parent ffff: prio 20 protocol all u32 match ip dport 22 \
0xffff action police conform-exceed drop/ok rate 100000 burst 15k flowid ffff:1
$ tc filter add dev eth1 parent ffff: prio 255 protocol all basic action police \
conform-exceed drop/ok rate 100000 burst 15k flowid ffff:3
$ tc -detail -json filter show dev eth1 ingress
[{"parent":"ffff:","protocol":"all","pref":20,"kind":"u32","chain":0},{"parent":"ffff:","protocol":"all","pref":20,"kind":"u32","chain":0,
"options":{"fh":"800:","ht_divisor":1}},{"parent":"ffff:","protocol":"all","pref":20,"kind":"u32","chain":0,"options":{"fh":"800::800",
"order":2048,"key_ht":"800","bkt":"0","flowid":"ffff:1","not_in_hw":true,"match":{"value":"16","mask":"ffff","offmask":"","off":20},
"actions":[{"order":1,"kind":"police","index":1,"control_action":{"type":"drop"},"overhead":0,"linklayer":"ethernet","ref":1,"bind":1}]}},
{"parent":"ffff:","protocol":"all","pref":255,"kind":"basic","chain":0},{"parent":"ffff:","protocol":"all","pref":255,"kind":"basic","chain":0,
"options":{handle 0x1 flowid ffff:3 "actions":[{"order":1,"kind":"police","index":2,"control_action":{"type":"drop"},"overhead":0,"linklayer":"ethernet","ref":1,"bind":1}]}}]
>>> json.loads(tmp)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.9/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 698 (char 697)
This actually contains invalid JSON here
... "options":{handle 0x1 flowid ffff:3 "actions":[{"order" ...
It should actually read:
... "options":{"handle":"0x1","flowid":"ffff:3","actions":[{"order" ...
If you can point me to the location which could be responsible for this issue, I am happy to submit a fix to the net tree.
Thanks in advance,
Christian Poessinger
Powered by blists - more mailing lists