summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-01-20 15:14:29 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-01-20 15:14:29 -0600
commite1d8c89b89c93e5ff71f276c6ec7035a80766a09 (patch)
treebe6ffa4cb6f6c31e6122160effdff06155b5bb62 /nuttx
parent8f957faf84b9aa8de2881361e116943b78ec2dd4 (diff)
downloadnuttx-e1d8c89b89c93e5ff71f276c6ec7035a80766a09.tar.gz
nuttx-e1d8c89b89c93e5ff71f276c6ec7035a80766a09.tar.bz2
nuttx-e1d8c89b89c93e5ff71f276c6ec7035a80766a09.zip
Networking: Add missing raw/packet socket support to all Ethernet drivers
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/arch/arm/src/c5471/c5471_ethernet.c10
-rw-r--r--nuttx/arch/arm/src/kinetis/kinetis_enet.c10
-rw-r--r--nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c12
-rw-r--r--nuttx/arch/arm/src/sam34/sam_emac.c12
-rw-r--r--nuttx/arch/arm/src/sama5/sam_emaca.c12
-rw-r--r--nuttx/arch/arm/src/sama5/sam_emacb.c12
-rw-r--r--nuttx/arch/arm/src/sama5/sam_gmac.c12
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_eth.c10
-rw-r--r--nuttx/arch/arm/src/tiva/lm3s_ethernet.c10
-rw-r--r--nuttx/arch/hc/src/m9s12/m9s12_ethernet.c10
-rw-r--r--nuttx/arch/mips/src/pic32mx/pic32mx-ethernet.c14
-rw-r--r--nuttx/arch/sim/src/up_netdriver.c12
-rw-r--r--nuttx/arch/z80/src/ez80/ez80_emac.c10
-rw-r--r--nuttx/drivers/net/cs89x0.c17
-rw-r--r--nuttx/drivers/net/dm90x0.c14
-rw-r--r--nuttx/drivers/net/e1000.c14
-rw-r--r--nuttx/drivers/net/enc28j60.c14
-rw-r--r--nuttx/drivers/net/encx24j600.c14
-rw-r--r--nuttx/drivers/net/skeleton.c14
-rw-r--r--nuttx/drivers/net/vnet.c14
20 files changed, 226 insertions, 21 deletions
diff --git a/nuttx/arch/arm/src/c5471/c5471_ethernet.c b/nuttx/arch/arm/src/c5471/c5471_ethernet.c
index 3f950c25e..7ea7e3d23 100644
--- a/nuttx/arch/arm/src/c5471/c5471_ethernet.c
+++ b/nuttx/arch/arm/src/c5471/c5471_ethernet.c
@@ -62,6 +62,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include "chip.h"
#include "up_arch.h"
#include "up_internal.h"
@@ -1230,6 +1234,12 @@ static void c5471_receive(struct c5471_driver_s *c5471)
nvdbg("Received packet, packetlen: %d type: %02x\n", packetlen, ntohs(BUF->type));
c5471_dumpbuffer("Received packet", dev->d_buf, dev->d_len);
+#ifdef CONFIG_NET_PKT
+ /* When packet sockets are enabled, feed the frame into the packet tap */
+
+ pkt_input(dev);
+#endif
+
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_enet.c b/nuttx/arch/arm/src/kinetis/kinetis_enet.c
index 08b273aa6..39aa02dea 100644
--- a/nuttx/arch/arm/src/kinetis/kinetis_enet.c
+++ b/nuttx/arch/arm/src/kinetis/kinetis_enet.c
@@ -57,6 +57,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include "up_arch.h"
#include "chip.h"
#include "kinetis_internal.h"
@@ -514,6 +518,12 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
putreg32(ENET_RDAR, KINETIS_ENET_RDAR);
+#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
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c b/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c
index b37aed6c2..71ee88a43 100644
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c
@@ -58,6 +58,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include "up_arch.h"
#include "chip.h"
#include "chip/lpc17_syscon.h"
@@ -872,6 +876,14 @@ static void lpc17_rxdone(struct lpc17_driver_s *priv)
lpc17_dumppacket("Received packet",
priv->lp_dev.d_buf, priv->lp_dev.d_len);
+#ifdef CONFIG_NET_PKT
+ /* When packet sockets are enabled, feed the frame into the packet
+ * tap.
+ */
+
+ pkt_input(&priv->lp_dev);
+#endif
+
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
diff --git a/nuttx/arch/arm/src/sam34/sam_emac.c b/nuttx/arch/arm/src/sam34/sam_emac.c
index 581a104c2..45a3b3337 100644
--- a/nuttx/arch/arm/src/sam34/sam_emac.c
+++ b/nuttx/arch/arm/src/sam34/sam_emac.c
@@ -69,6 +69,10 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include "up_arch.h"
#include "up_internal.h"
@@ -1136,8 +1140,14 @@ static void sam_receive(struct sam_emac_s *priv)
if (dev->d_len > CONFIG_NET_ETH_MTU)
{
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
+ continue;
}
- else
+
+#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 */
diff --git a/nuttx/arch/arm/src/sama5/sam_emaca.c b/nuttx/arch/arm/src/sama5/sam_emaca.c
index 51b1700fd..db3628107 100644
--- a/nuttx/arch/arm/src/sama5/sam_emaca.c
+++ b/nuttx/arch/arm/src/sama5/sam_emaca.c
@@ -70,6 +70,10 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include "up_arch.h"
#include "up_internal.h"
#include "cache.h"
@@ -1176,8 +1180,14 @@ static void sam_receive(struct sam_emac_s *priv)
if (dev->d_len > CONFIG_NET_ETH_MTU)
{
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
+ continue;
}
- else
+
+#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 */
diff --git a/nuttx/arch/arm/src/sama5/sam_emacb.c b/nuttx/arch/arm/src/sama5/sam_emacb.c
index 37fb8ea33..7f0c3b4d6 100644
--- a/nuttx/arch/arm/src/sama5/sam_emacb.c
+++ b/nuttx/arch/arm/src/sama5/sam_emacb.c
@@ -84,6 +84,10 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include "up_arch.h"
#include "up_internal.h"
#include "cache.h"
@@ -1502,8 +1506,14 @@ static void sam_receive(struct sam_emac_s *priv)
if (dev->d_len > CONFIG_NET_ETH_MTU)
{
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
+ continue;
}
- else
+
+#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 */
diff --git a/nuttx/arch/arm/src/sama5/sam_gmac.c b/nuttx/arch/arm/src/sama5/sam_gmac.c
index 1ed1e4b60..689c614c4 100644
--- a/nuttx/arch/arm/src/sama5/sam_gmac.c
+++ b/nuttx/arch/arm/src/sama5/sam_gmac.c
@@ -67,6 +67,10 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/phy.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include "up_arch.h"
#include "up_internal.h"
#include "cache.h"
@@ -1106,8 +1110,14 @@ static void sam_receive(struct sam_gmac_s *priv)
if (dev->d_len > CONFIG_NET_ETH_MTU)
{
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
+ continue;
}
- else
+
+#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 */
diff --git a/nuttx/arch/arm/src/stm32/stm32_eth.c b/nuttx/arch/arm/src/stm32/stm32_eth.c
index 4b3b982d9..22b22e43c 100644
--- a/nuttx/arch/arm/src/stm32/stm32_eth.c
+++ b/nuttx/arch/arm/src/stm32/stm32_eth.c
@@ -53,8 +53,8 @@
#include <nuttx/arch.h>
#include <nuttx/irq.h>
#include <nuttx/wdog.h>
-#include <nuttx/net/mii.h>
+#include <nuttx/net/mii.h>
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#if defined(CONFIG_NET_PKT)
@@ -1612,8 +1612,14 @@ static void stm32_receive(FAR struct stm32_ethmac_s *priv)
if (dev->d_len > CONFIG_NET_ETH_MTU)
{
nlldbg("DROPPED: Too big: %d\n", dev->d_len);
+ continue;
}
- else
+
+#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 */
diff --git a/nuttx/arch/arm/src/tiva/lm3s_ethernet.c b/nuttx/arch/arm/src/tiva/lm3s_ethernet.c
index 6d1bdaa4f..bcfd7dd9c 100644
--- a/nuttx/arch/arm/src/tiva/lm3s_ethernet.c
+++ b/nuttx/arch/arm/src/tiva/lm3s_ethernet.c
@@ -56,6 +56,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include "chip.h"
#include "up_arch.h"
@@ -766,6 +770,12 @@ static void tiva_receive(struct tiva_driver_s *priv)
priv->ld_dev.d_len = pktlen - 6;
tiva_dumppacket("Received packet", priv->ld_dev.d_buf, priv->ld_dev.d_len);
+#ifdef CONFIG_NET_PKT
+ /* When packet sockets are enabled, feed the frame into the packet tap */
+
+ pkt_input(&priv->ld_dev);
+#endif
+
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
diff --git a/nuttx/arch/hc/src/m9s12/m9s12_ethernet.c b/nuttx/arch/hc/src/m9s12/m9s12_ethernet.c
index caa25af5c..bbba9d709 100644
--- a/nuttx/arch/hc/src/m9s12/m9s12_ethernet.c
+++ b/nuttx/arch/hc/src/m9s12/m9s12_ethernet.c
@@ -55,6 +55,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
/****************************************************************************
* Definitions
****************************************************************************/
@@ -256,6 +260,12 @@ static void emac_receive(FAR struct emac_driver_s *priv)
* amount of data in priv->d_dev.d_len
*/
+#ifdef CONFIG_NET_PKT
+ /* When packet sockets are enabled, feed the frame into the packet tap */
+
+ pkt_input(&priv->d_dev);
+#endif
+
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
diff --git a/nuttx/arch/mips/src/pic32mx/pic32mx-ethernet.c b/nuttx/arch/mips/src/pic32mx/pic32mx-ethernet.c
index 872e68434..0d301db1d 100644
--- a/nuttx/arch/mips/src/pic32mx/pic32mx-ethernet.c
+++ b/nuttx/arch/mips/src/pic32mx/pic32mx-ethernet.c
@@ -60,6 +60,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include <arch/irq.h>
#include <arch/board/board.h>
@@ -69,7 +73,7 @@
#include "pic32mx-ethernet.h"
#include "pic32mx-internal.h"
-/* Does this chip have and ethernet controller? */
+/* Does this chip have and Ethernet controller? */
#if CHIP_NETHERNET > 0
@@ -1429,6 +1433,14 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
pic32mx_dumppacket("Received packet",
priv->pd_dev.d_buf, priv->pd_dev.d_len);
+#ifdef CONFIG_NET_PKT
+ /* When packet sockets are enabled, feed the frame into the packet
+ * tap.
+ */
+
+ pkt_input(&priv->pd_dev);
+#endif
+
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
diff --git a/nuttx/arch/sim/src/up_netdriver.c b/nuttx/arch/sim/src/up_netdriver.c
index 7f40cabb4..abffefc43 100644
--- a/nuttx/arch/sim/src/up_netdriver.c
+++ b/nuttx/arch/sim/src/up_netdriver.c
@@ -56,6 +56,10 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/arp.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include "up_internal.h"
/****************************************************************************
@@ -157,6 +161,14 @@ void netdriver_loop(void)
if (g_sim_dev.d_len > ETH_HDRLEN && up_comparemac(BUF->ether_dhost, &g_sim_dev.d_mac) == 0)
{
+#ifdef CONFIG_NET_PKT
+ /* When packet sockets are enabled, feed the frame into the packet
+ * tap.
+ */
+
+ pkt_input(&g_sim_dev);
+#endif
+
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
diff --git a/nuttx/arch/z80/src/ez80/ez80_emac.c b/nuttx/arch/z80/src/ez80/ez80_emac.c
index 7c2e935d0..488dd1823 100644
--- a/nuttx/arch/z80/src/ez80/ez80_emac.c
+++ b/nuttx/arch/z80/src/ez80/ez80_emac.c
@@ -60,6 +60,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include <arch/io.h>
#include "chip.h"
@@ -1268,6 +1272,12 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv)
ez80emac_rrp(), rwp,
inp(EZ80_EMAC_BLKSLFT_H), inp(EZ80_EMAC_BLKSLFT_L));
+#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
diff --git a/nuttx/drivers/net/cs89x0.c b/nuttx/drivers/net/cs89x0.c
index 16301cdf1..4002a078b 100644
--- a/nuttx/drivers/net/cs89x0.c
+++ b/nuttx/drivers/net/cs89x0.c
@@ -55,6 +55,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
/****************************************************************************
* Definitions
****************************************************************************/
@@ -387,10 +391,12 @@ static void cs89x0_receive(struct cs89x0_driver_s *cs89x0, uint16_t isq)
{
cd89x0->cs_stats.rx_lengtherrors++;
}
+
if ((isq & RX_EXTRA_DATA) != 0)
{
cd89x0->cs_stats.rx_lengtherrors++;
}
+
if (isq & RX_CRC_ERROR) != 0)
{
if (!(isq & (RX_EXTRA_DATA|RX_RUNT)))
@@ -398,6 +404,7 @@ static void cs89x0_receive(struct cs89x0_driver_s *cs89x0, uint16_t isq)
cd89x0->cs_stats.rx_crcerrors++;
}
}
+
if ((isq & RX_DRIBBLE) != 0)
{
cd89x0->cs_stats.rx_frameerrors++;
@@ -431,6 +438,12 @@ static void cs89x0_receive(struct cs89x0_driver_s *cs89x0, uint16_t isq)
cd89x0->cs_stats.rx_packets++;
#endif
+#ifdef CONFIG_NET_PKT
+ /* When packet sockets are enabled, feed the frame into the packet tap */
+
+ pkt_input(&cs89x0->cs_dev);
+#endif
+
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@@ -454,7 +467,7 @@ static void cs89x0_receive(struct cs89x0_driver_s *cs89x0, uint16_t isq)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
- if (BUF->type == HTONS(ETHTYPE_IP))
+ if (IFF_IS_IPv4(cs89x0->cs_dev.d_flags))
#endif
{
arp_out(&cs89x0->cs_dev);
@@ -485,7 +498,7 @@ static void cs89x0_receive(struct cs89x0_driver_s *cs89x0, uint16_t isq)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
- if (BUF->type == HTONS(ETHTYPE_IP))
+ if (IFF_IS_IPv4(cs89x0->cs_dev.d_flags))
{
arp_out(&cs89x0->cs_dev);
}
diff --git a/nuttx/drivers/net/dm90x0.c b/nuttx/drivers/net/dm90x0.c
index 1b2afdbb3..729cc3baa 100644
--- a/nuttx/drivers/net/dm90x0.c
+++ b/nuttx/drivers/net/dm90x0.c
@@ -68,6 +68,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
/****************************************************************************
* Definitions
****************************************************************************/
@@ -978,6 +982,12 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
dm9x->dm_dev.d_len = rx.desc.rx_len;
dm9x->dm_read(dm9x->dm_dev.d_buf, rx.desc.rx_len);
+#ifdef CONFIG_NET_PKT
+ /* When packet sockets are enabled, feed the frame into the packet tap */
+
+ pkt_input(&dm9x->dm_dev);
+#endif
+
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@@ -1001,7 +1011,7 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
- if (BUF->type == HTONS(ETHTYPE_IP))
+ if (IFF_IS_IPv4(dm9x->dm_dev.d_flags))
#endif
{
arp_out(&dm9x->dm_dev);
@@ -1032,7 +1042,7 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
- if (BUF->type == HTONS(ETHTYPE_IP))
+ if (IFF_IS_IPv4(dm9x->dm_dev.d_flags))
{
arp_out(&dm9x->dm_dev);
}
diff --git a/nuttx/drivers/net/e1000.c b/nuttx/drivers/net/e1000.c
index 604bcaf51..543fa93b0 100644
--- a/nuttx/drivers/net/e1000.c
+++ b/nuttx/drivers/net/e1000.c
@@ -58,6 +58,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include <rgmp/pmap.h>
#include <rgmp/string.h>
#include <rgmp/stdio.h>
@@ -565,6 +569,12 @@ static void e1000_receive(struct e1000_dev *e1000)
memcpy(e1000->netdev.d_buf, cp, cnt);
e1000->netdev.d_len = cnt;
+#ifdef CONFIG_NET_PKT
+ /* When packet sockets are enabled, feed the frame into the packet tap */
+
+ pkt_input(&e1000->netdev);
+#endif
+
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@@ -588,7 +598,7 @@ static void e1000_receive(struct e1000_dev *e1000)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
- if (BUF->type == HTONS(ETHTYPE_IP))
+ if (IFF_IS_IPv4(e1000->netdev.d_flags))
#endif
{
arp_out(&e1000->netdev);
@@ -619,7 +629,7 @@ static void e1000_receive(struct e1000_dev *e1000)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
- if (BUF->type == HTONS(ETHTYPE_IP))
+ if (IFF_IS_IPv4(e1000->netdev.d_flags))
{
arp_out(&e1000->netdev);
}
diff --git a/nuttx/drivers/net/enc28j60.c b/nuttx/drivers/net/enc28j60.c
index defefb81c..6516250c6 100644
--- a/nuttx/drivers/net/enc28j60.c
+++ b/nuttx/drivers/net/enc28j60.c
@@ -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);
}
diff --git a/nuttx/drivers/net/encx24j600.c b/nuttx/drivers/net/encx24j600.c
index 035184cef..e3dd1e8e7 100644
--- a/nuttx/drivers/net/encx24j600.c
+++ b/nuttx/drivers/net/encx24j600.c
@@ -72,6 +72,10 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/encx24j600.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include "encx24j600.h"
/****************************************************************************
@@ -1493,6 +1497,12 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
enc_rxldpkt(priv, descr);
+#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
@@ -1525,7 +1535,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);
@@ -1565,7 +1575,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);
}
diff --git a/nuttx/drivers/net/skeleton.c b/nuttx/drivers/net/skeleton.c
index 61ac806d8..38dc32181 100644
--- a/nuttx/drivers/net/skeleton.c
+++ b/nuttx/drivers/net/skeleton.c
@@ -60,6 +60,10 @@
# include <nuttx/wqueue.h>
#endif
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -288,6 +292,12 @@ static void skel_receive(FAR struct skel_driver_s *skel)
* amount of data in skel->sk_dev.d_len
*/
+#ifdef CONFIG_NET_PKT
+ /* When packet sockets are enabled, feed the frame into the packet tap */
+
+ pkt_input(&skel->sk_dev);
+#endif
+
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@@ -311,7 +321,7 @@ static void skel_receive(FAR struct skel_driver_s *skel)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
- if (BUF->type == HTONS(ETHTYPE_IP))
+ if (IFF_IS_IPv4(skel->sk_dev.d_flags))
#endif
{
arp_out(&skel->sk_dev);
@@ -342,7 +352,7 @@ static void skel_receive(FAR struct skel_driver_s *skel)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
- if (BUF->type == HTONS(ETHTYPE_IP))
+ if (IFF_IS_IPv4(skel->sk_dev.d_flags))
{
arp_out(&skel->sk_dev);
}
diff --git a/nuttx/drivers/net/vnet.c b/nuttx/drivers/net/vnet.c
index 02f348d74..db1665897 100644
--- a/nuttx/drivers/net/vnet.c
+++ b/nuttx/drivers/net/vnet.c
@@ -59,6 +59,10 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
+#ifdef CONFIG_NET_PKT
+# include <nuttx/net/pkt.h>
+#endif
+
#include <rgmp/vnet.h>
#include <rgmp/stdio.h>
@@ -301,6 +305,12 @@ void rtos_vnet_recv(struct rgmp_vnet *rgmp_vnet, char *data, int len)
memcpy(vnet->sk_dev.d_buf, data, len);
vnet->sk_dev.d_len = len;
+#ifdef CONFIG_NET_PKT
+ /* When packet sockets are enabled, feed the frame into the packet tap */
+
+ pkt_input(&vnet->sk_dev);
+#endif
+
/* We only accept IP packets of the configured type and ARP packets */
#ifdef CONFIG_NET_IPv4
@@ -324,7 +334,7 @@ void rtos_vnet_recv(struct rgmp_vnet *rgmp_vnet, char *data, int len)
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv6
- if (BUF->type == HTONS(ETHTYPE_IP))
+ if (IFF_IS_IPv4(vnet->sk_dev.d_flags))
#endif
{
arp_out(&vnet->sk_dev);
@@ -355,7 +365,7 @@ void rtos_vnet_recv(struct rgmp_vnet *rgmp_vnet, char *data, int len)
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
- if (BUF->type == HTONS(ETHTYPE_IP))
+ if (IFF_IS_IPv4(vnet->sk_dev.d_flags))
{
arp_out(&vnet->sk_dev);
}