net/icmp: Ports the changes in ICMPv6 of commits 4629cf9461
and 74a633ea94
to ICMP. ICMP and ICMPv6 sockets are nearly identical, bug-for-bug.
This commit is contained in:
parent
74a633ea94
commit
306bd169f8
|
@ -90,10 +90,6 @@ struct icmp_conn_s
|
|||
|
||||
struct iob_queue_s readahead; /* Read-ahead buffering */
|
||||
#endif
|
||||
|
||||
/* Defines the list of IPPROTO_ICMP callbacks */
|
||||
|
||||
struct devif_callback_s *list;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ void icmp_input(FAR struct net_driver_s *dev)
|
|||
{
|
||||
uint16_t flags;
|
||||
|
||||
flags = devif_conn_event(dev, ipicmp, ICMP_ECHOREPLY, dev->d_conncb);
|
||||
flags = devif_conn_event(dev, NULL, ICMP_ECHOREPLY, dev->d_conncb);
|
||||
if ((flags & ICMP_ECHOREPLY) != 0)
|
||||
{
|
||||
FAR struct icmp_conn_s *conn;
|
||||
|
|
|
@ -59,7 +59,8 @@
|
|||
|
||||
struct icmp_poll_s
|
||||
{
|
||||
struct pollfd *fds; /* Needed to handle poll events */
|
||||
FAR struct socket *psock; /* IPPROTO_ICMP socket structure */
|
||||
FAR struct pollfd *fds; /* Needed to handle poll events */
|
||||
FAR struct devif_callback_s *cb; /* Needed to teardown the poll */
|
||||
};
|
||||
|
||||
|
@ -92,7 +93,8 @@ static uint16_t icmp_poll_eventhandler(FAR struct net_driver_s *dev,
|
|||
FAR void *pvpriv, uint16_t flags)
|
||||
{
|
||||
FAR struct icmp_poll_s *info = (FAR struct icmp_poll_s *)pvpriv;
|
||||
FAR struct icmp_conn_s *conn = (FAR struct icmp_conn_s *)pvconn;
|
||||
FAR struct icmp_conn_s *conn;
|
||||
FAR struct socket *psock;
|
||||
pollevent_t eventset;
|
||||
|
||||
ninfo("flags: %04x\n", flags);
|
||||
|
@ -104,8 +106,21 @@ static uint16_t icmp_poll_eventhandler(FAR struct net_driver_s *dev,
|
|||
* sent out on.
|
||||
*/
|
||||
|
||||
if (info != NULL && dev == conn->dev)
|
||||
if (info != NULL)
|
||||
{
|
||||
/* Is this a response on the same device that we sent the request out
|
||||
* on?
|
||||
*/
|
||||
|
||||
psock = info->psock;
|
||||
DEBUGASSERT(psock != NULL && psock->s_conn != NULL);
|
||||
conn = psock->s_conn;
|
||||
if (dev != conn->dev)
|
||||
{
|
||||
ninfo("Wrong device\n");
|
||||
return flags;
|
||||
}
|
||||
|
||||
/* Check for data or connection availability events. */
|
||||
|
||||
eventset = 0;
|
||||
|
@ -197,8 +212,9 @@ int icmp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
|
|||
|
||||
/* Initialize the poll info container */
|
||||
|
||||
info->fds = fds;
|
||||
info->cb = cb;
|
||||
info->psock = psock;
|
||||
info->fds = fds;
|
||||
info->cb = cb;
|
||||
|
||||
/* Initialize the callback structure. Save the reference to the info
|
||||
* structure as callback private data so that it will be available during
|
||||
|
|
Loading…
Reference in New Issue