Clean up ICMP naming
This commit is contained in:
parent
4b3bec6bf3
commit
92d3075ae0
@ -110,7 +110,7 @@
|
|||||||
|
|
||||||
/* The ICMP and IP headers */
|
/* The ICMP and IP headers */
|
||||||
|
|
||||||
struct uip_icmpip_hdr
|
struct icmp_iphdr_s
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ struct uip_icmpip_hdr
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_STATISTICS
|
#ifdef CONFIG_NET_STATISTICS
|
||||||
struct uip_icmp_stats_s
|
struct icmp_stats_s
|
||||||
{
|
{
|
||||||
uip_stats_t drop; /* Number of dropped ICMP packets */
|
uip_stats_t drop; /* Number of dropped ICMP packets */
|
||||||
uip_stats_t recv; /* Number of received ICMP packets */
|
uip_stats_t recv; /* Number of received ICMP packets */
|
||||||
|
@ -178,7 +178,7 @@ struct uip_igmphdr_s
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_NET_STATISTICS
|
#ifdef CONFIG_NET_STATISTICS
|
||||||
struct uip_igmp_stats_s
|
struct igmp_stats_s
|
||||||
{
|
{
|
||||||
uint32_t length_errors;
|
uint32_t length_errors;
|
||||||
uint32_t chksum_errors;
|
uint32_t chksum_errors;
|
||||||
|
@ -389,7 +389,6 @@ uint16_t uip_ipchksum(struct uip_driver_s *dev);
|
|||||||
|
|
||||||
uint16_t tcp_chksum(struct uip_driver_s *dev);
|
uint16_t tcp_chksum(struct uip_driver_s *dev);
|
||||||
uint16_t udp_chksum(struct uip_driver_s *dev);
|
uint16_t udp_chksum(struct uip_driver_s *dev);
|
||||||
uint16_t uip_icmpchksum(struct uip_driver_s *dev, int len);
|
uint16_t icmp_chksum(struct uip_driver_s *dev, int len);
|
||||||
|
|
||||||
#endif /* __INCLUDE_NUTTX_NET_NETDEV_H */
|
#endif /* __INCLUDE_NUTTX_NET_NETDEV_H */
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ struct uip_callback_s
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_STATISTICS
|
#ifdef CONFIG_NET_STATISTICS
|
||||||
struct uip_ip_stats_s
|
struct ip_stats_s
|
||||||
{
|
{
|
||||||
uip_stats_t drop; /* Number of dropped packets at the IP layer */
|
uip_stats_t drop; /* Number of dropped packets at the IP layer */
|
||||||
uip_stats_t recv; /* Number of received packets at the IP layer */
|
uip_stats_t recv; /* Number of received packets at the IP layer */
|
||||||
@ -270,14 +270,14 @@ struct uip_ip_stats_s
|
|||||||
|
|
||||||
struct uip_stats
|
struct uip_stats
|
||||||
{
|
{
|
||||||
struct uip_ip_stats_s ip; /* IP statistics */
|
struct ip_stats_s ip; /* IP statistics */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ICMP
|
#ifdef CONFIG_NET_ICMP
|
||||||
struct uip_icmp_stats_s icmp; /* ICMP statistics */
|
struct icmp_stats_s icmp; /* ICMP statistics */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IGMP
|
#ifdef CONFIG_NET_IGMP
|
||||||
struct uip_igmp_stats_s igmp; /* IGMP statistics */
|
struct igmp_stats_s igmp; /* IGMP statistics */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET_TCP
|
#ifdef CONFIG_NET_TCP
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* net/icmp/icmp_input.c
|
* net/icmp/icmp_input.c
|
||||||
* Handling incoming ICMP/ICMP6 input
|
* Handling incoming ICMP/ICMP6 input
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2012, 2014 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Adapted for NuttX from logic in uIP which also has a BSD-like license:
|
* Adapted for NuttX from logic in uIP which also has a BSD-like license:
|
||||||
@ -54,6 +54,7 @@
|
|||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
|
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
|
#include "icmp/icmp.h"
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ICMP
|
#ifdef CONFIG_NET_ICMP
|
||||||
|
|
||||||
@ -61,7 +62,7 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define ICMPBUF ((struct uip_icmpip_hdr *)&dev->d_buf[UIP_LLH_LEN])
|
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[UIP_LLH_LEN])
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Variables
|
* Public Variables
|
||||||
@ -72,7 +73,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ICMP_PING
|
#ifdef CONFIG_NET_ICMP_PING
|
||||||
struct uip_callback_s *g_echocallback = NULL;
|
FAR struct uip_callback_s *g_echocallback = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -84,7 +85,7 @@ struct uip_callback_s *g_echocallback = NULL;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_icmpinput
|
* Name: icmp_input
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Handle incoming ICMP/ICMP6 input
|
* Handle incoming ICMP/ICMP6 input
|
||||||
@ -101,9 +102,9 @@ struct uip_callback_s *g_echocallback = NULL;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void uip_icmpinput(struct uip_driver_s *dev)
|
void icmp_input(FAR struct uip_driver_s *dev)
|
||||||
{
|
{
|
||||||
struct uip_icmpip_hdr *picmp = ICMPBUF;
|
FAR struct icmp_iphdr_s *picmp = ICMPBUF;
|
||||||
|
|
||||||
#ifdef CONFIG_NET_STATISTICS
|
#ifdef CONFIG_NET_STATISTICS
|
||||||
uip_stat.icmp.recv++;
|
uip_stat.icmp.recv++;
|
||||||
@ -146,7 +147,7 @@ void uip_icmpinput(struct uip_driver_s *dev)
|
|||||||
/* The slow way... sum over the ICMP message */
|
/* The slow way... sum over the ICMP message */
|
||||||
|
|
||||||
picmp->icmpchksum = 0;
|
picmp->icmpchksum = 0;
|
||||||
picmp->icmpchksum = ~uip_icmpchksum(dev, (((uint16_t)picmp->len[0] << 8) | (uint16_t)picmp->len[1]) - UIP_IPH_LEN);
|
picmp->icmpchksum = ~icmp_chksum(dev, (((uint16_t)picmp->len[0] << 8) | (uint16_t)picmp->len[1]) - UIP_IPH_LEN);
|
||||||
if (picmp->icmpchksum == 0)
|
if (picmp->icmpchksum == 0)
|
||||||
{
|
{
|
||||||
picmp->icmpchksum = 0xffff;
|
picmp->icmpchksum = 0xffff;
|
||||||
@ -235,7 +236,7 @@ typeerr:
|
|||||||
picmp->options[1] = 1; /* Options length, 1 = 8 bytes. */
|
picmp->options[1] = 1; /* Options length, 1 = 8 bytes. */
|
||||||
memcpy(&(picmp->options[2]), &dev->d_mac, IFHWADDRLEN);
|
memcpy(&(picmp->options[2]), &dev->d_mac, IFHWADDRLEN);
|
||||||
picmp->icmpchksum = 0;
|
picmp->icmpchksum = 0;
|
||||||
picmp->icmpchksum = ~uip_icmp6chksum(dev);
|
picmp->icmpchksum = ~icmp_6chksum(dev);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -254,7 +255,7 @@ typeerr:
|
|||||||
uiphdr_ipaddr_copy(picmp->destipaddr, picmp->srcipaddr);
|
uiphdr_ipaddr_copy(picmp->destipaddr, picmp->srcipaddr);
|
||||||
uiphdr_ipaddr_copy(picmp->srcipaddr, &dev->d_ipaddr);
|
uiphdr_ipaddr_copy(picmp->srcipaddr, &dev->d_ipaddr);
|
||||||
picmp->icmpchksum = 0;
|
picmp->icmpchksum = 0;
|
||||||
picmp->icmpchksum = ~uip_icmp6chksum(dev);
|
picmp->icmpchksum = ~icmp_6chksum(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If an ICMP echo reply is received then there should also be
|
/* If an ICMP echo reply is received then there should also be
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/icmp/icmp_ping.c
|
* net/icmp/icmp_ping.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2012, 2014 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -54,19 +54,21 @@
|
|||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
|
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
#include "../net.h" /* Should not include this! */
|
#include "icmp/icmp.h"
|
||||||
|
|
||||||
|
#include "net.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define ICMPBUF ((struct uip_icmpip_hdr *)&dev->d_buf[UIP_LLH_LEN])
|
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[UIP_LLH_LEN])
|
||||||
#define ICMPDAT (&dev->d_buf[UIP_LLH_LEN + sizeof(struct uip_icmpip_hdr)])
|
#define ICMPDAT (&dev->d_buf[UIP_LLH_LEN + sizeof(struct icmp_iphdr_s)])
|
||||||
|
|
||||||
/* Allocate a new ICMP data callback */
|
/* Allocate a new ICMP data callback */
|
||||||
|
|
||||||
#define uip_icmpcallbackalloc() uip_callbackalloc(&g_echocallback)
|
#define icmp_callbackalloc() uip_callbackalloc(&g_echocallback)
|
||||||
#define uip_icmpcallbackfree(cb) uip_callbackfree(cb, &g_echocallback)
|
#define icmp_callbackfree(cb) uip_callbackfree(cb, &g_echocallback)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
@ -116,7 +118,7 @@ struct icmp_ping_s
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static inline int ping_timeout(struct icmp_ping_s *pstate)
|
static inline int ping_timeout(FAR struct icmp_ping_s *pstate)
|
||||||
{
|
{
|
||||||
uint32_t elapsed = clock_systimer() - pstate->png_time;
|
uint32_t elapsed = clock_systimer() - pstate->png_time;
|
||||||
if (elapsed >= pstate->png_ticks)
|
if (elapsed >= pstate->png_ticks)
|
||||||
@ -148,11 +150,11 @@ static inline int ping_timeout(struct icmp_ping_s *pstate)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static uint16_t ping_interrupt(struct uip_driver_s *dev, void *conn,
|
static uint16_t ping_interrupt(FAR struct uip_driver_s *dev, FAR void *conn,
|
||||||
void *pvpriv, uint16_t flags)
|
FAR void *pvpriv, uint16_t flags)
|
||||||
{
|
{
|
||||||
struct icmp_ping_s *pstate = (struct icmp_ping_s *)pvpriv;
|
FAR struct icmp_ping_s *pstate = (struct icmp_ping_s *)pvpriv;
|
||||||
uint8_t *ptr;
|
FAR uint8_t *ptr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
nllvdbg("flags: %04x\n", flags);
|
nllvdbg("flags: %04x\n", flags);
|
||||||
@ -166,7 +168,8 @@ static uint16_t ping_interrupt(struct uip_driver_s *dev, void *conn,
|
|||||||
|
|
||||||
if ((flags & UIP_ECHOREPLY) != 0 && conn != NULL)
|
if ((flags & UIP_ECHOREPLY) != 0 && conn != NULL)
|
||||||
{
|
{
|
||||||
struct uip_icmpip_hdr *icmp = (struct uip_icmpip_hdr *)conn;
|
FAR struct icmp_iphdr_s *icmp = (FAR struct icmp_iphdr_s *)conn;
|
||||||
|
|
||||||
nlldbg("ECHO reply: id=%d seqno=%d\n",
|
nlldbg("ECHO reply: id=%d seqno=%d\n",
|
||||||
ntohs(icmp->id), ntohs(icmp->seqno));
|
ntohs(icmp->id), ntohs(icmp->seqno));
|
||||||
|
|
||||||
@ -202,7 +205,7 @@ static uint16_t ping_interrupt(struct uip_driver_s *dev, void *conn,
|
|||||||
(flags & UIP_NEWDATA) == 0 && /* No incoming data */
|
(flags & UIP_NEWDATA) == 0 && /* No incoming data */
|
||||||
!pstate->png_sent) /* Request not sent */
|
!pstate->png_sent) /* Request not sent */
|
||||||
{
|
{
|
||||||
struct uip_icmpip_hdr *picmp = ICMPBUF;
|
FAR struct icmp_iphdr_s *picmp = ICMPBUF;
|
||||||
|
|
||||||
/* We can send the ECHO request now.
|
/* We can send the ECHO request now.
|
||||||
*
|
*
|
||||||
@ -232,7 +235,7 @@ static uint16_t ping_interrupt(struct uip_driver_s *dev, void *conn,
|
|||||||
nlldbg("Send ECHO request: seqno=%d\n", pstate->png_seqno);
|
nlldbg("Send ECHO request: seqno=%d\n", pstate->png_seqno);
|
||||||
|
|
||||||
dev->d_sndlen = pstate->png_datlen + 4;
|
dev->d_sndlen = pstate->png_datlen + 4;
|
||||||
uip_icmpsend(dev, &pstate->png_addr);
|
icmp_send(dev, &pstate->png_addr);
|
||||||
pstate->png_sent = true;
|
pstate->png_sent = true;
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
@ -342,7 +345,7 @@ int uip_ping(uip_ipaddr_t addr, uint16_t id, uint16_t seqno,
|
|||||||
|
|
||||||
/* Set up the callback */
|
/* Set up the callback */
|
||||||
|
|
||||||
state.png_cb = uip_icmpcallbackalloc();
|
state.png_cb = icmp_callbackalloc();
|
||||||
if (state.png_cb)
|
if (state.png_cb)
|
||||||
{
|
{
|
||||||
state.png_cb->flags = UIP_POLL|UIP_ECHOREPLY;
|
state.png_cb->flags = UIP_POLL|UIP_ECHOREPLY;
|
||||||
@ -364,7 +367,7 @@ int uip_ping(uip_ipaddr_t addr, uint16_t id, uint16_t seqno,
|
|||||||
nlldbg("Start time: 0x%08x seqno: %d\n", state.png_time, seqno);
|
nlldbg("Start time: 0x%08x seqno: %d\n", state.png_time, seqno);
|
||||||
uip_lockedwait(&state.png_sem);
|
uip_lockedwait(&state.png_sem);
|
||||||
|
|
||||||
uip_icmpcallbackfree(state.png_cb);
|
icmp_callbackfree(state.png_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
uip_unlock(save);
|
uip_unlock(save);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/icmp/icmp_poll.c
|
* net/icmp/icmp_poll.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2009, 2014 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -69,7 +69,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_icmppoll
|
* Name: icmp_poll
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Poll a UDP "connection" structure for availability of TX data
|
* Poll a UDP "connection" structure for availability of TX data
|
||||||
@ -85,7 +85,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void uip_icmppoll(struct uip_driver_s *dev)
|
void icmp_poll(FAR struct uip_driver_s *dev)
|
||||||
{
|
{
|
||||||
/* Setup for the application callback */
|
/* Setup for the application callback */
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/icmp/icmp_send.c
|
* net/icmp/icmp_send.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008-2010, 2012, 2014 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -47,12 +47,13 @@
|
|||||||
#include <nuttx/net/netdev.h>
|
#include <nuttx/net/netdev.h>
|
||||||
|
|
||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
|
#include "icmp/icmp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define ICMPBUF ((struct uip_icmpip_hdr *)&dev->d_buf[UIP_LLH_LEN])
|
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[UIP_LLH_LEN])
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Variables
|
* Public Variables
|
||||||
@ -71,7 +72,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_icmpsend
|
* Name: icmp_send
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Setup to send an ICMP packet
|
* Setup to send an ICMP packet
|
||||||
@ -87,9 +88,9 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void uip_icmpsend(struct uip_driver_s *dev, uip_ipaddr_t *destaddr)
|
void icmp_send(FAR struct uip_driver_s *dev, FAR uip_ipaddr_t *destaddr)
|
||||||
{
|
{
|
||||||
struct uip_icmpip_hdr *picmp = ICMPBUF;
|
FAR struct icmp_iphdr_s *picmp = ICMPBUF;
|
||||||
|
|
||||||
if (dev->d_sndlen > 0)
|
if (dev->d_sndlen > 0)
|
||||||
{
|
{
|
||||||
@ -149,7 +150,7 @@ void uip_icmpsend(struct uip_driver_s *dev, uip_ipaddr_t *destaddr)
|
|||||||
/* Calculate the ICMP checksum. */
|
/* Calculate the ICMP checksum. */
|
||||||
|
|
||||||
picmp->icmpchksum = 0;
|
picmp->icmpchksum = 0;
|
||||||
picmp->icmpchksum = ~(uip_icmpchksum(dev, dev->d_sndlen));
|
picmp->icmpchksum = ~(icmp_chksum(dev, dev->d_sndlen));
|
||||||
if (picmp->icmpchksum == 0)
|
if (picmp->icmpchksum == 0)
|
||||||
{
|
{
|
||||||
picmp->icmpchksum = 0xffff;
|
picmp->icmpchksum = 0xffff;
|
||||||
|
@ -125,23 +125,6 @@ void uip_pktpoll(struct uip_driver_s *dev, struct uip_pkt_conn *conn);
|
|||||||
|
|
||||||
#endif /* CONFIG_NET_PKT */
|
#endif /* CONFIG_NET_PKT */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ICMP
|
|
||||||
/* Defined in icmp_input.c **************************************************/
|
|
||||||
|
|
||||||
void uip_icmpinput(struct uip_driver_s *dev);
|
|
||||||
|
|
||||||
#ifdef CONFIG_NET_ICMP_PING
|
|
||||||
/* Defined in icmp_poll.c ***************************************************/
|
|
||||||
|
|
||||||
void uip_icmppoll(struct uip_driver_s *dev);
|
|
||||||
|
|
||||||
/* Defined in icmp_send.c ***************************************************/
|
|
||||||
|
|
||||||
void uip_icmpsend(struct uip_driver_s *dev, uip_ipaddr_t *destaddr);
|
|
||||||
|
|
||||||
#endif /* CONFIG_NET_ICMP_PING */
|
|
||||||
#endif /* CONFIG_NET_ICMP */
|
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IGMP
|
#ifdef CONFIG_NET_IGMP
|
||||||
/* Defined in igmp_init.c ***************************************************/
|
/* Defined in igmp_init.c ***************************************************/
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define BUF ((struct uip_ip_hdr *)&dev->d_buf[UIP_LLH_LEN])
|
#define BUF ((struct uip_ip_hdr *)&dev->d_buf[UIP_LLH_LEN])
|
||||||
#define ICMPBUF ((struct uip_icmpip_hdr *)&dev->d_buf[UIP_LLH_LEN])
|
#define ICMPBUF ((struct icmp_iphdr_s *)&dev->d_buf[UIP_LLH_LEN])
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@ -65,7 +65,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if !UIP_ARCH_CHKSUM
|
#if !UIP_ARCH_CHKSUM
|
||||||
static uint16_t chksum(uint16_t sum, const uint8_t *data, uint16_t len)
|
static uint16_t chksum(uint16_t sum, FAR const uint8_t *data, uint16_t len)
|
||||||
{
|
{
|
||||||
uint16_t t;
|
uint16_t t;
|
||||||
const uint8_t *dataptr;
|
const uint8_t *dataptr;
|
||||||
@ -103,7 +103,7 @@ static uint16_t chksum(uint16_t sum, const uint8_t *data, uint16_t len)
|
|||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t upper_layer_chksum(struct uip_driver_s *dev, uint8_t proto)
|
static uint16_t upper_layer_chksum(FAR struct uip_driver_s *dev, uint8_t proto)
|
||||||
{
|
{
|
||||||
struct uip_ip_hdr *pbuf = BUF;
|
struct uip_ip_hdr *pbuf = BUF;
|
||||||
uint16_t upper_layer_len;
|
uint16_t upper_layer_len;
|
||||||
@ -133,7 +133,7 @@ static uint16_t upper_layer_chksum(struct uip_driver_s *dev, uint8_t proto)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_NET_IPv6
|
#ifdef CONFIG_NET_IPv6
|
||||||
static uint16_t uip_icmp6chksum(struct uip_driver_s *dev)
|
static uint16_t icmp_6chksum(FAR struct uip_driver_s *dev)
|
||||||
{
|
{
|
||||||
return upper_layer_chksum(dev, UIP_PROTO_ICMP6);
|
return upper_layer_chksum(dev, UIP_PROTO_ICMP6);
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ static uint16_t uip_icmp6chksum(struct uip_driver_s *dev)
|
|||||||
/* Calculate the Internet checksum over a buffer. */
|
/* Calculate the Internet checksum over a buffer. */
|
||||||
|
|
||||||
#if !UIP_ARCH_ADD32
|
#if !UIP_ARCH_ADD32
|
||||||
static inline void uip_carry32(uint8_t *sum, uint16_t op16)
|
static inline void uip_carry32(FAR uint8_t *sum, uint16_t op16)
|
||||||
{
|
{
|
||||||
if (sum[2] < (op16 >> 8))
|
if (sum[2] < (op16 >> 8))
|
||||||
{
|
{
|
||||||
@ -173,7 +173,7 @@ static inline void uip_carry32(uint8_t *sum, uint16_t op16)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void uip_incr32(uint8_t *op32, uint16_t op16)
|
void uip_incr32(FAR uint8_t *op32, uint16_t op16)
|
||||||
{
|
{
|
||||||
op32[3] += (op16 & 0xff);
|
op32[3] += (op16 & 0xff);
|
||||||
op32[2] += (op16 >> 8);
|
op32[2] += (op16 >> 8);
|
||||||
@ -183,7 +183,7 @@ void uip_incr32(uint8_t *op32, uint16_t op16)
|
|||||||
#endif /* UIP_ARCH_ADD32 */
|
#endif /* UIP_ARCH_ADD32 */
|
||||||
|
|
||||||
#if !UIP_ARCH_CHKSUM
|
#if !UIP_ARCH_CHKSUM
|
||||||
uint16_t uip_chksum(uint16_t *data, uint16_t len)
|
uint16_t uip_chksum(FAR uint16_t *data, uint16_t len)
|
||||||
{
|
{
|
||||||
return htons(chksum(0, (uint8_t *)data, len));
|
return htons(chksum(0, (uint8_t *)data, len));
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ uint16_t uip_chksum(uint16_t *data, uint16_t len)
|
|||||||
/* Calculate the IP header checksum of the packet header in d_buf. */
|
/* Calculate the IP header checksum of the packet header in d_buf. */
|
||||||
|
|
||||||
#ifndef UIP_ARCH_IPCHKSUM
|
#ifndef UIP_ARCH_IPCHKSUM
|
||||||
uint16_t uip_ipchksum(struct uip_driver_s *dev)
|
uint16_t uip_ipchksum(FAR struct uip_driver_s *dev)
|
||||||
{
|
{
|
||||||
uint16_t sum;
|
uint16_t sum;
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ uint16_t uip_ipchksum(struct uip_driver_s *dev)
|
|||||||
|
|
||||||
/* Calculate the TCP checksum of the packet in d_buf and d_appdata. */
|
/* Calculate the TCP checksum of the packet in d_buf and d_appdata. */
|
||||||
|
|
||||||
uint16_t tcp_chksum(struct uip_driver_s *dev)
|
uint16_t tcp_chksum(FAR struct uip_driver_s *dev)
|
||||||
{
|
{
|
||||||
return upper_layer_chksum(dev, UIP_PROTO_TCP);
|
return upper_layer_chksum(dev, UIP_PROTO_TCP);
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ uint16_t tcp_chksum(struct uip_driver_s *dev)
|
|||||||
/* Calculate the UDP checksum of the packet in d_buf and d_appdata. */
|
/* Calculate the UDP checksum of the packet in d_buf and d_appdata. */
|
||||||
|
|
||||||
#ifdef CONFIG_NET_UDP_CHECKSUMS
|
#ifdef CONFIG_NET_UDP_CHECKSUMS
|
||||||
uint16_t udp_chksum(struct uip_driver_s *dev)
|
uint16_t udp_chksum(FAR struct uip_driver_s *dev)
|
||||||
{
|
{
|
||||||
return upper_layer_chksum(dev, UIP_PROTO_UDP);
|
return upper_layer_chksum(dev, UIP_PROTO_UDP);
|
||||||
}
|
}
|
||||||
@ -219,9 +219,9 @@ uint16_t udp_chksum(struct uip_driver_s *dev)
|
|||||||
/* Calculate the checksum of the ICMP message */
|
/* Calculate the checksum of the ICMP message */
|
||||||
|
|
||||||
#if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING)
|
#if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING)
|
||||||
uint16_t uip_icmpchksum(struct uip_driver_s *dev, int len)
|
uint16_t icmp_chksum(FAR struct uip_driver_s *dev, int len)
|
||||||
{
|
{
|
||||||
struct uip_icmpip_hdr *picmp = ICMPBUF;
|
FAR struct icmp_iphdr_s *picmp = ICMPBUF;
|
||||||
return uip_chksum((uint16_t*)&picmp->type, len);
|
return uip_chksum((uint16_t*)&picmp->type, len);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -96,6 +96,7 @@
|
|||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
#include "tcp/tcp.h"
|
#include "tcp/tcp.h"
|
||||||
#include "udp/udp.h"
|
#include "udp/udp.h"
|
||||||
|
#include "icmp/icmp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@ -436,7 +437,7 @@ int uip_input(struct uip_driver_s *dev)
|
|||||||
if (pbuf->proto == UIP_PROTO_ICMP)
|
if (pbuf->proto == UIP_PROTO_ICMP)
|
||||||
{
|
{
|
||||||
nlldbg("Possible ping config packet received\n");
|
nlldbg("Possible ping config packet received\n");
|
||||||
uip_icmpinput(dev);
|
icmp_input(dev);
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -526,7 +527,7 @@ int uip_input(struct uip_driver_s *dev)
|
|||||||
#else
|
#else
|
||||||
case UIP_PROTO_ICMP6: /* ICMP6 input */
|
case UIP_PROTO_ICMP6: /* ICMP6 input */
|
||||||
#endif
|
#endif
|
||||||
uip_icmpinput(dev);
|
icmp_input(dev);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#include "uip/uip.h"
|
#include "uip/uip.h"
|
||||||
#include "tcp/tcp.h"
|
#include "tcp/tcp.h"
|
||||||
#include "udp/udp.h"
|
#include "udp/udp.h"
|
||||||
|
#include "icmp/icmp.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
@ -112,7 +113,7 @@ static inline int uip_pollicmp(FAR struct uip_driver_s *dev,
|
|||||||
{
|
{
|
||||||
/* Perform the UDP TX poll */
|
/* Perform the UDP TX poll */
|
||||||
|
|
||||||
uip_icmppoll(dev);
|
icmp_poll(dev);
|
||||||
|
|
||||||
/* Call back into the driver */
|
/* Call back into the driver */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user