NDP (Neighbor Discovery Protocol) More...
#include "core/net.h"
Go to the source code of this file.
Data Structures | |
struct | NdpQueueItem |
NDP queue item. More... | |
struct | NdpNeighborCacheEntry |
Neighbor cache entry. More... | |
struct | NdpDestCacheEntry |
Destination cache entry. More... | |
struct | NdpContext |
NDP context. More... | |
Macros | |
#define | NDP_SUPPORT ENABLED |
#define | NDP_TICK_INTERVAL 200 |
#define | NDP_NEIGHBOR_CACHE_SIZE 8 |
#define | NDP_DEST_CACHE_SIZE 8 |
#define | NDP_MAX_PENDING_PACKETS 2 |
#define | NDP_MAX_RTR_ADVERT_INTERVAL 600000 |
#define | NDP_MAX_INITIAL_RTR_ADVERT_INTERVAL 16000 |
#define | NDP_MAX_INITIAL_RTR_ADVERTISEMENTS 3 |
#define | NDP_MAX_FINAL_RTR_ADVERTISEMENTS 3 |
#define | NDP_MIN_DELAY_BETWEEN_RAS 3000 |
#define | NDP_MAX_RA_DELAY_TIME 500 |
#define | NDP_MIN_RTR_SOLICITATION_DELAY 0 |
#define | NDP_MAX_RTR_SOLICITATION_DELAY 1000 |
#define | NDP_RTR_SOLICITATION_INTERVAL 4000 |
#define | NDP_MAX_RTR_SOLICITATIONS 3 |
#define | NDP_MAX_MULTICAST_SOLICIT 3 |
#define | NDP_MAX_UNICAST_SOLICIT 3 |
#define | NDP_DUP_ADDR_DETECT_TRANSMITS 1 |
#define | NDP_MAX_ANYCAST_DELAY_TIME 1000 |
#define | NDP_MAX_NEIGHBOR_ADVERTISEMENT 3 |
#define | NDP_REACHABLE_TIME 30000 |
#define | NDP_RETRANS_TIMER 1000 |
#define | NDP_DELAY_FIRST_PROBE_TIME 5000 |
#define | NDP_HOP_LIMIT 255 |
#define | NDP_INFINITE_LIFETIME 0xFFFFFFFF |
Enumerations | |
enum | NdpOptionType { NDP_OPT_SOURCE_LINK_LAYER_ADDR = 1, NDP_OPT_TARGET_LINK_LAYER_ADDR = 2, NDP_OPT_PREFIX_INFORMATION = 3, NDP_OPT_REDIRECTED_HEADER = 4, NDP_OPT_MTU = 5, NDP_OPT_ROUTE_INFORMATION = 24, NDP_OPT_RECURSIVE_DNS_SERVER = 25, NDP_OPT_DNS_SEARCH_LIST = 31, NDP_OPT_6LOWPAN_CONTEXT = 34, NDP_OPT_CAPTIVE_PORTAL = 37, NDP_OPT_ANY = 255 } |
Neighbor Discovery options. More... | |
enum | NdpRouterSelPreference { NDP_ROUTER_SEL_PREFERENCE_MEDIUM = 0, NDP_ROUTER_SEL_PREFERENCE_HIGH = 1, NDP_ROUTER_SEL_PREFERENCE_RESERVED = 2, NDP_ROUTER_SEL_PREFERENCE_LOW = 3 } |
Router selection preferences. More... | |
enum | NdpState { NDP_STATE_NONE = 0, NDP_STATE_INCOMPLETE = 1, NDP_STATE_REACHABLE = 2, NDP_STATE_STALE = 3, NDP_STATE_DELAY = 4, NDP_STATE_PROBE = 5, NDP_STATE_PERMANENT = 6 } |
Neighbor cache entry states. More... | |
Functions | |
error_t | ndpInit (NetInterface *interface) |
Neighbor cache initialization. More... | |
error_t | ndpEnable (NetInterface *interface, bool_t enable) |
Enable address resolution using Neighbor Discovery protocol. More... | |
error_t | ndpAddStaticEntry (NetInterface *interface, const Ipv6Addr *ipAddr, const MacAddr *macAddr) |
Add a static entry in the Neighbor cache. More... | |
error_t | ndpRemoveStaticEntry (NetInterface *interface, const Ipv6Addr *ipAddr) |
Remove a static entry from the Neighbor cache. More... | |
error_t | ndpResolve (NetInterface *interface, const Ipv6Addr *ipAddr, MacAddr *macAddr) |
Address resolution using Neighbor Discovery protocol. More... | |
error_t | ndpEnqueuePacket (NetInterface *srcInterface, NetInterface *destInterface, const Ipv6Addr *ipAddr, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary) |
Enqueue an IPv6 packet waiting for address resolution. More... | |
void | ndpTick (NetInterface *interface) |
NDP timer handler. More... | |
void | ndpLinkChangeEvent (NetInterface *interface) |
Callback function for link change event. More... | |
void | ndpProcessRouterAdv (NetInterface *interface, const Ipv6PseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary) |
Router Advertisement message processing. More... | |
void | ndpProcessNeighborSol (NetInterface *interface, const Ipv6PseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary) |
Neighbor Solicitation message processing. More... | |
void | ndpProcessNeighborAdv (NetInterface *interface, const Ipv6PseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary) |
Neighbor Advertisement message processing. More... | |
void | ndpProcessRedirect (NetInterface *interface, const Ipv6PseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary) |
Redirect message processing. More... | |
error_t | ndpSendRouterSol (NetInterface *interface) |
Send a Router Solicitation message. More... | |
error_t | ndpSendNeighborSol (NetInterface *interface, const Ipv6Addr *targetIpAddr, bool_t multicast) |
Send a Neighbor Solicitation message. More... | |
error_t | ndpSendNeighborAdv (NetInterface *interface, const Ipv6Addr *targetIpAddr, const Ipv6Addr *destIpAddr) |
Send a Neighbor Advertisement message. More... | |
error_t | ndpSendRedirect (NetInterface *interface, const Ipv6Addr *targetAddr, const NetBuffer *ipPacket, size_t ipPacketOffset) |
Send a Redirect message. More... | |
void | ndpDumpRouterSolMessage (const NdpRouterSolMessage *message) |
Dump Router Solicitation message for debugging purpose. More... | |
void | ndpDumpRouterAdvMessage (const NdpRouterAdvMessage *message) |
Dump Router Advertisement message for debugging purpose. More... | |
void | ndpDumpNeighborSolMessage (const NdpNeighborSolMessage *message) |
Dump Neighbor Solicitation message for debugging purpose. More... | |
void | ndpDumpNeighborAdvMessage (const NdpNeighborAdvMessage *message) |
Dump Neighbor Advertisement message for debugging purpose. More... | |
void | ndpDumpRedirectMessage (const NdpRedirectMessage *message) |
Dump Redirect message for debugging purpose. More... | |
Detailed Description
NDP (Neighbor Discovery Protocol)
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file ndp.h.
Macro Definition Documentation
◆ NDP_DELAY_FIRST_PROBE_TIME
◆ NDP_DEST_CACHE_SIZE
◆ NDP_DUP_ADDR_DETECT_TRANSMITS
◆ NDP_HOP_LIMIT
◆ NDP_INFINITE_LIFETIME
◆ NDP_MAX_ANYCAST_DELAY_TIME
◆ NDP_MAX_FINAL_RTR_ADVERTISEMENTS
◆ NDP_MAX_INITIAL_RTR_ADVERT_INTERVAL
◆ NDP_MAX_INITIAL_RTR_ADVERTISEMENTS
◆ NDP_MAX_MULTICAST_SOLICIT
◆ NDP_MAX_NEIGHBOR_ADVERTISEMENT
◆ NDP_MAX_PENDING_PACKETS
◆ NDP_MAX_RA_DELAY_TIME
◆ NDP_MAX_RTR_ADVERT_INTERVAL
◆ NDP_MAX_RTR_SOLICITATION_DELAY
◆ NDP_MAX_RTR_SOLICITATIONS
◆ NDP_MAX_UNICAST_SOLICIT
◆ NDP_MIN_DELAY_BETWEEN_RAS
◆ NDP_MIN_RTR_SOLICITATION_DELAY
◆ NDP_NEIGHBOR_CACHE_SIZE
◆ NDP_REACHABLE_TIME
◆ NDP_RETRANS_TIMER
◆ NDP_RTR_SOLICITATION_INTERVAL
◆ NDP_SUPPORT
◆ NDP_TICK_INTERVAL
Enumeration Type Documentation
◆ NdpOptionType
enum NdpOptionType |
Neighbor Discovery options.
◆ NdpRouterSelPreference
◆ NdpState
enum NdpState |
Function Documentation
◆ ndpAddStaticEntry()
error_t ndpAddStaticEntry | ( | NetInterface * | interface, |
const Ipv6Addr * | ipAddr, | ||
const MacAddr * | macAddr | ||
) |
◆ ndpDumpNeighborAdvMessage()
void ndpDumpNeighborAdvMessage | ( | const NdpNeighborAdvMessage * | message | ) |
◆ ndpDumpNeighborSolMessage()
void ndpDumpNeighborSolMessage | ( | const NdpNeighborSolMessage * | message | ) |
◆ ndpDumpRedirectMessage()
void ndpDumpRedirectMessage | ( | const NdpRedirectMessage * | message | ) |
◆ ndpDumpRouterAdvMessage()
void ndpDumpRouterAdvMessage | ( | const NdpRouterAdvMessage * | message | ) |
◆ ndpDumpRouterSolMessage()
void ndpDumpRouterSolMessage | ( | const NdpRouterSolMessage * | message | ) |
◆ ndpEnable()
error_t ndpEnable | ( | NetInterface * | interface, |
bool_t | enable | ||
) |
Enable address resolution using Neighbor Discovery protocol.
- Parameters
-
[in] interface Underlying network interface [in] enable This flag specifies whether the host is allowed to send Neighbor solicitations and respond to incoming Neighbor solicitations. When the flag is set to FALSE, the host relies exclusively on static Neighbor cache entries to map IPv6 addresses into MAC addresses and silently drop incoming Neighbor solicitations
- Returns
- Error code
◆ ndpEnqueuePacket()
error_t ndpEnqueuePacket | ( | NetInterface * | srcInterface, |
NetInterface * | destInterface, | ||
const Ipv6Addr * | ipAddr, | ||
NetBuffer * | buffer, | ||
size_t | offset, | ||
NetTxAncillary * | ancillary | ||
) |
Enqueue an IPv6 packet waiting for address resolution.
- Parameters
-
[in] srcInterface Interface from which the packet has been received [in] destInterface Interface on which the packet should be sent [in] ipAddr IPv6 address of the destination host [in] buffer Multi-part buffer containing the packet to be enqueued [in] offset Offset to the first byte of the packet [in] ancillary Additional options passed to the stack along with the packet
- Returns
- Error code
◆ ndpInit()
error_t ndpInit | ( | NetInterface * | interface | ) |
◆ ndpLinkChangeEvent()
void ndpLinkChangeEvent | ( | NetInterface * | interface | ) |
◆ ndpProcessNeighborAdv()
void ndpProcessNeighborAdv | ( | NetInterface * | interface, |
const Ipv6PseudoHeader * | pseudoHeader, | ||
const NetBuffer * | buffer, | ||
size_t | offset, | ||
const NetRxAncillary * | ancillary | ||
) |
Neighbor Advertisement message processing.
- Parameters
-
[in] interface Underlying network interface [in] pseudoHeader IPv6 pseudo header [in] buffer Multi-part buffer containing the Neighbor Advertisement message [in] offset Offset to the first byte of the message [in] ancillary Additional options passed to the stack along with the packet
◆ ndpProcessNeighborSol()
void ndpProcessNeighborSol | ( | NetInterface * | interface, |
const Ipv6PseudoHeader * | pseudoHeader, | ||
const NetBuffer * | buffer, | ||
size_t | offset, | ||
const NetRxAncillary * | ancillary | ||
) |
Neighbor Solicitation message processing.
- Parameters
-
[in] interface Underlying network interface [in] pseudoHeader IPv6 pseudo header [in] buffer Multi-part buffer containing the Neighbor Solicitation message [in] offset Offset to the first byte of the message [in] ancillary Additional options passed to the stack along with the packet
◆ ndpProcessRedirect()
void ndpProcessRedirect | ( | NetInterface * | interface, |
const Ipv6PseudoHeader * | pseudoHeader, | ||
const NetBuffer * | buffer, | ||
size_t | offset, | ||
const NetRxAncillary * | ancillary | ||
) |
Redirect message processing.
- Parameters
-
[in] interface Underlying network interface [in] pseudoHeader IPv6 pseudo header [in] buffer Multi-part buffer containing the Redirect message [in] offset Offset to the first byte of the message [in] ancillary Additional options passed to the stack along with the packet
◆ ndpProcessRouterAdv()
void ndpProcessRouterAdv | ( | NetInterface * | interface, |
const Ipv6PseudoHeader * | pseudoHeader, | ||
const NetBuffer * | buffer, | ||
size_t | offset, | ||
const NetRxAncillary * | ancillary | ||
) |
Router Advertisement message processing.
- Parameters
-
[in] interface Underlying network interface [in] pseudoHeader IPv6 pseudo header [in] buffer Multi-part buffer containing the Router Advertisement message [in] offset Offset to the first byte of the message [in] ancillary Additional options passed to the stack along with the packet
◆ ndpRemoveStaticEntry()
error_t ndpRemoveStaticEntry | ( | NetInterface * | interface, |
const Ipv6Addr * | ipAddr | ||
) |
◆ ndpResolve()
error_t ndpResolve | ( | NetInterface * | interface, |
const Ipv6Addr * | ipAddr, | ||
MacAddr * | macAddr | ||
) |
◆ ndpSendNeighborAdv()
error_t ndpSendNeighborAdv | ( | NetInterface * | interface, |
const Ipv6Addr * | targetIpAddr, | ||
const Ipv6Addr * | destIpAddr | ||
) |
◆ ndpSendNeighborSol()
error_t ndpSendNeighborSol | ( | NetInterface * | interface, |
const Ipv6Addr * | targetIpAddr, | ||
bool_t | multicast | ||
) |
◆ ndpSendRedirect()
error_t ndpSendRedirect | ( | NetInterface * | interface, |
const Ipv6Addr * | targetAddr, | ||
const NetBuffer * | ipPacket, | ||
size_t | ipPacketOffset | ||
) |
Send a Redirect message.
- Parameters
-
[in] interface Underlying network interface [in] targetAddr IPv6 address that is a better first hop to use for the destination address [in] ipPacket Multi-part buffer that holds the IPv6 packet that triggered the sending of the Redirect [in] ipPacketOffset Offset to the first byte of the IPv6 packet
- Returns
- Error code
◆ ndpSendRouterSol()
error_t ndpSendRouterSol | ( | NetInterface * | interface | ) |
◆ ndpTick()
void ndpTick | ( | NetInterface * | interface | ) |
Variable Documentation
◆ __packed_struct
typedef __packed_struct |
Router Solicitation message.
6LoWPAN Context option (6CO)
DNS Search List option (DNSSL)
Recursive DNS Server option (RDNSS)
Route Information option (RIO)
MTU option.
Redirected Header option (RHO)
Prefix Information option (PIO)
Source/Target Link-Layer Address option.
Neighbor Discovery option general format.
Redirect message.
Neighbor Advertisement message.
Neighbor Solicitation message.
Router Advertisement message.