lkml.org 
[lkml]   [2014]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.17 021/122] ipv4: Fix incorrect error code when adding an unreachable route
    Date
    3.17-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Panu Matilainen <pmatilai@redhat.com>

    [ Upstream commit 49dd18ba4615eaa72f15c9087dea1c2ab4744cf5 ]

    Trying to add an unreachable route incorrectly returns -ESRCH if
    if custom FIB rules are present:

    [root@localhost ~]# ip route add 74.125.31.199 dev eth0 via 1.2.3.4
    RTNETLINK answers: Network is unreachable
    [root@localhost ~]# ip rule add to 55.66.77.88 table 200
    [root@localhost ~]# ip route add 74.125.31.199 dev eth0 via 1.2.3.4
    RTNETLINK answers: No such process
    [root@localhost ~]#

    Commit 83886b6b636173b206f475929e58fac75c6f2446 ("[NET]: Change "not found"
    return value for rule lookup") changed fib_rules_lookup()
    to use -ESRCH as a "not found" code internally, but for user space it
    should be translated into -ENETUNREACH. Handle the translation centrally in
    ipv4-specific fib_lookup(), leaving the DECnet case alone.

    On a related note, commit b7a71b51ee37d919e4098cd961d59a883fd272d8
    ("ipv4: removed redundant conditional") removed a similar translation from
    ip_route_input_slow() prematurely AIUI.

    Fixes: b7a71b51ee37 ("ipv4: removed redundant conditional")
    Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    net/ipv4/fib_rules.c | 4 ++++
    1 file changed, 4 insertions(+)

    --- a/net/ipv4/fib_rules.c
    +++ b/net/ipv4/fib_rules.c
    @@ -62,6 +62,10 @@ int __fib_lookup(struct net *net, struct
    else
    res->tclassid = 0;
    #endif
    +
    + if (err == -ESRCH)
    + err = -ENETUNREACH;
    +
    return err;
    }
    EXPORT_SYMBOL_GPL(__fib_lookup);



    \
     
     \ /
      Last update: 2014-12-06 01:21    [W:2.420 / U:0.372 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site