Extend device specific callbacks to ICMPv6 and ARP. Fix some IPv6 compilation errors that have crept in
This commit is contained in:
parent
4c69ef2ad1
commit
b94321cfb4
@ -83,6 +83,7 @@ CONFIG_ARCH="arm"
|
||||
# CONFIG_ARCH_CHIP_KL is not set
|
||||
# CONFIG_ARCH_CHIP_LM is not set
|
||||
# CONFIG_ARCH_CHIP_TIVA is not set
|
||||
# CONFIG_ARCH_CHIP_LPC11XX is not set
|
||||
# CONFIG_ARCH_CHIP_LPC17XX is not set
|
||||
# CONFIG_ARCH_CHIP_LPC214X is not set
|
||||
# CONFIG_ARCH_CHIP_LPC2378 is not set
|
||||
@ -91,7 +92,9 @@ CONFIG_ARCH="arm"
|
||||
# CONFIG_ARCH_CHIP_NUC1XX is not set
|
||||
# CONFIG_ARCH_CHIP_SAMA5 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD is not set
|
||||
# CONFIG_ARCH_CHIP_SAML is not set
|
||||
# CONFIG_ARCH_CHIP_SAM34 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMV7 is not set
|
||||
CONFIG_ARCH_CHIP_STM32=y
|
||||
# CONFIG_ARCH_CHIP_STR71X is not set
|
||||
# CONFIG_ARCH_ARM7TDMI is not set
|
||||
@ -100,6 +103,7 @@ CONFIG_ARCH_CHIP_STM32=y
|
||||
# CONFIG_ARCH_CORTEXM0 is not set
|
||||
# CONFIG_ARCH_CORTEXM3 is not set
|
||||
CONFIG_ARCH_CORTEXM4=y
|
||||
# CONFIG_ARCH_CORTEXM7 is not set
|
||||
# CONFIG_ARCH_CORTEXA5 is not set
|
||||
# CONFIG_ARCH_CORTEXA8 is not set
|
||||
CONFIG_ARCH_FAMILY="armv7-m"
|
||||
@ -107,13 +111,19 @@ CONFIG_ARCH_CHIP="stm32"
|
||||
# CONFIG_ARMV7M_USEBASEPRI is not set
|
||||
CONFIG_ARCH_HAVE_CMNVECTOR=y
|
||||
# CONFIG_ARMV7M_CMNVECTOR is not set
|
||||
# CONFIG_ARMV7M_LAZYFPU is not set
|
||||
CONFIG_ARCH_HAVE_FPU=y
|
||||
# CONFIG_ARCH_HAVE_DPFPU is not set
|
||||
# CONFIG_ARCH_FPU is not set
|
||||
# CONFIG_ARMV7M_MPU is not set
|
||||
|
||||
#
|
||||
# ARMV7M Configuration Options
|
||||
#
|
||||
# CONFIG_ARMV7M_HAVE_ICACHE is not set
|
||||
# CONFIG_ARMV7M_HAVE_DCACHE is not set
|
||||
# CONFIG_ARMV7M_HAVE_ITCM is not set
|
||||
# CONFIG_ARMV7M_HAVE_DTCM is not set
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC is not set
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_CODEREDW is not set
|
||||
@ -122,8 +132,10 @@ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL is not set
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW is not set
|
||||
# CONFIG_ARMV7M_TOOLCHAIN_RAISONANCE is not set
|
||||
CONFIG_ARMV7M_HAVE_STACKCHECK=y
|
||||
# CONFIG_ARMV7M_STACKCHECK is not set
|
||||
# CONFIG_ARMV7M_ITMSYSLOG is not set
|
||||
# CONFIG_SERIAL_TERMIOS is not set
|
||||
CONFIG_SDIO_DMA=y
|
||||
CONFIG_SDIO_DMAPRIO=0x00010000
|
||||
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
|
||||
@ -151,6 +163,7 @@ CONFIG_SDIO_DMAPRIO=0x00010000
|
||||
# CONFIG_ARCH_CHIP_STM32L152V8 is not set
|
||||
# CONFIG_ARCH_CHIP_STM32L152VB is not set
|
||||
# CONFIG_ARCH_CHIP_STM32L162ZD is not set
|
||||
# CONFIG_ARCH_CHIP_STM32L162VE is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F100C8 is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F100CB is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F100R8 is not set
|
||||
@ -184,6 +197,8 @@ CONFIG_SDIO_DMAPRIO=0x00010000
|
||||
# CONFIG_ARCH_CHIP_STM32F107VC is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F207IG is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F207ZE is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F302K6 is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F302K8 is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F302CB is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F302CC is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F302RB is not set
|
||||
@ -196,6 +211,24 @@ CONFIG_SDIO_DMAPRIO=0x00010000
|
||||
# CONFIG_ARCH_CHIP_STM32F303RC is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F303VB is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F303VC is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F372C8 is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F372R8 is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F372V8 is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F372CB is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F372RB is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F372VB is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F372CC is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F372RC is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F372VC is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F373C8 is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F373R8 is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F373V8 is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F373CB is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F373RB is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F373VB is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F373CC is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F373RC is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F373VC is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F401RE is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F411RE is not set
|
||||
# CONFIG_ARCH_CHIP_STM32F405RG is not set
|
||||
@ -228,6 +261,7 @@ CONFIG_ARCH_CHIP_STM32F407VG=y
|
||||
# CONFIG_STM32_STM32F20XX is not set
|
||||
# CONFIG_STM32_STM32F207 is not set
|
||||
# CONFIG_STM32_STM32F30XX is not set
|
||||
# CONFIG_STM32_STM32F37XX is not set
|
||||
CONFIG_STM32_STM32F40XX=y
|
||||
# CONFIG_STM32_STM32F401 is not set
|
||||
# CONFIG_STM32_STM32F411 is not set
|
||||
@ -328,6 +362,7 @@ CONFIG_STM32_USART6=y
|
||||
# CONFIG_STM32_IWDG is not set
|
||||
# CONFIG_STM32_WWDG is not set
|
||||
CONFIG_STM32_SPI=y
|
||||
# CONFIG_STM32_NOEXT_VECTORS is not set
|
||||
|
||||
#
|
||||
# Alternate Pin Mapping
|
||||
@ -362,6 +397,8 @@ CONFIG_STM32_USART=y
|
||||
#
|
||||
# SDIO Configuration
|
||||
#
|
||||
# CONFIG_STM32_HAVE_RTC_COUNTER is not set
|
||||
# CONFIG_STM32_HAVE_RTC_SUBSECONDS is not set
|
||||
|
||||
#
|
||||
# Ethernet MAC configuration
|
||||
@ -478,6 +515,12 @@ CONFIG_NSH_MMCSDSLOTNO=0
|
||||
# Board-Specific Options
|
||||
#
|
||||
CONFIG_STM32F4DISBB=y
|
||||
CONFIG_LIB_BOARDCTL=y
|
||||
# CONFIG_BOARDCTL_TSCTEST is not set
|
||||
# CONFIG_BOARDCTL_ADCTEST is not set
|
||||
# CONFIG_BOARDCTL_PWMTEST is not set
|
||||
# CONFIG_BOARDCTL_GRAPHICS is not set
|
||||
# CONFIG_BOARDCTL_IOCTL is not set
|
||||
|
||||
#
|
||||
# RTOS Features
|
||||
@ -606,11 +649,16 @@ CONFIG_SPI=y
|
||||
# CONFIG_SPI_OWNBUS is not set
|
||||
CONFIG_SPI_EXCHANGE=y
|
||||
# CONFIG_SPI_CMDDATA is not set
|
||||
# CONFIG_SPI_CALLBACK is not set
|
||||
# CONFIG_SPI_BITBANG is not set
|
||||
# CONFIG_I2S is not set
|
||||
|
||||
#
|
||||
# Timer Driver Support
|
||||
#
|
||||
# CONFIG_TIMER is not set
|
||||
# CONFIG_RTC is not set
|
||||
# CONFIG_WATCHDOG is not set
|
||||
# CONFIG_TIMER is not set
|
||||
# CONFIG_ANALOG is not set
|
||||
# CONFIG_AUDIO_DEVICES is not set
|
||||
# CONFIG_VIDEO_DEVICES is not set
|
||||
@ -658,10 +706,13 @@ CONFIG_NETDEVICES=y
|
||||
# CONFIG_ETH0_PHY_AM79C874 is not set
|
||||
# CONFIG_ETH0_PHY_KS8721 is not set
|
||||
# CONFIG_ETH0_PHY_KSZ8051 is not set
|
||||
# CONFIG_ETH0_PHY_KSZ8061 is not set
|
||||
# CONFIG_ETH0_PHY_KSZ8081 is not set
|
||||
# CONFIG_ETH0_PHY_KSZ90x1 is not set
|
||||
# CONFIG_ETH0_PHY_DP83848C is not set
|
||||
CONFIG_ETH0_PHY_LAN8720=y
|
||||
# CONFIG_ETH0_PHY_LAN8740 is not set
|
||||
# CONFIG_ETH0_PHY_LAN8740A is not set
|
||||
# CONFIG_ETH0_PHY_DM9161 is not set
|
||||
# CONFIG_PIPES is not set
|
||||
# CONFIG_PM is not set
|
||||
@ -703,7 +754,6 @@ CONFIG_STANDARD_SERIAL=y
|
||||
# CONFIG_SERIAL_IFLOWCONTROL is not set
|
||||
# CONFIG_SERIAL_OFLOWCONTROL is not set
|
||||
CONFIG_ARCH_HAVE_SERIAL_TERMIOS=y
|
||||
# CONFIG_SERIAL_TERMIOS is not set
|
||||
CONFIG_USART6_SERIAL_CONSOLE=y
|
||||
# CONFIG_OTHER_SERIAL_CONSOLE is not set
|
||||
# CONFIG_NO_SERIAL_CONSOLE is not set
|
||||
@ -755,6 +805,7 @@ CONFIG_NET_GUARDSIZE=2
|
||||
#
|
||||
# CONFIG_NET_MULTILINK is not set
|
||||
CONFIG_NET_ETHERNET=y
|
||||
# CONFIG_NET_TUN is not set
|
||||
|
||||
#
|
||||
# Network Device Operations
|
||||
@ -873,7 +924,6 @@ CONFIG_FAT_LFN=y
|
||||
CONFIG_FAT_MAXFNAME=32
|
||||
# CONFIG_FS_FATTIME is not set
|
||||
# CONFIG_FAT_DMAMEMORY is not set
|
||||
# CONFIG_NFS is not set
|
||||
# CONFIG_FS_NXFFS is not set
|
||||
# CONFIG_FS_ROMFS is not set
|
||||
# CONFIG_FS_SMARTFS is not set
|
||||
@ -944,6 +994,7 @@ CONFIG_LIBC_TMPDIR="/tmp"
|
||||
CONFIG_LIBC_MAX_TMPFILE=32
|
||||
CONFIG_ARCH_LOWPUTC=y
|
||||
# CONFIG_LIBC_LOCALTIME is not set
|
||||
# CONFIG_TIME_EXTENDED is not set
|
||||
CONFIG_LIB_SENDFILE_BUFSIZE=512
|
||||
# CONFIG_ARCH_ROMGETC is not set
|
||||
# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
|
||||
@ -1012,10 +1063,10 @@ CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
|
||||
# CONFIG_EXAMPLES_NXTEXT is not set
|
||||
# CONFIG_EXAMPLES_OSTEST is not set
|
||||
# CONFIG_EXAMPLES_PIPE is not set
|
||||
# CONFIG_EXAMPLES_PPPD is not set
|
||||
# CONFIG_EXAMPLES_POSIXSPAWN is not set
|
||||
# CONFIG_EXAMPLES_QENCODER is not set
|
||||
# CONFIG_EXAMPLES_RGMP is not set
|
||||
# CONFIG_EXAMPLES_ROMFS is not set
|
||||
# CONFIG_EXAMPLES_SENDMAIL is not set
|
||||
# CONFIG_EXAMPLES_SERIALBLASTER is not set
|
||||
# CONFIG_EXAMPLES_SERIALRX is not set
|
||||
@ -1058,7 +1109,6 @@ CONFIG_EXAMPLES_NSH_CXXINITIALIZE=y
|
||||
#
|
||||
# CONFIG_NETUTILS_CODECS is not set
|
||||
# CONFIG_NETUTILS_FTPC is not set
|
||||
# CONFIG_NETUTILS_FTPD is not set
|
||||
# CONFIG_NETUTILS_JSON is not set
|
||||
# CONFIG_NETUTILS_DNSCLIENT is not set
|
||||
# CONFIG_NETUTILS_SMTP is not set
|
||||
@ -1071,6 +1121,7 @@ CONFIG_NETUTILS_NETLIB=y
|
||||
# CONFIG_NETUTILS_NTPCLIENT is not set
|
||||
# CONFIG_NETUTILS_DISCOVER is not set
|
||||
# CONFIG_NETUTILS_XMLRPC is not set
|
||||
# CONFIG_NETUTILS_PPPD is not set
|
||||
|
||||
#
|
||||
# FreeModBus
|
||||
@ -1104,6 +1155,7 @@ CONFIG_NSH_BUILTIN_APPS=y
|
||||
# CONFIG_NSH_DISABLE_CD is not set
|
||||
# CONFIG_NSH_DISABLE_CP is not set
|
||||
# CONFIG_NSH_DISABLE_CMP is not set
|
||||
CONFIG_NSH_DISABLE_DATE=y
|
||||
# CONFIG_NSH_DISABLE_DD is not set
|
||||
# CONFIG_NSH_DISABLE_DF is not set
|
||||
# CONFIG_NSH_DISABLE_DELROUTE is not set
|
||||
@ -1125,6 +1177,7 @@ CONFIG_NSH_BUILTIN_APPS=y
|
||||
# CONFIG_NSH_DISABLE_MKRD is not set
|
||||
# CONFIG_NSH_DISABLE_MH is not set
|
||||
# CONFIG_NSH_DISABLE_MOUNT is not set
|
||||
# CONFIG_NSH_DISABLE_MV is not set
|
||||
# CONFIG_NSH_DISABLE_MW is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
# CONFIG_NSH_DISABLE_PUT is not set
|
||||
@ -1162,7 +1215,6 @@ CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_CONSOLE=y
|
||||
# CONFIG_NSH_ALTCONDEV is not set
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_LIB_BOARDCTL=y
|
||||
|
||||
#
|
||||
# Networking Configuration
|
||||
@ -1225,123 +1277,19 @@ CONFIG_NSH_MAX_ROUNDTRIP=20
|
||||
#
|
||||
# System Libraries and NSH Add-Ons
|
||||
#
|
||||
|
||||
#
|
||||
# Custom Free Memory Command
|
||||
#
|
||||
# CONFIG_SYSTEM_FREE is not set
|
||||
|
||||
#
|
||||
# EMACS-like Command Line Editor
|
||||
#
|
||||
# CONFIG_SYSTEM_CLE is not set
|
||||
|
||||
#
|
||||
# CU Minimal Terminal
|
||||
#
|
||||
# CONFIG_SYSTEM_CUTERM is not set
|
||||
|
||||
#
|
||||
# FLASH Program Installation
|
||||
#
|
||||
# CONFIG_SYSTEM_INSTALL is not set
|
||||
|
||||
#
|
||||
# FLASH Erase-all Command
|
||||
#
|
||||
|
||||
#
|
||||
# Intel HEX to binary conversion
|
||||
#
|
||||
# CONFIG_SYSTEM_HEX2BIN is not set
|
||||
|
||||
#
|
||||
# I2C tool
|
||||
#
|
||||
|
||||
#
|
||||
# INI File Parser
|
||||
#
|
||||
# CONFIG_SYSTEM_INIFILE is not set
|
||||
|
||||
#
|
||||
# NxPlayer media player library / command Line
|
||||
#
|
||||
|
||||
#
|
||||
# RAM test
|
||||
#
|
||||
# CONFIG_SYSTEM_RAMTEST is not set
|
||||
|
||||
#
|
||||
# readline()
|
||||
#
|
||||
CONFIG_SYSTEM_READLINE=y
|
||||
CONFIG_READLINE_ECHO=y
|
||||
|
||||
#
|
||||
# P-Code Support
|
||||
#
|
||||
|
||||
#
|
||||
# PHY Tool
|
||||
#
|
||||
|
||||
#
|
||||
# Power Off
|
||||
#
|
||||
# CONFIG_SYSTEM_POWEROFF is not set
|
||||
|
||||
#
|
||||
# RAMTRON
|
||||
#
|
||||
# CONFIG_SYSTEM_RAMTRON is not set
|
||||
|
||||
#
|
||||
# SD Card
|
||||
#
|
||||
# CONFIG_SYSTEM_SDCARD is not set
|
||||
|
||||
#
|
||||
# Sudoku
|
||||
#
|
||||
# CONFIG_SYSTEM_SUDOKU is not set
|
||||
|
||||
#
|
||||
# Sysinfo
|
||||
#
|
||||
# CONFIG_SYSTEM_SYSINFO is not set
|
||||
|
||||
#
|
||||
# Temperature
|
||||
#
|
||||
|
||||
#
|
||||
# VI Work-Alike Editor
|
||||
#
|
||||
# CONFIG_SYSTEM_VI is not set
|
||||
|
||||
#
|
||||
# Stack Monitor
|
||||
#
|
||||
|
||||
#
|
||||
# USB CDC/ACM Device Commands
|
||||
#
|
||||
|
||||
#
|
||||
# USB Composite Device Commands
|
||||
#
|
||||
|
||||
#
|
||||
# USB Mass Storage Device Commands
|
||||
#
|
||||
|
||||
#
|
||||
# USB Monitor
|
||||
#
|
||||
|
||||
#
|
||||
# Zmodem Commands
|
||||
#
|
||||
# CONFIG_SYSTEM_ZMODEM is not set
|
||||
|
@ -336,8 +336,8 @@ EXTERN const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link addres
|
||||
* of:
|
||||
*
|
||||
* 1. An 80-bit prefix of zeros,
|
||||
* 2. Te next 16 bits are one, and
|
||||
* 3. he remaining, least-significant 32 bits contain the IPv4 address.
|
||||
* 2. The next 16 bits are one, and
|
||||
* 3. The remaining, least-significant 32 bits contain the IPv4 address.
|
||||
*
|
||||
* This macro encodes an IPv4 address in an IPv6 address in this fashion.
|
||||
*
|
||||
@ -355,8 +355,8 @@ EXTERN const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link addres
|
||||
{ \
|
||||
memset(ipv6addr, 0, 5 * sizeof(uint16_t)); \
|
||||
ipv6addr[5] = 0xffff; \
|
||||
ipv6addr[6] = (uint16_t)((uint32_t)ip4addr >> 16); \
|
||||
ipv6addr[7] = (uint16_t)ip4addr & 0xffff; \
|
||||
ipv6addr[6] = (uint16_t)((uint32_t)ipv4addr >> 16); \
|
||||
ipv6addr[7] = (uint16_t)ipv4addr & 0xffff; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
|
@ -520,7 +520,7 @@ uint16_t ipv6_chksum(FAR struct net_driver_s *dev);
|
||||
* Function: netdev_ipv6_hdrlen
|
||||
*
|
||||
* Description:
|
||||
* Provide header lenght for interface based on device
|
||||
* Provide header length for interface based on device
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev Device structure pointer
|
||||
|
@ -87,8 +87,8 @@
|
||||
|
||||
/* Allocate a new ARP data callback */
|
||||
|
||||
#define arp_callback_alloc(conn) devif_callback_alloc(&(conn)->list)
|
||||
#define arp_callback_free(conn,cb) devif_callback_free(cb, &(conn)->list)
|
||||
#define arp_callback_alloc(dev) devif_callback_alloc(&(dev)->d_callbacks)
|
||||
#define arp_callback_free(dev,cb) devif_callback_free(cb, &(dev)->d_callbacks)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
@ -140,6 +140,7 @@ struct arp_send_s
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
uint8_t snd_ifname[IFNAMSIZ]; /* Interface name */
|
||||
#endif
|
||||
int16_t snd_result; /* The result of the send operation */
|
||||
in_addr_t snd_ipaddr; /* The IP address to be queried */
|
||||
};
|
||||
#endif
|
||||
@ -171,12 +172,6 @@ struct arp_notify_s
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_ARP_SEND
|
||||
/* This is the singleton "connection" structure */
|
||||
|
||||
extern struct arp_conn_s g_arp_conn;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
@ -52,10 +52,6 @@
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* This is the singleton "connection" structure */
|
||||
|
||||
struct arp_conn_s g_arp_conn;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@ -87,7 +83,7 @@ int arp_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
|
||||
|
||||
/* Perform the ARP callbacks */
|
||||
|
||||
(void)devif_callback_execute(dev, &g_arp_conn, ARP_POLL, g_arp_conn.list);
|
||||
(void)devif_callback_execute(dev, NULL, ARP_POLL, dev->d_callbacks);
|
||||
|
||||
/* Call back into the driver */
|
||||
|
||||
|
@ -81,6 +81,25 @@
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: arp_send_terminate
|
||||
****************************************************************************/
|
||||
|
||||
static void arp_send_terminate(FAR struct arp_send_s *state, int result)
|
||||
{
|
||||
/* Don't allow any further call backs. */
|
||||
|
||||
state->snd_sent = true;
|
||||
state->snd_result = (int16_t)result;
|
||||
state->snd_cb->flags = 0;
|
||||
state->snd_cb->priv = NULL;
|
||||
state->snd_cb->event = NULL;
|
||||
|
||||
/* Wake up the waiting thread */
|
||||
|
||||
sem_post(&state->snd_sem);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: arp_send_interrupt
|
||||
****************************************************************************/
|
||||
@ -95,18 +114,15 @@ static uint16_t arp_send_interrupt(FAR struct net_driver_s *dev,
|
||||
|
||||
if (state)
|
||||
{
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
/* Is this the device that we need to route this request? */
|
||||
/* Check if the network is still up */
|
||||
|
||||
if (strncmp((FAR const char *)dev->d_ifname, (FAR const char *)state->snd_ifname, IFNAMSIZ) != 0)
|
||||
if ((flags & NETDEV_DOWN) != 0)
|
||||
{
|
||||
/* No... pass on this one and wait for the device that we want */
|
||||
|
||||
nlldbg("ERROR: Interface is down\n");
|
||||
arp_send_terminate(state, -ENETUNREACH);
|
||||
return flags;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Check if the outgoing packet is available. It may have been claimed
|
||||
* by a send interrupt serving a different thread -OR- if the output
|
||||
* buffer currently contains unprocessed incoming data. In these cases
|
||||
@ -138,14 +154,7 @@ static uint16_t arp_send_interrupt(FAR struct net_driver_s *dev,
|
||||
|
||||
/* Don't allow any further call backs. */
|
||||
|
||||
state->snd_sent = true;
|
||||
state->snd_cb->flags = 0;
|
||||
state->snd_cb->priv = NULL;
|
||||
state->snd_cb->event = NULL;
|
||||
|
||||
/* Wake up the waiting thread */
|
||||
|
||||
sem_post(&state->snd_sem);
|
||||
arp_send_terminate(state, OK);
|
||||
}
|
||||
|
||||
return flags;
|
||||
@ -281,7 +290,7 @@ int arp_send(in_addr_t ipaddr)
|
||||
*/
|
||||
|
||||
save = net_lock();
|
||||
state.snd_cb = arp_callback_alloc(&g_arp_conn);
|
||||
state.snd_cb = arp_callback_alloc(dev);
|
||||
if (!state.snd_cb)
|
||||
{
|
||||
ndbg("ERROR: Failed to allocate a cllback\n");
|
||||
@ -332,6 +341,7 @@ int arp_send(in_addr_t ipaddr)
|
||||
/* Arm/re-arm the callback */
|
||||
|
||||
state.snd_sent = false;
|
||||
state.snd_result = -EBUSY;
|
||||
state.snd_cb->flags = ARP_POLL;
|
||||
state.snd_cb->priv = (FAR void *)&state;
|
||||
state.snd_cb->event = arp_send_interrupt;
|
||||
@ -356,6 +366,16 @@ int arp_send(in_addr_t ipaddr)
|
||||
}
|
||||
while (!state.snd_sent);
|
||||
|
||||
/* Check the result of the send operation */
|
||||
|
||||
ret = state.snd_result;
|
||||
if (ret < 0)
|
||||
{
|
||||
/* Break out on a send failure */
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Now wait for response to the ARP response to be received. The
|
||||
* optimal delay would be the work case round trip time.
|
||||
* NOTE: The network is locked.
|
||||
@ -372,6 +392,8 @@ int arp_send(in_addr_t ipaddr)
|
||||
|
||||
if (ret == OK)
|
||||
{
|
||||
/* Break out if arp_wait() fails */
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -381,7 +403,7 @@ int arp_send(in_addr_t ipaddr)
|
||||
}
|
||||
|
||||
sem_destroy(&state.snd_sem);
|
||||
arp_callback_free(&g_arp_conn, state.snd_cb);
|
||||
arp_callback_free(dev, state.snd_cb);
|
||||
errout_with_lock:
|
||||
net_unlock(save);
|
||||
errout:
|
||||
|
@ -61,61 +61,67 @@
|
||||
* TCP_ACKDATA, XYZ_NEWDATA, and TCP_CLOSE flags may be set at the same time,
|
||||
* whereas the others are mutually exclusive.
|
||||
*
|
||||
* TCP_ACKDATA IN: Signifies that the outstanding data was ACKed and
|
||||
* the socket layer should send out new data instead
|
||||
* of retransmitting the last data (TCP only)
|
||||
* OUT: Input state must be preserved on output.
|
||||
* TCP_ACKDATA IN: Signifies that the outstanding data was ACKed and
|
||||
* the socket layer should send out new data instead
|
||||
* of retransmitting the last data (TCP only)
|
||||
* OUT: Input state must be preserved on output.
|
||||
*
|
||||
* TCP_NEWDATA IN: Set to indicate that the peer has sent us new data.
|
||||
* UDP_NEWDATA OUT: Cleared (only) by the socket layer logic to indicate
|
||||
* PKT_NEWDATA that the new data was consumed, suppressing further
|
||||
* ICMP_NEWDATA attempts to process the new data.
|
||||
* TCP_NEWDATA IN: Set to indicate that the peer has sent us new data.
|
||||
* UDP_NEWDATA OUT: Cleared (only) by the socket layer logic to indicate
|
||||
* PKT_NEWDATA that the new data was consumed, suppressing further
|
||||
* ICMP_NEWDATA attempts to process the new data.
|
||||
* ICMPv6_NEWDATA
|
||||
*
|
||||
* TCP_SNDACK IN: Not used; always zero
|
||||
* OUT: Set by the socket layer if the new data was consumed
|
||||
* and an ACK should be sent in the response. (TCP only)
|
||||
* TCP_SNDACK IN: Not used; always zero
|
||||
* OUT: Set by the socket layer if the new data was consumed
|
||||
* and an ACK should be sent in the response. (TCP only)
|
||||
*
|
||||
* TCP_REXMIT IN: Tells the socket layer to retransmit the data that
|
||||
* was last sent. (TCP only)
|
||||
* OUT: Not used
|
||||
* TCP_REXMIT IN: Tells the socket layer to retransmit the data that
|
||||
* was last sent. (TCP only)
|
||||
* OUT: Not used
|
||||
*
|
||||
* ARP_POLL IN: Used for polling the socket layer. This is provided
|
||||
* TCP_POLL periodically from the drivers to support (1) timed
|
||||
* UDP_POLL operations, and (2) to check if the socket layer has
|
||||
* PKT_POLL data that it wants to send
|
||||
* ICMP_POLL OUT: Not used
|
||||
* ARP_POLL IN: Used for polling the socket layer. This is provided
|
||||
* TCP_POLL periodically from the drivers to support (1) timed
|
||||
* UDP_POLL operations, and (2) to check if the socket layer has
|
||||
* PKT_POLL data that it wants to send
|
||||
* ICMP_POLL OUT: Not used
|
||||
* ICMPv6_POLL
|
||||
*
|
||||
* TCP_BACKLOG IN: There is a new connection in the backlog list set
|
||||
* up by the listen() command. (TCP only)
|
||||
* OUT: Not used
|
||||
* TCP_BACKLOG IN: There is a new connection in the backlog list set
|
||||
* up by the listen() command. (TCP only)
|
||||
* OUT: Not used
|
||||
*
|
||||
* TCP_CLOSE IN: The remote host has closed the connection, thus the
|
||||
* connection has gone away. (TCP only)
|
||||
* OUT: The socket layer signals that it wants to close the
|
||||
* connection. (TCP only)
|
||||
* TCP_CLOSE IN: The remote host has closed the connection, thus the
|
||||
* connection has gone away. (TCP only)
|
||||
* OUT: The socket layer signals that it wants to close the
|
||||
* connection. (TCP only)
|
||||
*
|
||||
* TCP_ABORT IN: The remote host has aborted the connection, thus the
|
||||
* connection has gone away. (TCP only)
|
||||
* OUT: The socket layer signals that it wants to abort the
|
||||
* connection. (TCP only)
|
||||
* TCP_ABORT IN: The remote host has aborted the connection, thus the
|
||||
* connection has gone away. (TCP only)
|
||||
* OUT: The socket layer signals that it wants to abort the
|
||||
* connection. (TCP only)
|
||||
*
|
||||
* TCP_CONNECTED IN: We have got a connection from a remote host and have
|
||||
* set up a new connection for it, or an active connection
|
||||
* has been successfully established. (TCP only)
|
||||
* OUT: Not used
|
||||
* TCP_CONNECTED IN: We have got a connection from a remote host and have
|
||||
* set up a new connection for it, or an active connection
|
||||
* has been successfully established. (TCP only)
|
||||
* OUT: Not used
|
||||
*
|
||||
* TCP_TIMEDOUT IN: The connection has been aborted due to too many
|
||||
* retransmissions. (TCP only)
|
||||
* OUT: Not used
|
||||
* TCP_TIMEDOUT IN: The connection has been aborted due to too many
|
||||
* retransmissions. (TCP only)
|
||||
* OUT: Not used
|
||||
*
|
||||
* ICMP_ECHOREPLY IN: An ICMP Echo Reply has been received. Used to support
|
||||
* ICMPv6_ECHOREPLY ICMP ping from the socket layer. (ICMP only)
|
||||
* OUT: Cleared (only) by the socket layer logic to indicate
|
||||
* that the reply was processed, suppressing further
|
||||
* attempts to process the reply.
|
||||
* NETDEV_DOWN: IN: The network device has been taken down.
|
||||
* ICMP_ECHOREPLY IN: An ICMP Echo Reply has been received. Used to support
|
||||
* ICMP ping from the socket layer. (ICMPv4 only)
|
||||
* OUT: Cleared (only) by the socket layer logic to indicate
|
||||
* that the reply was processed, suppressing further
|
||||
* attempts to process the reply.
|
||||
* ICMPv6_ECHOREPLY IN: An ICMP Echo Reply has been received. Used to support
|
||||
* ICMP ping from the socket layer. (ICMPv6 only)
|
||||
* OUT: Cleared (only) by the socket layer logic to indicate
|
||||
* that the reply was processed, suppressing further
|
||||
* attempts to process the reply.
|
||||
* NETDEV_DOWN: IN: The network device has been taken down.
|
||||
* OUT: Not used
|
||||
*/
|
||||
|
||||
#define TCP_ACKDATA (1 << 0)
|
||||
@ -138,8 +144,8 @@
|
||||
#define TCP_CONNECTED (1 << 8)
|
||||
#define TCP_TIMEDOUT (1 << 9)
|
||||
#define ICMP_ECHOREPLY (1 << 10)
|
||||
#define ICMPv6_ECHOREPLY ICMP_ECHOREPLY
|
||||
#define NETDEV_DOWN (1 << 11)
|
||||
#define ICMPv6_ECHOREPLY (1 << 11)
|
||||
#define NETDEV_DOWN (1 << 12)
|
||||
|
||||
#define TCP_CONN_EVENTS (TCP_CLOSE | TCP_ABORT | TCP_CONNECTED | \
|
||||
TCP_TIMEDOUT | NETDEV_DOWN)
|
||||
@ -197,12 +203,6 @@ extern uint16_t g_ipid;
|
||||
extern uint8_t g_reassembly_timer;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING)
|
||||
/* List of applications waiting for ICMP ECHO REPLY */
|
||||
|
||||
extern struct devif_callback_s *g_icmp_echocallback;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
@ -285,8 +285,18 @@ void devif_callback_free(FAR struct devif_callback_s *cb,
|
||||
* This is called internally as part of uIP initialization and should not
|
||||
* be accessed from the application or socket layer.
|
||||
*
|
||||
* Input parameters:
|
||||
* dev - The network device state structure associated with the network
|
||||
* device that initiated the callback event.
|
||||
* pvconn - Holds a reference to the TCP connection structure or the UDP
|
||||
* port structure. May be NULL if the even is not related to a TCP
|
||||
* connection or UDP port.
|
||||
*
|
||||
* Returned value:
|
||||
* The updated flags as modified by the callback functions.
|
||||
*
|
||||
* Assumptions:
|
||||
* This function is called with interrupts disabled.
|
||||
* This function is called with the network locked.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -216,8 +216,18 @@ void devif_callback_free(FAR struct devif_callback_s *cb,
|
||||
* This is called internally as part of uIP initialization and should not
|
||||
* be accessed from the application or socket layer.
|
||||
*
|
||||
* Input parameters:
|
||||
* dev - The network device state structure associated with the network
|
||||
* device that initiated the callback event.
|
||||
* pvconn - Holds a reference to the TCP connection structure or the UDP
|
||||
* port structure. May be NULL if the even is not related to a TCP
|
||||
* connection or UDP port.
|
||||
*
|
||||
* Returned value:
|
||||
* The updated flags as modified by the callback functions.
|
||||
*
|
||||
* Assumptions:
|
||||
* This function is called with interrupts disabled.
|
||||
* This function is called with the network locked.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -162,7 +162,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
|
||||
g_netstats.ipv6.vhlerr++;
|
||||
#endif
|
||||
|
||||
nlldbg("Invalid IPv6 version: %d\n", ipv6->vtc >> 4);
|
||||
nlldbg("ERROR: Invalid IPv6 version: %d\n", ipv6->vtc >> 4);
|
||||
goto drop;
|
||||
}
|
||||
|
||||
@ -174,12 +174,12 @@ int ipv6_input(FAR struct net_driver_s *dev)
|
||||
*
|
||||
* The length reported in the IPv6 header is the length of the payload
|
||||
* that follows the header. The device interface uses the d_len variable for
|
||||
* holding the size of the entire packet, including the IP and link layer
|
||||
* headers.
|
||||
* holding the size of the entire packet, including the IP header and link
|
||||
* layer header.
|
||||
*/
|
||||
|
||||
pktlen = (ipv6->len[0] << 8) + ipv6->len[1] + IPv6_HDRLEN + netdev_ip +
|
||||
netdev_ipv6_hdrlen(dev);
|
||||
pktlen = ((uint16_t)ipv6->len[0] << 8) + (uint16_t)ipv6->len[1] +
|
||||
IPv6_HDRLEN + netdev_ipv6_hdrlen(dev);
|
||||
|
||||
if (pktlen <= dev->d_len)
|
||||
{
|
||||
@ -187,7 +187,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
|
||||
}
|
||||
else
|
||||
{
|
||||
nlldbg("IP packet shorter than length in IP header\n");
|
||||
nlldbg("ERROR: IP packet shorter than length in IP header\n");
|
||||
goto drop;
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
|
||||
* packets.
|
||||
*/
|
||||
|
||||
nlldbg("No IP address assigned\n");
|
||||
nlldbg("ERROR: No IP address assigned\n");
|
||||
goto drop;
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
|
||||
g_netstats.ipv6.protoerr++;
|
||||
#endif
|
||||
|
||||
nlldbg("Unrecognized IP protocol: %04x\n", ipv6->proto);
|
||||
nlldbg("ERROR: Unrecognized IP protocol: %04x\n", ipv6->proto);
|
||||
goto drop;
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,8 @@
|
||||
|
||||
/* Allocate a new ICMP data callback */
|
||||
|
||||
#define icmp_callback_alloc() devif_callback_alloc(&dev->d_callbacks)
|
||||
#define icmp_callback_free(cb) devif_callback_free(cb, &dev->d_callbacks)
|
||||
#define icmp_callback_alloc(dev) devif_callback_alloc(&(dev)->d_callbacks)
|
||||
#define icmp_callback_free(dev,cb) devif_callback_free(cb, &(dev)->d_callbacks)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
@ -162,12 +162,10 @@ static uint16_t ping_interrupt(FAR struct net_driver_s *dev, FAR void *conn,
|
||||
int i;
|
||||
|
||||
nllvdbg("flags: %04x\n", flags);
|
||||
|
||||
if (pstate)
|
||||
{
|
||||
/* Check if the network is still up
|
||||
*
|
||||
* REVISIT: Now does the ICMP logic know that this was the correct device?
|
||||
*/
|
||||
/* Check if the network is still up */
|
||||
|
||||
if ((flags & NETDEV_DOWN) != 0)
|
||||
{
|
||||
@ -340,24 +338,25 @@ end_wait:
|
||||
int icmp_ping(in_addr_t addr, uint16_t id, uint16_t seqno, uint16_t datalen,
|
||||
int dsecs)
|
||||
{
|
||||
FAR struct net_driver_s *dev;
|
||||
struct icmp_ping_s state;
|
||||
net_lock_t save;
|
||||
#ifdef CONFIG_NET_ARP_SEND
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
FAR struct net_driver_s *dev;
|
||||
|
||||
/* Get the device that will be used to route this ICMP ECHO request */
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
dev = netdev_findby_ipv4addr(g_ipv4_allzeroaddr, addr);
|
||||
#else
|
||||
dev = netdev_findby_ipv4addr(addr);
|
||||
#endif
|
||||
if (dev == 0)
|
||||
{
|
||||
ndbg("ERROR: Not reachable\n");
|
||||
return -ENETUNREACH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_ARP_SEND
|
||||
/* Make sure that the IP address mapping is in the ARP table */
|
||||
@ -386,7 +385,7 @@ int icmp_ping(in_addr_t addr, uint16_t id, uint16_t seqno, uint16_t datalen,
|
||||
|
||||
/* Set up the callback */
|
||||
|
||||
state.png_cb = icmp_callback_alloc();
|
||||
state.png_cb = icmp_callback_alloc(dev);
|
||||
if (state.png_cb)
|
||||
{
|
||||
state.png_cb->flags = (ICMP_POLL | ICMP_ECHOREPLY | NETDEV_DOWN);
|
||||
@ -396,11 +395,7 @@ int icmp_ping(in_addr_t addr, uint16_t id, uint16_t seqno, uint16_t datalen,
|
||||
|
||||
/* Notify the device driver of the availability of TX data */
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
netdev_ipv4_txnotify_dev(dev);
|
||||
#else
|
||||
netdev_ipv4_txnotify(state.png_addr);
|
||||
#endif
|
||||
netdev_txnotify_dev(dev);
|
||||
|
||||
/* Wait for either the full round trip transfer to complete or
|
||||
* for timeout to occur. (1) net_lockedwait will also terminate if a
|
||||
@ -412,7 +407,7 @@ int icmp_ping(in_addr_t addr, uint16_t id, uint16_t seqno, uint16_t datalen,
|
||||
nllvdbg("Start time: 0x%08x seqno: %d\n", state.png_time, seqno);
|
||||
net_lockedwait(&state.png_sem);
|
||||
|
||||
icmp_callback_free(state.png_cb);
|
||||
icmp_callback_free(dev, state.png_cb);
|
||||
}
|
||||
|
||||
net_unlock(save);
|
||||
|
@ -55,8 +55,8 @@
|
||||
|
||||
/* Allocate a new ICMPv6 data callback */
|
||||
|
||||
#define icmpv6_callback_alloc() devif_callback_alloc(&g_icmpv6_conn.list)
|
||||
#define icmpv6_callback_free(cb) devif_callback_free(cb, &g_icmpv6_conn.list)
|
||||
#define icmpv6_callback_alloc(dev) devif_callback_alloc(&(dev)->d_callbacks)
|
||||
#define icmpv6_callback_free(dev,cb) devif_callback_free(cb, &(dev)->d_callbacks)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
@ -112,12 +112,6 @@ extern "C"
|
||||
# define EXTERN extern
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET_ICMPv6_PING) || defined(CONFIG_NET_ICMPv6_NEIGHBOR)
|
||||
/* This is the singleton "connection" structure for TX polls and echo replies */
|
||||
|
||||
EXTERN struct icmpv6_conn_s g_icmpv6_conn;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
@ -78,12 +78,6 @@
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_ICMPv6_PING) || defined(CONFIG_NET_ICMPv6_NEIGHBOR)
|
||||
/* This is the singleton "connection" structure for TX polls and echo replies */
|
||||
|
||||
struct icmpv6_conn_s g_icmpv6_conn;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@ -297,7 +291,7 @@ void icmpv6_input(FAR struct net_driver_s *dev)
|
||||
|
||||
/* Dispatch the ECHO reply to the waiting thread */
|
||||
|
||||
flags = devif_callback_execute(dev, icmp, flags, g_icmpv6_conn.list);
|
||||
flags = devif_callback_execute(dev, icmp, flags, dev->d_callbacks);
|
||||
|
||||
/* If the ECHO reply was not handled, then drop the packet */
|
||||
|
||||
|
@ -295,7 +295,7 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr)
|
||||
*/
|
||||
|
||||
save = net_lock();
|
||||
state.snd_cb = icmpv6_callback_alloc();
|
||||
state.snd_cb = icmpv6_callback_alloc(dev);
|
||||
if (!state.snd_cb)
|
||||
{
|
||||
ndbg("ERROR: Failed to allocate a cllback\n");
|
||||
@ -395,7 +395,7 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr)
|
||||
}
|
||||
|
||||
sem_destroy(&state.snd_sem);
|
||||
icmpv6_callback_free(state.snd_cb);
|
||||
icmpv6_callback_free(dev, state.snd_cb);
|
||||
errout_with_lock:
|
||||
net_unlock(save);
|
||||
errout:
|
||||
|
@ -257,13 +257,22 @@ static uint16_t ping_interrupt(FAR struct net_driver_s *dev, FAR void *conn,
|
||||
|
||||
if (pstate)
|
||||
{
|
||||
/* Check if the network is still up */
|
||||
|
||||
if ((flags & NETDEV_DOWN) != 0)
|
||||
{
|
||||
nlldbg("ERROR: Interface is down\n");
|
||||
pstate->png_result = -ENETUNREACH;
|
||||
goto end_wait;
|
||||
}
|
||||
|
||||
/* Check if this is a ICMPv6 ECHO reply. If so, return the sequence
|
||||
* number to the caller. NOTE: We may not even have sent the
|
||||
* requested ECHO request; this could have been the delayed ECHO
|
||||
* response from a previous ping.
|
||||
*/
|
||||
|
||||
if ((flags & ICMPv6_ECHOREPLY) != 0 && conn != NULL)
|
||||
else if ((flags & ICMPv6_ECHOREPLY) != 0 && conn != NULL)
|
||||
{
|
||||
FAR struct icmpv6_echo_reply_s *reply = ICMPv6ECHOREPLY;
|
||||
|
||||
@ -396,6 +405,7 @@ end_wait:
|
||||
int icmpv6_ping(net_ipv6addr_t addr, uint16_t id, uint16_t seqno,
|
||||
uint16_t datalen, int dsecs)
|
||||
{
|
||||
FAR struct net_driver_s *dev;
|
||||
struct icmpv6_ping_s state;
|
||||
net_lock_t save;
|
||||
|
||||
@ -412,6 +422,19 @@ int icmpv6_ping(net_ipv6addr_t addr, uint16_t id, uint16_t seqno,
|
||||
}
|
||||
#endif /* CONFIG_NET_ICMPv6_NEIGHBOR */
|
||||
|
||||
/* Get the device that will be used to route this ICMP ECHO request */
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
dev = netdev_findby_ipv6addr(g_ipv6_allzeroaddr, addr);
|
||||
#else
|
||||
dev = netdev_findby_ipv6addr(addr);
|
||||
#endif
|
||||
if (dev == 0)
|
||||
{
|
||||
ndbg("ERROR: Not reachable\n");
|
||||
return -ENETUNREACH;
|
||||
}
|
||||
|
||||
/* Initialize the state structure */
|
||||
|
||||
sem_init(&state.png_sem, 0, 0);
|
||||
@ -429,7 +452,7 @@ int icmpv6_ping(net_ipv6addr_t addr, uint16_t id, uint16_t seqno,
|
||||
|
||||
/* Set up the callback */
|
||||
|
||||
state.png_cb = icmpv6_callback_alloc();
|
||||
state.png_cb = icmpv6_callback_alloc(dev);
|
||||
if (state.png_cb)
|
||||
{
|
||||
state.png_cb->flags = (ICMPv6_POLL | ICMPv6_ECHOREPLY);
|
||||
@ -439,11 +462,7 @@ int icmpv6_ping(net_ipv6addr_t addr, uint16_t id, uint16_t seqno,
|
||||
|
||||
/* Notify the device driver of the availability of TX data */
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
netdev_ipv6_txnotify(g_ipv6_allzeroaddr, state.png_addr);
|
||||
#else
|
||||
netdev_ipv6_txnotify(state.png_addr);
|
||||
#endif
|
||||
netdev_txnotify_dev(dev);
|
||||
|
||||
/* Wait for either the full round trip transfer to complete or
|
||||
* for timeout to occur. (1) net_lockedwait will also terminate if a
|
||||
@ -455,7 +474,7 @@ int icmpv6_ping(net_ipv6addr_t addr, uint16_t id, uint16_t seqno,
|
||||
nllvdbg("Start time: 0x%08x seqno: %d\n", state.png_time, seqno);
|
||||
net_lockedwait(&state.png_sem);
|
||||
|
||||
icmpv6_callback_free(state.png_cb);
|
||||
icmpv6_callback_free(dev, state.png_cb);
|
||||
}
|
||||
|
||||
net_unlock(save);
|
||||
|
@ -97,7 +97,7 @@ void icmpv6_poll(FAR struct net_driver_s *dev)
|
||||
|
||||
/* Perform the application callback */
|
||||
|
||||
(void)devif_callback_execute(dev, NULL, ICMPv6_POLL, g_icmpv6_conn.list);
|
||||
(void)devif_callback_execute(dev, NULL, ICMPv6_POLL, dev->d_callbacks);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET_ICMPv6_PING || CONFIG_NET_ICMPv6_NEIGHBOR */
|
||||
|
@ -130,7 +130,6 @@ FAR struct net_driver_s *netdev_default(void);
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
# ifdef CONFIG_NETDEV_MULTINIC
|
||||
void netdev_ipv4_txnotify(in_addr_t lipaddr, in_addr_t ripaddr);
|
||||
void netdev_ipv4_txnotify_dev(FAR struct net_driver_s *dev);
|
||||
# else
|
||||
void netdev_ipv4_txnotify(in_addr_t ripaddr);
|
||||
# endif
|
||||
@ -146,6 +145,8 @@ void netdev_ipv6_txnotify(FAR const net_ipv6addr_t ripaddr);
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
#endif /* CONFIG_NSOCKET_DESCRIPTORS > 0 */
|
||||
|
||||
void netdev_txnotify_dev(FAR struct net_driver_s *dev);
|
||||
|
||||
/* netdev_rxnotify.c *********************************************************/
|
||||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET_RXAVAIL)
|
||||
|
@ -167,7 +167,7 @@ void netdev_ipv6_txnotify(FAR const net_ipv6addr_t ripaddr)
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
/****************************************************************************
|
||||
* Function: netdev_ipv4_txnotify_dev
|
||||
* Function: netdev_txnotify_dev
|
||||
*
|
||||
* Description:
|
||||
* Notify the device driver that new TX data is available. This variant
|
||||
@ -185,8 +185,7 @@ void netdev_ipv6_txnotify(FAR const net_ipv6addr_t ripaddr)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
void netdev_ipv4_txnotify_dev(FAR struct net_driver_s *dev)
|
||||
void netdev_txnotify_dev(FAR struct net_driver_s *dev)
|
||||
{
|
||||
if (dev && dev->d_txavail)
|
||||
{
|
||||
@ -195,6 +194,5 @@ void netdev_ipv4_txnotify_dev(FAR struct net_driver_s *dev)
|
||||
(void)dev->d_txavail(dev);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */
|
||||
|
@ -963,12 +963,8 @@ static inline void recvfrom_udpsender(struct net_driver_s *dev, struct recvfrom_
|
||||
|
||||
if (infrom)
|
||||
{
|
||||
FAR struct udp_hdr_s *udp = UDPIPv4BUF;
|
||||
FAR struct ipv4_hdr_s *ipv4 = IPv4BUF;
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
FAR struct udp_conn_s *conn = (FAR struct udp_conn_s*)pstate->rf_sock->s_conn;
|
||||
FAR struct sockaddr_in6 *infrom6 = (FAR struct sockaddr_in6 *)infrom;
|
||||
|
||||
/* Hybrid dual-stack IPv6/IPv4 implementations recognize a special
|
||||
* class of addresses, the IPv4-mapped IPv6 addresses.
|
||||
@ -976,7 +972,10 @@ static inline void recvfrom_udpsender(struct net_driver_s *dev, struct recvfrom_
|
||||
|
||||
if (conn->domain == PF_INET6)
|
||||
{
|
||||
FAR struct sockaddr_in6 *infrom6 = (FAR struct sockaddr_in6 *)infrom;
|
||||
FAR socklen_t *fromlen = pstate->rf_fromlen;
|
||||
FAR struct udp_hdr_s *udp = UDPIPv6BUF;
|
||||
FAR struct ipv6_hdr_s *ipv6 = IPv6BUF;
|
||||
in_addr_t ipv4addr;
|
||||
|
||||
/* Encode the IPv4 address as an IPv4-mapped IPv6 address */
|
||||
@ -985,13 +984,15 @@ static inline void recvfrom_udpsender(struct net_driver_s *dev, struct recvfrom_
|
||||
infrom6->sin6_port = udp->srcport;
|
||||
*fromlen = sizeof(struct sockaddr_in6);
|
||||
|
||||
ipv4addr = net_ip4addr_conv32(ipv4->srcipaddr);
|
||||
ip6_map_ipv4addr(ipv4addr,
|
||||
(net_ipv6addr_t)src_addr6.sin6_addr.s6_addr16);
|
||||
ipv4addr = net_ip4addr_conv32(ipv6->srcipaddr);
|
||||
ip6_map_ipv4addr(ipv4addr, infrom6->sin6_addr.s6_addr16);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
FAR struct udp_hdr_s *udp = UDPIPv4BUF;
|
||||
FAR struct ipv4_hdr_s *ipv4 = IPv4BUF;
|
||||
|
||||
infrom->sin_family = AF_INET;
|
||||
infrom->sin_port = udp->srcport;
|
||||
|
||||
|
@ -129,9 +129,6 @@ static uint16_t udp_datahandler(FAR struct net_driver_s *dev, FAR struct udp_con
|
||||
else
|
||||
#endif
|
||||
{
|
||||
FAR struct udp_hdr_s *udp = UDPIPv4BUF;
|
||||
FAR struct ipv4_hdr_s *ipv4 = IPv4BUF;
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
/* Hybrid dual-stack IPv6/IPv4 implementations recognize a special
|
||||
* class of addresses, the IPv4-mapped IPv6 addresses.
|
||||
@ -139,6 +136,8 @@ static uint16_t udp_datahandler(FAR struct net_driver_s *dev, FAR struct udp_con
|
||||
|
||||
if (conn->domain == PF_INET6)
|
||||
{
|
||||
FAR struct udp_hdr_s *udp = UDPIPv6BUF;
|
||||
FAR struct ipv6_hdr_s *ipv6 = IPv6BUF;
|
||||
in_addr_t ipv4addr;
|
||||
|
||||
/* Encode the IPv4 address as an IPv-mapped IPv6 address */
|
||||
@ -146,9 +145,8 @@ static uint16_t udp_datahandler(FAR struct net_driver_s *dev, FAR struct udp_con
|
||||
src_addr6.sin6_family = AF_INET6;
|
||||
src_addr6.sin6_port = udp->srcport;
|
||||
|
||||
ipv4addr = net_ip4addr_conv32(ipv4->srcipaddr);
|
||||
ip6_map_ipv4addr(ipv4addr,
|
||||
(net_ipv6addr_t)src_addr6.sin6_addr.s6_addr16);
|
||||
ipv4addr = net_ip4addr_conv32(ipv6->srcipaddr);
|
||||
ip6_map_ipv4addr(ipv4addr, src_addr6.sin6_addr.s6_addr16);
|
||||
|
||||
src_addr_size = sizeof(src_addr6);
|
||||
src_addr = &src_addr6;
|
||||
@ -156,6 +154,9 @@ static uint16_t udp_datahandler(FAR struct net_driver_s *dev, FAR struct udp_con
|
||||
else
|
||||
#endif
|
||||
{
|
||||
FAR struct udp_hdr_s *udp = UDPIPv4BUF;
|
||||
FAR struct ipv4_hdr_s *ipv4 = IPv4BUF;
|
||||
|
||||
src_addr4.sin_family = AF_INET;
|
||||
src_addr4.sin_port = udp->srcport;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user