Thread (2 messages) 2 messages, 2 authors, 2012-07-12

Re: [PATCH 03/16] ipv4: Pull redirect instantiation out into a helper function.

flat view

From: Joe Perches <joe@perches.com>
Date: 2012-07-12 08:59:34

On Thu, 2012-07-12 at 01:10 -0700, David Miller wrote:
[]
quoted hunk ↗ jump to hunk
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
just a trivial style note:
quoted hunk ↗ jump to hunk
@@ -1271,6 +1271,26 @@ static void rt_del(unsigned int hash, struct rtable *rt)
 	spin_unlock_bh(rt_hash_lock_addr(hash));
 }
 
+static void ip_do_redirect(struct rtable *rt, __be32 old_gw, __be32 new_gw)
+{
+	struct neighbour *n;
+
+	if (rt->rt_gateway != old_gw)
+		return;
+
+	n = ipv4_neigh_lookup(&rt->dst, NULL, &new_gw);
+	if (n) {
Might as well use
	if (!n)
		return;
and save an indent level.
quoted hunk ↗ jump to hunk
+		if (!(n->nud_state & NUD_VALID)) {
+			neigh_event_send(n, NULL);
+		} else {
+			rt->rt_gateway = new_gw;
+			rt->rt_flags |= RTCF_REDIRECTED;
+			call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n);
+		}
+		neigh_release(n);
+	}
+}
+
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help