Skip to content
  • Thomas Haller's avatar
    libnm-core: allow strict and relaxed error behavior for _nm_setting_new_from_dbus() · 737c8cc5
    Thomas Haller authored
    In some situations, we want strict checking of errors, for example when
    NetworkManager receives a new connection from a client, the connection
    must make sense as a whole (and since NetworkManager service is backward
    compatible to the clients and not the other way around, there is no
    excuse for sending invalid data to the server).
    
    In other situations, we want a best-effort behavior. Like when
    NetworkManager sends a connection to its clients, those clients
    want to extract as many properties as they understand, but in order
    to be forward compatible against newer server versions, invalid
    or unknown properties must be accepted.
    
    Previously, a mixture of both was done. Some issues caused a failure
    to create a new NMSetting, other invalid parts were just silently
    ignored or triggered a g_warning() in glib.
    
    Now allow for both. When doing strict-validation, be more strict and
    reject all unknown properties and catch when the user sets an invalid
    argument. On the other hand, allow for a best-effort mode that
    effectively cannot fail and will return a new NMSetting instance.
    
    For now, add NMSettingParseFlags so that the caller can choose the
    old behavior, strict parsing, or best effort.
    
    This patch doesn't have any externally visible change except that
    no more g_warnings will be emitted.
    737c8cc5