• Wilson Kok's avatar
    fib_rules: fix fib rule dumps across multiple skbs · c7e9f97d
    Wilson Kok authored
    [ Upstream commit 41fc0143 ]
    
    dump_rules returns skb length and not error.
    But when family == AF_UNSPEC, the caller of dump_rules
    assumes that it returns an error. Hence, when family == AF_UNSPEC,
    we continue trying to dump on -EMSGSIZE errors resulting in
    incorrect dump idx carried between skbs belonging to the same dump.
    This results in fib rule dump always only dumping rules that fit
    into the first skb.
    
    This patch fixes dump_rules to return error so that we exit correctly
    and idx is correctly maintained between skbs that are part of the
    same dump.
    Signed-off-by: default avatarWilson Kok <wkok@cumulusnetworks.com>
    Signed-off-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    [bwh: Backported to 3.2:
     - s/portid/pid/
     - Check whether fib_nl_fill_rule() returns < 0, as it may return > 0 on
       success (thanks to Roland Dreier)]
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    Cc: Roland Dreier <roland@purestorage.com>
    c7e9f97d
fib_rules.c 17 KB