Skip to content
  • Thomas Haller's avatar
    platform: pass full route object to platform delete function · 2861c591
    Thomas Haller authored
    Contrary to addresses, routes have no ID. When deleting a route,
    you cannot just specify certain properties like network/plen,metric.
    
    Well, actually you can specify only certain properties, but then kernel
    will treat unspecified properties as wildcard and delete the first matching
    route. That is not something we want, because we need to be in control which
    exact route shall be deleted.
    
    Also, rtm_tos *must* match. Even if we like the wildcard behavior,
    we would need to pass TOS to nm_platform_ip4_route_delete() to be
    able to delete routes with non-zero TOS. So, while certain properties
    may be omitted, some must not. See how test_ip4_route_options() was
    broken.
    
    For NetworkManager it only makes ever sense to call delete on a route,
    if the route is already fully known. Which means, we only delete routes
    that we have already in the platform cache (otherwise, how would we know
    that there is something to delete). Because of that, no longer have separate
    IPv4 and IPv6 functions. Instead, have nm_platform_ip_route_delete() which
    accepts a full NMPObject from the platform cache.
    
    The code in core doesn't jet make use of this new functionality. It will
    in the future.
    
    At least, it fixes deleting routes with differing TOS.
    2861c591