Skip to content
  • Thomas Haller's avatar
    platform: add support for routing-rule objects and cache them in platform · 9934a6a0
    Thomas Haller authored
    Add and implement NMPlatformRoutingRule types and let the platform cache
    handle rules.
    
    Rules are special in two ways:
    
    - they don't have an ifindex. That makes them different from all other
      currently existing NMPlatform* types, which have an "ifindex" field and
      "implement" NMPlatformObjWithIfindex.
    
    - they have an address family, but contrary to addresses and routes, there
      is only one NMPlatformRoutingRule object to handle both address
      families.
    
    Both of these points require some special considerations.
    
    Kernel treats routing-rules quite similar to routes. That is, kernel
    allows to add different rules/routes, as long as they differ in certain
    fields. These "fields" make up the identity of the rules/routes. But
    in practice, it's not defined which fields contribute to the identity
    of these objects. That makes using the netlink API very hard. For
    example, when kernel gains support for a new attribute which
    NetworkManager does not know yet, then users can add two rules/routes
    that look the same to NetworkManager. That can easily result in cache
    inconsistencies.
    
    Another problem is, that older kernel versions may not yet support all
    fields, which NetworkManager (and newer kernels) considers for identity.
    The older kernel will not simply reject netlink messages with these unknown
    keys, instead it will proceed adding the route/rule without it. That means,
    the added route/rule will have a different identity than what NetworkManager
    intended to add.
    9934a6a0