Networking: Add missing raw/packet socket support to all Ethernet drivers

This commit is contained in:
Gregory Nutt
2015-01-20 15:14:29 -06:00
parent 232dbeb800
commit a53ae59284
20 changed files with 226 additions and 21 deletions
+12 -2
View File
@@ -66,6 +66,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
#endif
#include "enc28j60.h"
/****************************************************************************
@@ -1374,6 +1378,12 @@ static void enc_rxerif(FAR struct enc_driver_s *priv)
static void enc_rxdispatch(FAR struct enc_driver_s *priv)
{
#ifdef CONFIG_NET_PKT
/* When packet sockets are enabled, feed the frame into the packet tap */
pkt_input(&priv->dev);
#endif
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@@ -1397,7 +1407,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(priv->dev.d_flags))
#endif
{
arp_out(&priv->dev);
@@ -1428,7 +1438,7 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
if (BUF->type == HTONS(ETHTYPE_IP))
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}