summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorDanielle Ratson <danieller@nvidia.com>2026-08-03 14:25:02 +0300
committerJakub Kicinski <kuba@kernel.org>2026-08-07 16:32:46 -0700
commit9dfa6cca8959dd203dc9de012126cf80bc4a680e (patch)
tree5207f01151e021046b43edab3fdb70a59eee497f /include/net
parent2cad8e3d9d94ff2b1083ee261767f0ebdc77d7ce (diff)
ipv6: ndisc: Add ndisc_check_ns_na() validation helper
Add ndisc_check_ns_na(), a standalone NS/NA packet validator modeled after ipv6_mc_check_mld(). It performs the RFC 4861 section 7.1.1 (Neighbor Solicitation) and 7.1.2 (Neighbor Advertisement) mandatory checks that are relevant for software operating at the bridge level, where packets bypass the normal IPv6 stack path: - Hop Limit must be 255 (packet was not forwarded by a router) - ICMPv6 checksum is valid - ICMP Code is 0 - ICMP length is at least 24 octets (sizeof(struct nd_msg)) - Target Address must not be a multicast address - All included options have a length that is greater than zero - NS/DAD: destination must be a solicited-node multicast address - NS/DAD: no Source Link-Layer Address option when source is unspecified - NA: Solicited flag must be 0 when IP Destination is multicast On success the function sets the skb transport header and returns 0, matching the convention of ipv6_mc_check_mld(). Reviewed-by: Petr Machata <petrm@nvidia.com> Acked-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: Danielle Ratson <danieller@nvidia.com> Link: https://patch.msgid.link/20260803112505.613873-3-danieller@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ndisc.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 3da1a6f8d3f9..9e5379ad2d8e 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -430,6 +430,8 @@ void ndisc_update(const struct net_device *dev, struct neighbour *neigh,
const u8 *lladdr, u8 new, u32 flags, u8 icmp6_type,
struct ndisc_options *ndopts);
+int ndisc_check_ns_na(struct sk_buff *skb);
+
/*
* IGMP
*/