After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 752062 - [review] let NMRouteManager configure conflicting direct routes [th/direct-route-conflict-bgo752062]
[review] let NMRouteManager configure conflicting direct routes [th/direct-ro...
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-07-07 11:23 UTC by Thomas Haller
Modified: 2015-07-07 14:38 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Thomas Haller 2015-07-07 11:23:43 UTC
Please review.


Commit message:


    route-manager: always add conflicting direct routes and bump the route-
    metric if necessary
    
    Kernel does not allow to add the same route (as determined by 
    network/plen,metric) on two different interfaces (ifindex). In case of 
    conflict, NMRouteManager used to ignore any but the firstly added route.
    
    On the other hand, we cannot add a gateway-route, if there is no direct
    route to the gateway. Hence, skipping duplicate routes can mean that we
    skip a direct route what was necessary to add other gateway-route,
    which then leads to errors adding that route.
    
    This is an even more serious issue since NMRouteManager manages the
    device routes for IPv4 addresses.
    
    For example, say you connect two interfaces to the same IP subnet.
    The route-metric can conflict if the interfaces are of the same type
    or if the users configured a conflict explicitly.
    In case of conflicts, NMRouteManager would only configure the first
    appearing route and skip the shadowed route on the second interface.
    Now we cannot configure gateway-routes on the second interface because
    the gateway is unreachable.
    
    There are many scenarios where this issue can happen, especially with
    default-routes and user-configured-routes.
    For example with default-routes, ip4_config_merge_and_apply() would check
    if the default-gateway requires an explict route and possibly add it.
    But then NMRouteManager might not add the route because it is shadowed
    by a route on an other interface.
    
    This patch solves the issue by having NMRouteManager configure shadowed
    routes too, similar to what NMDefaultRouteManager does.
    It does that by searching for an unused, non-conflicting, higher metric
    for the route, i.e. we bump the metric by 1 until we can add it without
    conflict.
    
    Also note that NMRouteManager preserves the order of activating routes.
    That means, if you configure a conflicting route, the metric of that
    route will be bumped. The effect is that the best route to a destination
    stays on the first interface until it gets disconnected.
Comment 1 Lubomir Rintel 2015-07-07 14:03:47 UTC
Works fine here.