Skip to content
  • Thomas Haller's avatar
    platform: extend NMIPConfigSource to preserve the rtm_protocol field · 4c2410bc
    Thomas Haller authored
    For addresses (NMPlatformIPAddress) the @addr_source field is ignored
    on a platform level. That is, all addresses inside the platform cache
    have this value set to NM_IP_CONFIG_SOURCE_KERNEL. Maybe, for that reason,
    the source should not be a part of the NMPlatformIPAddress structure, but
    it is convenient for users to piggy back the source inside the platform
    address structure.
    
    For routes, the source is stored in NMPlatformIPRoute's @rt_source
    field. When adding a route to kernel, we set the @rtm_protocol of the
    route depending on the source. However, we want to map different source
    values to the same protocol value.
    
    On the other hand, when kernel sends us a route that gets put inside
    the cache, we must preserve the protocol value and must not map
    different protocol values to the same source.
    The reason is, that a user can add two routes that only differ by
    @rtm_protocol. In that sense, the @rtm_protocol fields is part of the
    unique ID of a kernel route, and thus different values must map to
    different sources.
    
    Fix this, by extending the range of NMIPConfigSource to contain
    a range of protocol fields.
    4c2410bc