Move stat and logging for martian_destination error into helper function
similar to ip_handle_martian_source. Code move only; no functional change.

Signed-off-by: David Ahern <d...@cumulusnetworks.com>
---
 net/ipv4/route.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 79c4cecdb7a1..3ee37835e1f5 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1531,6 +1531,20 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 
daddr, __be32 saddr,
        return err;
 }
 
+/*
+ *     Do not cache martian addresses: they should be logged (RFC1812)
+ */
+static void ip_handle_martian_dest(struct net_device *dev,
+                                  struct in_device *in_dev,
+                                  __be32 daddr, __be32 saddr)
+{
+       RT_CACHE_STAT_INC(in_martian_dst);
+#ifdef CONFIG_IP_ROUTE_VERBOSE
+       if (IN_DEV_LOG_MARTIANS(in_dev))
+               net_warn_ratelimited("martian destination %pI4 from %pI4, dev 
%s\n",
+                                    &daddr, &saddr, dev->name);
+#endif
+}
 
 static void ip_handle_martian_source(struct net_device *dev,
                                     struct in_device *in_dev,
@@ -1857,17 +1871,9 @@ out:     return err;
        res.table = NULL;
        goto local_input;
 
-       /*
-        *      Do not cache martian addresses: they should be logged (RFC1812)
-        */
 martian_destination:
        err = -EINVAL;
-       RT_CACHE_STAT_INC(in_martian_dst);
-#ifdef CONFIG_IP_ROUTE_VERBOSE
-       if (IN_DEV_LOG_MARTIANS(in_dev))
-               net_warn_ratelimited("martian destination %pI4 from %pI4, dev 
%s\n",
-                                    &daddr, &saddr, dev->name);
-#endif
+       ip_handle_martian_dest(dev, in_dev, daddr, saddr);
        goto out;
 
 martian_source:
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to