OSDN Git Service

ipv6: icmp6: add SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST
authorEric Dumazet <edumazet@google.com>
Thu, 16 Feb 2023 16:28:41 +0000 (16:28 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 20 Feb 2023 08:54:23 +0000 (08:54 +0000)
Hosts can often receive neighbour discovery messages
that are not for them.

Use a dedicated drop reason to make clear the packet is dropped
for this normal case.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/dropreason.h
net/ipv6/ndisc.c

index 239a5c0..c0a3ea8 100644 (file)
@@ -77,6 +77,7 @@
        FN(IPV6_NDISC_HOP_LIMIT)        \
        FN(IPV6_NDISC_BAD_CODE)         \
        FN(IPV6_NDISC_BAD_OPTIONS)      \
+       FN(IPV6_NDISC_NS_OTHERHOST)     \
        FNe(MAX)
 
 /**
@@ -333,6 +334,10 @@ enum skb_drop_reason {
        SKB_DROP_REASON_IPV6_NDISC_BAD_CODE,
        /** @SKB_DROP_REASON_IPV6_NDISC_BAD_OPTIONS: invalid NDISC options. */
        SKB_DROP_REASON_IPV6_NDISC_BAD_OPTIONS,
+       /** @SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST: NEIGHBOUR SOLICITATION
+        * for another host.
+        */
+       SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST,
        /**
         * @SKB_DROP_REASON_MAX: the maximum of drop reason, which shouldn't be
         * used as a real 'reason'
index b47e845..c4be62c 100644 (file)
@@ -921,8 +921,10 @@ have_ifp:
                                        pneigh_enqueue(&nd_tbl, idev->nd_parms, n);
                                goto out;
                        }
-               } else
+               } else {
+                       SKB_DR_SET(reason, IPV6_NDISC_NS_OTHERHOST);
                        goto out;
+               }
        }
 
        if (is_router < 0)