lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f0e2f7ba-e53d-499e-827c-0866dabea861@lunn.ch>
Date: Mon, 27 Oct 2025 03:16:48 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Johannes Eigner <johannes.eigner@...berle.de>
Cc: netdev@...r.kernel.org, Michal Kubecek <mkubecek@...e.cz>,
	Danielle Ratson <danieller@...dia.com>,
	Stephan Wurm <stephan.wurm@...berle.de>
Subject: Re: [PATCH ethtool v3 2/2] module info: Fix duplicated JSON keys

On Fri, Oct 24, 2025 at 12:32:52PM +0200, Johannes Eigner wrote:
> Fix duplicated JSON keys in the module diagnostics output.
> This changes the JSON API in an incompatible way, but leaving it as it
> is is not an option either. The API change is limited to the following
> keys for measured values on QSFP and CMIS modules:
> * "module_temperature" renamed to "module_temperature_measurement"
> * "module_voltage" renamed to "module_voltage_measurement"
> Keys with the same names for threshold values are kept unchanged to
> maximize backward compatibility. Keys for SFP modules are changed as
> well, but since it was never possible to get the diagnostics in JSON
> format for SFP modules, this does not introduce any backward
> compatibility issues for SFP modules. Used key names for SFP modules are
> aligned with QSFP and CMIS modules.
> 
> Duplicated JSON keys result in undefined behavior which is handled
> differently by different JSON parsers. From RFC 8259:
>    Many implementations report the last name/value pair
>    only. Other implementations report an error or fail to parse the
>    object, and some implementations report all of the name/value pairs,
>    including duplicates.
> First behavior can be confirmed for Boost.JSON, nlohmann json,
> javascript (running in Firefox and Chromium), jq, php, python and ruby.
> With these parsers it was not possible to get the measured module
> temperature and voltage, since they were silently overwritten by the
> threshold values.
> 
> Shortened example output for module temperature.
> Without patch:
>   $ ethtool -j -m sfp1
>   [ {
>   ...
>           "module_temperature": 26.5898,
>   ...
>           "module_temperature": {
>               "high_alarm_threshold": 110,
>               "low_alarm_threshold": -45,
>               "high_warning_threshold": 95,
>               "low_warning_threshold": -42
>           },
>   ...
>       } ]
> With patch:
>   $ ethtool -j -m sfp1
>   [ {
>   ...
>           "module_temperature_measurement": 35.793,
>   ...
>           "module_temperature": {
>               "high_alarm_threshold": 110,
>               "low_alarm_threshold": -45,
>               "high_warning_threshold": 95,
>               "low_warning_threshold": -42
>           },
>   ...
>       } ]
> 
> Fixes: 3448a2f73e77 (cmis: Add JSON output handling to --module-info in CMIS modules)
> Fixes: 008167804e54 (module_common: Add helpers to support JSON printing for common value types)
> Signed-off-by: Johannes Eigner <johannes.eigner@...berle.de>

Reviewed-by: Andrew Lunn <andrew@...n.ch>

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ