]> git.baikalelectronics.ru Git - kernel.git/commit
net: bridge: fix a bug on using a neighbour cache entry without checking its state
authorJianJhen Chen <kchen@synology.com>
Sun, 6 Jan 2019 03:28:13 +0000 (11:28 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Jan 2019 17:09:02 +0000 (12:09 -0500)
commitb0e6998a411d4f8641f2e461ae06ccda4b2ad08b
treee0f06b0072608a1a55800a50e5dab17526fdc9d5
parent3597f976a35af9b952f4d1cc5fc093524000a8d7
net: bridge: fix a bug on using a neighbour cache entry without checking its state

When handling DNAT'ed packets on a bridge device, the neighbour cache entry
from lookup was used without checking its state. It means that a cache entry
in the NUD_STALE state will be used directly instead of entering the NUD_DELAY
state to confirm the reachability of the neighbor.

This problem becomes worse after commit bc4e52919b1c ("neigh: Keep neighbour
cache entries if number of them is small enough."), since all neighbour cache
entries in the NUD_STALE state will be kept in the neighbour table as long as
the number of cache entries does not exceed the value specified in gc_thresh1.

This commit validates the state of a neighbour cache entry before using
the entry.

Signed-off-by: JianJhen Chen <kchen@synology.com>
Reviewed-by: JinLin Chen <jlchen@synology.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_netfilter_hooks.c