Networking: Modify all Ethernet drivers: Do neighbor look-up on all outgoing IPv6 packs in order to properly set the destination link layer address.

This commit is contained in:
Gregory Nutt 2015-01-20 15:52:25 -06:00
parent 10c7b1d5bf
commit 1ad73c52b1
21 changed files with 276 additions and 25 deletions

View File

@ -1271,6 +1271,12 @@ static void c5471_receive(struct c5471_driver_s *c5471)
{
arp_out(dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(dev);
}
#endif
/* And send the packet */
@ -1297,13 +1303,19 @@ static void c5471_receive(struct c5471_driver_s *c5471)
if (dev->d_len > 0 &&
(EIM_TXDESC_OWN_HOST & getreg32(c5471->c_rxcpudesc)) == 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(dev->d_flags))
{
arp_out(dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(dev);
}
#endif
/* And send the packet */

View File

@ -552,6 +552,12 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
{
arp_out(&priv->dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */
@ -575,13 +581,19 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
if (priv->dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */

View File

@ -914,6 +914,12 @@ static void lpc17_rxdone(struct lpc17_driver_s *priv)
{
arp_out(&priv->lp_dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->lp_dev);
}
#endif
/* And send the packet */
@ -939,13 +945,19 @@ static void lpc17_rxdone(struct lpc17_driver_s *priv)
if (priv->lp_dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->lp_dev.d_flags))
{
arp_out(&priv->lp_dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->lp_dev);
}
#endif
/* And send the packet */

View File

@ -1177,6 +1177,12 @@ static void sam_receive(struct sam_emac_s *priv)
{
arp_out(&priv->dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */
@ -1200,13 +1206,19 @@ static void sam_receive(struct sam_emac_s *priv)
if (priv->dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */

View File

@ -1217,6 +1217,12 @@ static void sam_receive(struct sam_emac_s *priv)
{
arp_out(&priv->dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */
@ -1240,19 +1246,25 @@ static void sam_receive(struct sam_emac_s *priv)
if (priv->dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */
/* And send the packet */
sam_transmit(priv);
}
sam_transmit(priv);
}
}
else
#endif

View File

@ -1543,6 +1543,12 @@ static void sam_receive(struct sam_emac_s *priv)
{
arp_out(&priv->dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */
@ -1566,13 +1572,19 @@ static void sam_receive(struct sam_emac_s *priv)
if (priv->dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */

View File

@ -1147,6 +1147,12 @@ static void sam_receive(struct sam_gmac_s *priv)
{
arp_out(&priv->dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */
@ -1170,13 +1176,19 @@ static void sam_receive(struct sam_gmac_s *priv)
if (priv->dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */

View File

@ -1649,6 +1649,12 @@ static void stm32_receive(FAR struct stm32_ethmac_s *priv)
{
arp_out(&priv->dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */
@ -1672,13 +1678,19 @@ static void stm32_receive(FAR struct stm32_ethmac_s *priv)
if (priv->dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */

View File

@ -805,6 +805,12 @@ static void tiva_receive(struct tiva_driver_s *priv)
{
arp_out(&priv->ld_dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->ld_dev);
}
#endif
/* And send the packet */
@ -830,13 +836,19 @@ static void tiva_receive(struct tiva_driver_s *priv)
if (priv->dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->ld_dev.d_flags))
{
arp_out(&priv->ld_dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->ld_dev);
}
#endif
/* And send the packet */

View File

@ -1719,7 +1719,12 @@ static void tiva_receive(FAR struct tiva_ethmac_s *priv)
{
arp_out(&priv->dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */
tiva_transmit(priv);
@ -1742,13 +1747,19 @@ static void tiva_receive(FAR struct tiva_ethmac_s *priv)
if (priv->dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */

View File

@ -294,6 +294,12 @@ static void emac_receive(FAR struct emac_driver_s *priv)
{
arp_out(&priv->d_dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->d_dev);
}
#endif
/* And send the packet */
@ -317,13 +323,19 @@ static void emac_receive(FAR struct emac_driver_s *priv)
if (priv->d_dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->d_dev.d_flags))
{
arp_out(&priv->d_dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->d_dev);
}
#endif
/* And send the packet */

View File

@ -1471,6 +1471,12 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
{
arp_out(&priv->pd_dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->pd_dev);
}
#endif
/* And send the packet */
@ -1496,13 +1502,19 @@ static void pic32mx_rxdone(struct pic32mx_driver_s *priv)
if (priv->pd_dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->pd_dev.d_flags))
{
arp_out(&priv->pd_dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->pd_dev);
}
#endif
/* And send the packet */

View File

@ -198,6 +198,12 @@ void netdriver_loop(void)
{
arp_out(&g_sim_dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&g_sim_dev);
}
#endif
/* And send the packet */
@ -222,13 +228,19 @@ void netdriver_loop(void)
if (g_sim_dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(g_sim_dev.d_flags))
{
arp_out(&g_sim_dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&g_sim_dev);
}
#endif
/* And send the packet */

View File

@ -1307,6 +1307,12 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv)
{
arp_out(&priv->dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */
@ -1331,13 +1337,19 @@ static int ez80emac_receive(struct ez80emac_driver_s *priv)
if (priv->dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */

View File

@ -472,6 +472,12 @@ static void cs89x0_receive(struct cs89x0_driver_s *cs89x0, uint16_t isq)
{
arp_out(&cs89x0->cs_dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&s89x0->cs_dev);
}
#endif
/* And send the packet */
@ -495,13 +501,19 @@ static void cs89x0_receive(struct cs89x0_driver_s *cs89x0, uint16_t isq)
if (cs89x0->cs_dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(cs89x0->cs_dev.d_flags))
{
arp_out(&cs89x0->cs_dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&cs89x0->cs_dev);
}
#endif
/* And send the packet */

View File

@ -1016,6 +1016,12 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
{
arp_out(&dm9x->dm_dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&dm9x->dm_dev);
}
#endif
/* And send the packet */
@ -1039,13 +1045,19 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
if (dm9x->dm_dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(dm9x->dm_dev.d_flags))
{
arp_out(&dm9x->dm_dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&dm9x->dm_dev);
}
#endif
/* And send the packet */

View File

@ -603,6 +603,12 @@ static void e1000_receive(struct e1000_dev *e1000)
{
arp_out(&e1000->netdev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&e1000->netdev);
}
#endif
/* And send the packet */
@ -626,13 +632,19 @@ static void e1000_receive(struct e1000_dev *e1000)
if (e1000->netdev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(e1000->netdev.d_flags))
{
arp_out(&e1000->netdev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&e1000->netdev);
}
#endif
/* And send the packet */

View File

@ -1412,6 +1412,12 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
{
arp_out(&priv->dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */
@ -1435,13 +1441,19 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
if (priv->dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */

View File

@ -1540,6 +1540,12 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
{
arp_out(&priv->dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */
@ -1572,13 +1578,19 @@ static void enc_rxdispatch(FAR struct enc_driver_s *priv)
if (priv->dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(priv->dev.d_flags))
{
arp_out(&priv->dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&priv->dev);
}
#endif
/* And send the packet */

View File

@ -326,6 +326,12 @@ static void skel_receive(FAR struct skel_driver_s *skel)
{
arp_out(&skel->sk_dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&kel->sk_dev);
}
#endif
/* And send the packet */
@ -349,13 +355,19 @@ static void skel_receive(FAR struct skel_driver_s *skel)
if (skel->sk_dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(skel->sk_dev.d_flags))
{
arp_out(&skel->sk_dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&skel->sk_dev);
}
#endif
/* And send the packet */

View File

@ -339,6 +339,12 @@ void rtos_vnet_recv(struct rgmp_vnet *rgmp_vnet, char *data, int len)
{
arp_out(&vnet->sk_dev);
}
#ifdef CONFIG_NET_IPv6
else
{
neighbor_out(&vnet->sk_dev);
}
#endif
/* And send the packet */
@ -362,13 +368,19 @@ void rtos_vnet_recv(struct rgmp_vnet *rgmp_vnet, char *data, int len)
if (vnet->sk_dev.d_len > 0)
{
#ifdef CONFIG_NET_IPv4
/* Update the Ethernet header with the correct MAC address */
#ifdef CONFIG_NET_IPv4
if (IFF_IS_IPv4(vnet->sk_dev.d_flags))
{
arp_out(&vnet->sk_dev);
}
else
#endif
#ifdef CONFIG_NET_IPv6
{
neighbor_out(&vnet->sk_dev);
}
#endif
/* And send the packet */