From 07132f462f32e4eea79f34db7ceef874c45053e9 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 20 Jan 2015 06:26:14 -0600 Subject: [PATCH] Ethernet drivers: Use IFF_IS_IPv4 macro. Cannot rely on the EtherType being set correctly. --- arch/arm/src/c5471/c5471_ethernet.c | 4 ++-- arch/arm/src/kinetis/kinetis_enet.c | 4 ++-- arch/arm/src/lpc17xx/lpc17_ethernet.c | 4 ++-- arch/arm/src/sam34/sam_emac.c | 4 ++-- arch/arm/src/sama5/sam_emaca.c | 4 ++-- arch/arm/src/sama5/sam_emacb.c | 4 ++-- arch/arm/src/sama5/sam_gmac.c | 4 ++-- arch/arm/src/stm32/stm32_eth.c | 4 ++-- arch/arm/src/tiva/lm3s_ethernet.c | 4 ++-- arch/arm/src/tiva/tm4c_ethernet.c | 4 ++-- arch/hc/src/m9s12/m9s12_ethernet.c | 4 ++-- arch/mips/src/pic32mx/pic32mx-ethernet.c | 4 ++-- arch/sim/src/up_netdriver.c | 4 ++-- arch/z80/src/ez80/ez80_emac.c | 4 ++-- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/arch/arm/src/c5471/c5471_ethernet.c b/arch/arm/src/c5471/c5471_ethernet.c index f52856662fa..3f950c25ef6 100644 --- a/arch/arm/src/c5471/c5471_ethernet.c +++ b/arch/arm/src/c5471/c5471_ethernet.c @@ -1256,7 +1256,7 @@ static void c5471_receive(struct c5471_driver_s *c5471) /* Update the Ethernet header with the correct MAC address */ #ifdef CONFIG_NET_IPv6 - if (BUF->type == HTONS(ETHTYPE_IP)) + if (IFF_IS_IPv4(dev->d_flags)) #endif { arp_out(dev); @@ -1290,7 +1290,7 @@ static void c5471_receive(struct c5471_driver_s *c5471) #ifdef CONFIG_NET_IPv4 /* Update the Ethernet header with the correct MAC address */ - if (BUF->type == HTONS(ETHTYPE_IP)) + if (IFF_IS_IPv4(dev->d_flags)) { arp_out(dev); } diff --git a/arch/arm/src/kinetis/kinetis_enet.c b/arch/arm/src/kinetis/kinetis_enet.c index 9b365c311b3..08b273aa614 100644 --- a/arch/arm/src/kinetis/kinetis_enet.c +++ b/arch/arm/src/kinetis/kinetis_enet.c @@ -537,7 +537,7 @@ static void kinetis_receive(FAR struct kinetis_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); @@ -568,7 +568,7 @@ static void kinetis_receive(FAR struct kinetis_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/arch/arm/src/lpc17xx/lpc17_ethernet.c b/arch/arm/src/lpc17xx/lpc17_ethernet.c index 3b4ac7d5df6..b37aed6c2d9 100644 --- a/arch/arm/src/lpc17xx/lpc17_ethernet.c +++ b/arch/arm/src/lpc17xx/lpc17_ethernet.c @@ -897,7 +897,7 @@ static void lpc17_rxdone(struct lpc17_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->lp_dev.d_flags)) #endif { arp_out(&priv->lp_dev); @@ -930,7 +930,7 @@ static void lpc17_rxdone(struct lpc17_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->lp_dev.d_flags)) { arp_out(&priv->lp_dev); } diff --git a/arch/arm/src/sam34/sam_emac.c b/arch/arm/src/sam34/sam_emac.c index 85676a9efe2..581a104c21e 100644 --- a/arch/arm/src/sam34/sam_emac.c +++ b/arch/arm/src/sam34/sam_emac.c @@ -1162,7 +1162,7 @@ static void sam_receive(struct sam_emac_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); @@ -1193,7 +1193,7 @@ static void sam_receive(struct sam_emac_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/arch/arm/src/sama5/sam_emaca.c b/arch/arm/src/sama5/sam_emaca.c index 00e32448275..51b1700fdd6 100644 --- a/arch/arm/src/sama5/sam_emaca.c +++ b/arch/arm/src/sama5/sam_emaca.c @@ -1202,7 +1202,7 @@ static void sam_receive(struct sam_emac_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); @@ -1233,7 +1233,7 @@ static void sam_receive(struct sam_emac_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/arch/arm/src/sama5/sam_emacb.c b/arch/arm/src/sama5/sam_emacb.c index 98af0f834b7..37fb8ea3388 100644 --- a/arch/arm/src/sama5/sam_emacb.c +++ b/arch/arm/src/sama5/sam_emacb.c @@ -1528,7 +1528,7 @@ static void sam_receive(struct sam_emac_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); @@ -1559,7 +1559,7 @@ static void sam_receive(struct sam_emac_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/arch/arm/src/sama5/sam_gmac.c b/arch/arm/src/sama5/sam_gmac.c index ba57893247d..1ed1e4b6029 100644 --- a/arch/arm/src/sama5/sam_gmac.c +++ b/arch/arm/src/sama5/sam_gmac.c @@ -1132,7 +1132,7 @@ static void sam_receive(struct sam_gmac_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); @@ -1163,7 +1163,7 @@ static void sam_receive(struct sam_gmac_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/arch/arm/src/stm32/stm32_eth.c b/arch/arm/src/stm32/stm32_eth.c index d78719e6ca7..4b3b982d909 100644 --- a/arch/arm/src/stm32/stm32_eth.c +++ b/arch/arm/src/stm32/stm32_eth.c @@ -1638,7 +1638,7 @@ static void stm32_receive(FAR struct stm32_ethmac_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); @@ -1669,7 +1669,7 @@ static void stm32_receive(FAR struct stm32_ethmac_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/arch/arm/src/tiva/lm3s_ethernet.c b/arch/arm/src/tiva/lm3s_ethernet.c index 5c1e7010428..6d1bdaa4fa1 100644 --- a/arch/arm/src/tiva/lm3s_ethernet.c +++ b/arch/arm/src/tiva/lm3s_ethernet.c @@ -790,7 +790,7 @@ static void tiva_receive(struct tiva_driver_s *priv) /* Update the Ethernet header with the correct MAC address */ #ifdef CONFIG_NET_IPv6 - if (ETHBUF->type == HTONS(ETHTYPE_IP)) + if (IFF_IS_IPv4(priv->ld_dev.d_flags)) #endif { arp_out(&priv->ld_dev); @@ -823,7 +823,7 @@ static void tiva_receive(struct tiva_driver_s *priv) #ifdef CONFIG_NET_IPv4 /* Update the Ethernet header with the correct MAC address */ - if (ETHBUF->type == HTONS(ETHTYPE_IP)) + if (IFF_IS_IPv4(priv->ld_dev.d_flags)) { arp_out(&priv->ld_dev); } diff --git a/arch/arm/src/tiva/tm4c_ethernet.c b/arch/arm/src/tiva/tm4c_ethernet.c index 61106a9610d..8e920d5dd6a 100644 --- a/arch/arm/src/tiva/tm4c_ethernet.c +++ b/arch/arm/src/tiva/tm4c_ethernet.c @@ -1714,7 +1714,7 @@ static void tiva_receive(FAR struct tiva_ethmac_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); @@ -1745,7 +1745,7 @@ static void tiva_receive(FAR struct tiva_ethmac_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/arch/hc/src/m9s12/m9s12_ethernet.c b/arch/hc/src/m9s12/m9s12_ethernet.c index efa408c8bad..caa25af5c93 100644 --- a/arch/hc/src/m9s12/m9s12_ethernet.c +++ b/arch/hc/src/m9s12/m9s12_ethernet.c @@ -279,7 +279,7 @@ static void emac_receive(FAR struct emac_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->d_dev.d_flags)) #endif { arp_out(&priv->d_dev); @@ -310,7 +310,7 @@ static void emac_receive(FAR struct emac_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->d_dev.d_flags)) { arp_out(&priv->d_dev); } diff --git a/arch/mips/src/pic32mx/pic32mx-ethernet.c b/arch/mips/src/pic32mx/pic32mx-ethernet.c index d704814d6ca..872e68434f6 100644 --- a/arch/mips/src/pic32mx/pic32mx-ethernet.c +++ b/arch/mips/src/pic32mx/pic32mx-ethernet.c @@ -1454,7 +1454,7 @@ static void pic32mx_rxdone(struct pic32mx_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->pd_dev.d_flags)) #endif { arp_out(&priv->pd_dev); @@ -1487,7 +1487,7 @@ static void pic32mx_rxdone(struct pic32mx_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->pd_dev.d_flags)) { arp_out(&priv->pd_dev); } diff --git a/arch/sim/src/up_netdriver.c b/arch/sim/src/up_netdriver.c index eec433ac2ad..7f40cabb4bc 100644 --- a/arch/sim/src/up_netdriver.c +++ b/arch/sim/src/up_netdriver.c @@ -181,7 +181,7 @@ void netdriver_loop(void) /* Update the Ethernet header with the correct MAC address */ #ifdef CONFIG_NET_IPv6 - if (BUF->type == HTONS(ETHTYPE_IP)) + if (IFF_IS_IPv4(g_sim_dev.d_flags)) #endif { arp_out(&g_sim_dev); @@ -213,7 +213,7 @@ void netdriver_loop(void) #ifdef CONFIG_NET_IPv4 /* Update the Ethernet header with the correct MAC address */ - if (BUF->type == HTONS(ETHTYPE_IP)) + if (IFF_IS_IPv4(g_sim_dev.d_flags)) { arp_out(&g_sim_dev); } diff --git a/arch/z80/src/ez80/ez80_emac.c b/arch/z80/src/ez80/ez80_emac.c index 2a65638ecd0..7c2e935d010 100644 --- a/arch/z80/src/ez80/ez80_emac.c +++ b/arch/z80/src/ez80/ez80_emac.c @@ -1292,7 +1292,7 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv) /* Update the Ethernet header with the correct MAC address */ #ifdef CONFIG_NET_IPv6 - if (ETHBUF->type == HTONS(ETHTYPE_IP)) + if (IFF_IS_IPv4(priv->dev.d_flags)) #endif { arp_out(&priv->dev); @@ -1324,7 +1324,7 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv) #ifdef CONFIG_NET_IPv4 /* Update the Ethernet header with the correct MAC address */ - if (ETHBUF->type == HTONS(ETHTYPE_IP)) + if (IFF_IS_IPv4(priv->dev.d_flags)) { arp_out(&priv->dev); }