Skip to content

[th/nmci-ip-no-json] nmci/ip: rework nmci.ip.link_show_all() to not use JSON and fix binary=True

Thomas Haller requested to merge th/nmci-ip-no-json into master

Interface names might not be valid UTF-8. But JSON strings must be UTF-8. iproute2 will just return invalid JSON in the case where the interface name is not a unicode name.

We need nmci.ip to work properly also in case where we have unexpected interface names. For that reason, there was already a fallback path that tired to parse the text output, and not use JSON.

If we already have a non-JSON variant that MUST work, there is no point in keeping the JSON code. Drop it and always do our manual parsing.

This also fixes the "binary=True" argument, which is supposed to return the interface name as bytes.

Merge request reports