@@ -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:
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 <dsa@cumulusnetworks.com> --- net/ipv4/route.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)