Skip to content
  • Thomas Haller's avatar
    nmci/ip: rework nmci.ip.link_show_all() to not use JSON and fix binary=True · 1cda2d9e
    Thomas Haller authored
    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.
    1cda2d9e