Skip to contentSkip to conversation

neighbour: confirm neigh entries when ARP packet is received

PATCH In review Vasily Khoruzhick 3 participants 4 messages Sep 13, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 neighbour: confirm neigh entries when ARP packet is received

Update 'confirmed' timestamp when ARP packet is received. It shouldn't affect locktime logic and anyway entry can be confirmed by any higher-layer protocol. Thus it makes sense to confirm it when ARP packet is received.

Fixes 77d7123342 ("neighbour: update neigh timestamps iff update is effective")

---
v2: - update comment to match new code.
v3: - fix wording in commit message, make 'Fixes' tag one line, remove extra new line
between 'Fixes' and 'Signed-off-by'.

 net/core/neighbour.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
net/core/neighbour.c +8 -5
index aa19d86937af..91592fceeaad 100644
@@ -1180,6 +1180,12 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
 		lladdr = neigh->ha;
 	}
 
+	/* Update confirmed timestamp for neighbour entry after we
+	 * received ARP packet even if it doesn't change IP to MAC binding.
+	 */
+	if (new & NUD_CONNECTED)
+		neigh->confirmed = jiffies;
+
 	/* If entry was valid and address is not changed,
 	   do not change entry state, if new one is STALE.
 	 */
@@ -1201,15 +1207,12 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
 		}
 	}
 
-	/* Update timestamps only once we know we will make a change to the
+	/* Update timestamp only once we know we will make a change to the
 	 * neighbour entry. Otherwise we risk to move the locktime window with
 	 * noop updates and ignore relevant ARP updates.
 	 */
-	if (new != old || lladdr != neigh->ha) {
-		if (new & NUD_CONNECTED)
-			neigh->confirmed = jiffies;
+	if (new != old || lladdr != neigh->ha)
 		neigh->updated = jiffies;
-	}
 
 	if (new != old) {
 		neigh_del_timer(neigh);
Signature · 1 line
2.18.0
#1 lore raw

Hello!

Quoted 5 lines · Vasily Khoruzhick

Update 'confirmed' timestamp when ARP packet is received. It shouldn't affect locktime logic and anyway entry can be confirmed by any higher-layer protocol. Thus it makes sense to confirm it when ARP packet is received.

Fixes 77d7123342 ("neighbour: update neigh timestamps iff update is effective")

Need at least 12 hex digits... Perhaps could be fixed when applying?

Quoted 1 line

[...]
MBR, Sergei

maintainer
#2 lore raw

From: Sergei Shtylyov <[email protected]>
Date: Thu, 13 Sep 2018 21:26:42 +0300

Quoted 11 lines

Hello!

Quoted 5 lines · Vasily Khoruzhick

Update 'confirmed' timestamp when ARP packet is received. It shouldn't affect locktime logic and anyway entry can be confirmed by any higher-layer protocol. Thus it makes sense to confirm it when ARP packet is received.

Fixes 77d7123342 ("neighbour: update neigh timestamps iff update is effective")

Need at least 12 hex digits... Perhaps could be fixed when applying?

Yeah I took care of that.

Quoted 3 lines
Quoted 2 lines

[...]

Applied and queued up for -stable.

#3 lore raw
Quoted 15 lines · David Miller

From: Sergei Shtylyov <[email protected]>
Date: Thu, 13 Sep 2018 21:26:42 +0300

Quoted 11 lines

Hello!

Quoted 5 lines · Vasily Khoruzhick

Update 'confirmed' timestamp when ARP packet is received. It shouldn't affect locktime logic and anyway entry can be confirmed by any higher-layer protocol. Thus it makes sense to confirm it when ARP packet is received.

Fixes 77d7123342 ("neighbour: update neigh timestamps iff update is effective")

Need at least 12 hex digits... Perhaps could be fixed when applying?

Quoted 7 lines

Yeah I took care of that.

Quoted 3 lines
Quoted 2 lines

[...]

Applied and queued up for -stable.

Thanks!