]> git.baikalelectronics.ru Git - kernel.git/commit
net: mpls: Fix nexthop alive tracking on down events
authorDavid Ahern <dsa@cumulusnetworks.com>
Mon, 13 Mar 2017 23:49:10 +0000 (16:49 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Mar 2017 03:22:18 +0000 (20:22 -0700)
commit8e03e5d70812188882833c1a6191e83a45002495
tree47d0a7c83af4219789d6ce032dc713f4a0929840
parent6292c74c2bb79859fcddfb3097fb716a8a624726
net: mpls: Fix nexthop alive tracking on down events

Alive tracking of nexthops can account for a link twice if the carrier
goes down followed by an admin down of the same link rendering multipath
routes useless. This is similar to 491191faf618 for UNREGISTER events and
DOWN events.

Fix by tracking number of alive nexthops in mpls_ifdown similar to the
logic in mpls_ifup. Checking the flags per nexthop once after all events
have been processed is simpler than trying to maintian a running count
through all event combinations.

Also, WRITE_ONCE is used instead of ACCESS_ONCE to set rt_nhn_alive
per a comment from checkpatch:
    WARNING: Prefer WRITE_ONCE(<FOO>, <BAR>) over ACCESS_ONCE(<FOO>) = <BAR>

Fixes: 8c7e46d49b6e1 ("mpls: support for dead routes")
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Acked-by: Robert Shearman <rshearma@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mpls/af_mpls.c