summaryrefslogtreecommitdiff
path: root/net/bridge
diff options
context:
space:
mode:
authorJianJhen Chen <kchen@synology.com>2019-01-06 06:28:13 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-26 11:44:25 +0300
commit23009dc3d4ff659739659c10f386a10af628b59f (patch)
treee97ddc9b58d551d673722e014bdbabaa9949bf7f /net/bridge
parent8c871bdbd02f71e31961dce3a70e77d450765f16 (diff)
downloadlinux-23009dc3d4ff659739659c10f386a10af628b59f.tar.xz
net: bridge: fix a bug on using a neighbour cache entry without checking its state
[ Upstream commit 4c84edc11b76590859b1e45dd676074c59602dc4 ] 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 2724680bceee ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_netfilter.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index f076a8ede00b..6aec6b264f8e 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -287,7 +287,7 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb)
if (neigh) {
int ret;
- if (neigh->hh.hh_len) {
+ if ((neigh->nud_state & NUD_CONNECTED) && neigh->hh.hh_len) {
neigh_hh_bridge(&neigh->hh, skb);
skb->dev = nf_bridge->physindev;
ret = br_handle_frame_finish(skb);