netdev/ipv6: Move xxx_ipv6multicast from arch to common code

The `xxx_ipv6multicast` function in each driver is not adapted to
multiple IPv6 addresses yet, and they're redundant, so try to take them
into common code.

Change:
1. Add MAC `g_ipv6_ethallnodes` and `g_ipv6_ethallrouters` in
   `icmpv6_devinit` and call them in `netdev_register`
2. Add multicast MAC for Neighbor Solicitation when adding any IPv6
   address, and remove them when IPv6 address is removed
3. Select `NET_MCASTGROUP` when `NET_ICMPv6` because now we need
   `d_addmac` when we have ICMPv6

Note:
We want modules outside net stack to call functions like
`netdev_ipv6_add` and never touch the related MAC address, so these MAC
functions are added as internal functions to `net/netdev/netdev.h`

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng 2023-12-13 12:39:43 +08:00 committed by Xiang Xiao
parent 06e5b661ed
commit 5aeb15469a
37 changed files with 290 additions and 2066 deletions

View File

@ -740,9 +740,6 @@ static inline void at32_ethgpioconfig(struct at32_ethmac_s *priv);
static int at32_ethreset(struct at32_ethmac_s *priv); static int at32_ethreset(struct at32_ethmac_s *priv);
static int at32_macconfig(struct at32_ethmac_s *priv); static int at32_macconfig(struct at32_ethmac_s *priv);
static void at32_macaddress(struct at32_ethmac_s *priv); static void at32_macaddress(struct at32_ethmac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void at32_ipv6multicast(struct at32_ethmac_s *priv);
#endif
static int at32_macenable(struct at32_ethmac_s *priv); static int at32_macenable(struct at32_ethmac_s *priv);
static int at32_ethconfig(struct at32_ethmac_s *priv); static int at32_ethconfig(struct at32_ethmac_s *priv);
@ -3651,79 +3648,6 @@ static void at32_macaddress(struct at32_ethmac_s *priv)
at32_putreg(regval, AT32_ETH_MACA0LR); at32_putreg(regval, AT32_ETH_MACA0LR);
} }
/****************************************************************************
* Function: at32_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void at32_ipv6multicast(struct at32_ethmac_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
at32_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
at32_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
at32_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: at32_macenable * Function: at32_macenable
* *
@ -3748,12 +3672,6 @@ static int at32_macenable(struct at32_ethmac_s *priv)
at32_macaddress(priv); at32_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up the IPv6 multicast address */
at32_ipv6multicast(priv);
#endif
/* Enable transmit state machine of the MAC for transmission on the MII */ /* Enable transmit state machine of the MAC for transmission on the MII */
regval = at32_getreg(AT32_ETH_MACCR); regval = at32_getreg(AT32_ETH_MACCR);

View File

@ -1657,7 +1657,7 @@ static int imx_addmac(struct net_driver_s *dev, const uint8_t *mac)
temp = imx_enet_getreg32(priv, registeraddress); temp = imx_enet_getreg32(priv, registeraddress);
temp |= 1 << hashindex; temp |= 1 << hashindex;
imx_rt_enet_putreg32(priv, temp, registeraddress); imx_enet_putreg32(priv, temp, registeraddress);
return OK; return OK;
} }

View File

@ -366,9 +366,6 @@ static void lpc17_40_txtimeout_expiry(wdparm_t arg);
/* NuttX callback functions */ /* NuttX callback functions */
#ifdef CONFIG_NET_ICMPv6
static void lpc17_40_ipv6multicast(struct lpc17_40_driver_s *priv);
#endif
static int lpc17_40_ifup(struct net_driver_s *dev); static int lpc17_40_ifup(struct net_driver_s *dev);
static int lpc17_40_ifdown(struct net_driver_s *dev); static int lpc17_40_ifdown(struct net_driver_s *dev);
@ -1358,79 +1355,6 @@ static void lpc17_40_txtimeout_expiry(wdparm_t arg)
} }
} }
/****************************************************************************
* Function: lpc17_40_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void lpc17_40_ipv6multicast(struct lpc17_40_driver_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->lp_dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
lpc17_40_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
lpc17_40_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
lpc17_40_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: lpc17_40_ifup * Function: lpc17_40_ifup
* *
@ -1486,12 +1410,6 @@ static int lpc17_40_ifup(struct net_driver_s *dev)
(uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[0]; (uint32_t)priv->lp_dev.d_mac.ether.ether_addr_octet[0];
lpc17_40_putreg(regval, LPC17_40_ETH_SA2); lpc17_40_putreg(regval, LPC17_40_ETH_SA2);
#ifdef CONFIG_NET_ICMPv6
/* Set up the IPv6 multicast address */
lpc17_40_ipv6multicast(priv);
#endif
/* Initialize Ethernet interface for the PHY setup */ /* Initialize Ethernet interface for the PHY setup */
lpc17_40_macmode(priv->lp_mode); lpc17_40_macmode(priv->lp_mode);

View File

@ -643,9 +643,6 @@ static inline void lpc43_ethgpioconfig(struct lpc43_ethmac_s *priv);
static void lpc43_ethreset(struct lpc43_ethmac_s *priv); static void lpc43_ethreset(struct lpc43_ethmac_s *priv);
static int lpc43_macconfig(struct lpc43_ethmac_s *priv); static int lpc43_macconfig(struct lpc43_ethmac_s *priv);
static void lpc43_macaddress(struct lpc43_ethmac_s *priv); static void lpc43_macaddress(struct lpc43_ethmac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void lpc43_ipv6multicast(struct lpc43_ethmac_s *priv);
#endif
static int lpc43_macenable(struct lpc43_ethmac_s *priv); static int lpc43_macenable(struct lpc43_ethmac_s *priv);
static int lpc43_ethconfig(struct lpc43_ethmac_s *priv); static int lpc43_ethconfig(struct lpc43_ethmac_s *priv);
@ -3417,79 +3414,6 @@ static void lpc43_macaddress(struct lpc43_ethmac_s *priv)
lpc43_putreg(regval, LPC43_ETH_MACA0LO); lpc43_putreg(regval, LPC43_ETH_MACA0LO);
} }
/****************************************************************************
* Function: lpc43_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void lpc43_ipv6multicast(struct lpc43_ethmac_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
lpc43_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
lpc43_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
lpc43_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: lpc43_macenable * Function: lpc43_macenable
* *
@ -3514,12 +3438,6 @@ static int lpc43_macenable(struct lpc43_ethmac_s *priv)
lpc43_macaddress(priv); lpc43_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up the IPv6 multicast address */
lpc43_ipv6multicast(priv);
#endif
/* Enable transmit state machine of the MAC for transmission on the MII */ /* Enable transmit state machine of the MAC for transmission on the MII */
regval = lpc43_getreg(LPC43_ETH_MACCR); regval = lpc43_getreg(LPC43_ETH_MACCR);

View File

@ -409,9 +409,6 @@ static void sam_txreset(struct sam_emac_s *priv);
static void sam_rxreset(struct sam_emac_s *priv); static void sam_rxreset(struct sam_emac_s *priv);
static void sam_emac_reset(struct sam_emac_s *priv); static void sam_emac_reset(struct sam_emac_s *priv);
static void sam_macaddress(struct sam_emac_s *priv); static void sam_macaddress(struct sam_emac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void sam_ipv6multicast(struct sam_emac_s *priv);
#endif
static int sam_emac_configure(struct sam_emac_s *priv); static int sam_emac_configure(struct sam_emac_s *priv);
/**************************************************************************** /****************************************************************************
@ -1690,12 +1687,6 @@ static int sam_ifup(struct net_driver_s *dev)
sam_macaddress(priv); sam_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
sam_ipv6multicast(priv);
#endif
/* Initialize for PHY access */ /* Initialize for PHY access */
ret = sam_phyinit(priv); ret = sam_phyinit(priv);
@ -3309,79 +3300,6 @@ static void sam_macaddress(struct sam_emac_s *priv)
sam_putreg(priv, SAM_EMAC_SAT1, regval); sam_putreg(priv, SAM_EMAC_SAT1, regval);
} }
/****************************************************************************
* Function: sam_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void sam_ipv6multicast(struct sam_emac_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
sam_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
sam_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
sam_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: sam_emac_configure * Function: sam_emac_configure
* *

View File

@ -440,9 +440,6 @@ static void sam_txreset(struct sam_emac_s *priv);
static void sam_rxreset(struct sam_emac_s *priv); static void sam_rxreset(struct sam_emac_s *priv);
static void sam_emac_reset(struct sam_emac_s *priv); static void sam_emac_reset(struct sam_emac_s *priv);
static void sam_macaddress(struct sam_emac_s *priv); static void sam_macaddress(struct sam_emac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void sam_ipv6multicast(struct sam_emac_s *priv);
#endif
static int sam_emac_configure(struct sam_emac_s *priv); static int sam_emac_configure(struct sam_emac_s *priv);
/**************************************************************************** /****************************************************************************
@ -1751,12 +1748,6 @@ static int sam_ifup(struct net_driver_s *dev)
sam_macaddress(priv); sam_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
sam_ipv6multicast(priv);
#endif
/* Initialize for PHY access */ /* Initialize for PHY access */
ret = sam_phyinit(priv); ret = sam_phyinit(priv);
@ -3373,79 +3364,6 @@ static void sam_macaddress(struct sam_emac_s *priv)
sam_putreg(priv, SAM_EMAC_SA1T, regval); sam_putreg(priv, SAM_EMAC_SA1T, regval);
} }
/****************************************************************************
* Function: sam_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void sam_ipv6multicast(struct sam_emac_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
sam_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
sam_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
sam_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: sam_emac_configure * Function: sam_emac_configure
* *

View File

@ -517,9 +517,6 @@ static void sam_emac_disableclk(struct sam_emac_s *priv);
#endif #endif
static void sam_emac_reset(struct sam_emac_s *priv); static void sam_emac_reset(struct sam_emac_s *priv);
static void sam_macaddress(struct sam_emac_s *priv); static void sam_macaddress(struct sam_emac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void sam_ipv6multicast(struct sam_emac_s *priv);
#endif
static int sam_emac_configure(struct sam_emac_s *priv); static int sam_emac_configure(struct sam_emac_s *priv);
/**************************************************************************** /****************************************************************************
@ -2096,12 +2093,6 @@ static int sam_ifup(struct net_driver_s *dev)
sam_macaddress(priv); sam_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
sam_ipv6multicast(priv);
#endif
/* Initialize for PHY access */ /* Initialize for PHY access */
ret = sam_phyinit(priv); ret = sam_phyinit(priv);
@ -3999,79 +3990,6 @@ static void sam_macaddress(struct sam_emac_s *priv)
sam_putreg(priv, SAM_EMAC_SAT1_OFFSET, regval); sam_putreg(priv, SAM_EMAC_SAT1_OFFSET, regval);
} }
/****************************************************************************
* Function: sam_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void sam_ipv6multicast(struct sam_emac_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
sam_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
sam_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
sam_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: sam_emac_configure * Function: sam_emac_configure
* *

View File

@ -371,9 +371,6 @@ static void sam_txreset(struct sam_gmac_s *priv);
static void sam_rxreset(struct sam_gmac_s *priv); static void sam_rxreset(struct sam_gmac_s *priv);
static void sam_gmac_reset(struct sam_gmac_s *priv); static void sam_gmac_reset(struct sam_gmac_s *priv);
static void sam_macaddress(struct sam_gmac_s *priv); static void sam_macaddress(struct sam_gmac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void sam_ipv6multicast(struct sam_gmac_s *priv);
#endif
static int sam_gmac_configure(struct sam_gmac_s *priv); static int sam_gmac_configure(struct sam_gmac_s *priv);
/**************************************************************************** /****************************************************************************
@ -1735,12 +1732,6 @@ static int sam_ifup(struct net_driver_s *dev)
sam_macaddress(priv); sam_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
sam_ipv6multicast(priv);
#endif
/* Initialize for PHY access */ /* Initialize for PHY access */
ret = sam_phyinit(priv); ret = sam_phyinit(priv);
@ -3453,79 +3444,6 @@ static void sam_macaddress(struct sam_gmac_s *priv)
sam_putreg(priv, SAM_GMAC_SAT1, regval); sam_putreg(priv, SAM_GMAC_SAT1, regval);
} }
/****************************************************************************
* Function: sam_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void sam_ipv6multicast(struct sam_gmac_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
sam_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
sam_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
sam_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: sam_gmac_configure * Function: sam_gmac_configure
* *

View File

@ -368,9 +368,6 @@ static void sam_txreset(struct sam_gmac_s *priv);
static void sam_rxreset(struct sam_gmac_s *priv); static void sam_rxreset(struct sam_gmac_s *priv);
static void sam_gmac_reset(struct sam_gmac_s *priv); static void sam_gmac_reset(struct sam_gmac_s *priv);
static void sam_macaddress(struct sam_gmac_s *priv); static void sam_macaddress(struct sam_gmac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void sam_ipv6multicast(struct sam_gmac_s *priv);
#endif
static int sam_gmac_configure(struct sam_gmac_s *priv); static int sam_gmac_configure(struct sam_gmac_s *priv);
/**************************************************************************** /****************************************************************************
@ -1700,12 +1697,6 @@ static int sam_ifup(struct net_driver_s *dev)
sam_macaddress(priv); sam_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
sam_ipv6multicast(priv);
#endif
/* Initialize for PHY access */ /* Initialize for PHY access */
ret = sam_phyinit(priv); ret = sam_phyinit(priv);
@ -3391,79 +3382,6 @@ static void sam_macaddress(struct sam_gmac_s *priv)
sam_putreg(priv, SAM_GMAC_SAT1, regval); sam_putreg(priv, SAM_GMAC_SAT1, regval);
} }
/****************************************************************************
* Function: sam_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void sam_ipv6multicast(struct sam_gmac_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
sam_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
sam_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
sam_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: sam_gmac_configure * Function: sam_gmac_configure
* *

View File

@ -617,9 +617,6 @@ static void sam_emac_disableclk(struct sam_emac_s *priv);
#endif #endif
static void sam_emac_reset(struct sam_emac_s *priv); static void sam_emac_reset(struct sam_emac_s *priv);
static void sam_macaddress(struct sam_emac_s *priv); static void sam_macaddress(struct sam_emac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void sam_ipv6multicast(struct sam_emac_s *priv);
#endif
static int sam_queue0_configure(struct sam_emac_s *priv); static int sam_queue0_configure(struct sam_emac_s *priv);
static int sam_queue_configure(struct sam_emac_s *priv, int qid); static int sam_queue_configure(struct sam_emac_s *priv, int qid);
@ -2548,12 +2545,6 @@ static int sam_ifup(struct net_driver_s *dev)
sam_macaddress(priv); sam_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
sam_ipv6multicast(priv);
#endif
/* Initialize for PHY access */ /* Initialize for PHY access */
ret = sam_phyinit(priv); ret = sam_phyinit(priv);
@ -4576,79 +4567,6 @@ static void sam_macaddress(struct sam_emac_s *priv)
sam_putreg(priv, SAM_EMAC_SAT1_OFFSET, regval); sam_putreg(priv, SAM_EMAC_SAT1_OFFSET, regval);
} }
/****************************************************************************
* Function: sam_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void sam_ipv6multicast(struct sam_emac_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
sam_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
sam_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
sam_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: sam_queue0_configure * Function: sam_queue0_configure
* *

View File

@ -761,9 +761,6 @@ static inline void stm32_ethgpioconfig(struct stm32_ethmac_s *priv);
static int stm32_ethreset(struct stm32_ethmac_s *priv); static int stm32_ethreset(struct stm32_ethmac_s *priv);
static int stm32_macconfig(struct stm32_ethmac_s *priv); static int stm32_macconfig(struct stm32_ethmac_s *priv);
static void stm32_macaddress(struct stm32_ethmac_s *priv); static void stm32_macaddress(struct stm32_ethmac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void stm32_ipv6multicast(struct stm32_ethmac_s *priv);
#endif
static int stm32_macenable(struct stm32_ethmac_s *priv); static int stm32_macenable(struct stm32_ethmac_s *priv);
static int stm32_ethconfig(struct stm32_ethmac_s *priv); static int stm32_ethconfig(struct stm32_ethmac_s *priv);
@ -3998,79 +3995,6 @@ static void stm32_macaddress(struct stm32_ethmac_s *priv)
stm32_putreg(regval, STM32_ETH_MACA0LR); stm32_putreg(regval, STM32_ETH_MACA0LR);
} }
/****************************************************************************
* Function: stm32_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void stm32_ipv6multicast(struct stm32_ethmac_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
stm32_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
stm32_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
stm32_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: stm32_macenable * Function: stm32_macenable
* *
@ -4095,12 +4019,6 @@ static int stm32_macenable(struct stm32_ethmac_s *priv)
stm32_macaddress(priv); stm32_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up the IPv6 multicast address */
stm32_ipv6multicast(priv);
#endif
/* Enable transmit state machine of the MAC for transmission on the MII */ /* Enable transmit state machine of the MAC for transmission on the MII */
regval = stm32_getreg(STM32_ETH_MACCR); regval = stm32_getreg(STM32_ETH_MACCR);

View File

@ -770,9 +770,6 @@ static inline void stm32_ethgpioconfig(struct stm32_ethmac_s *priv);
static void stm32_ethreset(struct stm32_ethmac_s *priv); static void stm32_ethreset(struct stm32_ethmac_s *priv);
static int stm32_macconfig(struct stm32_ethmac_s *priv); static int stm32_macconfig(struct stm32_ethmac_s *priv);
static void stm32_macaddress(struct stm32_ethmac_s *priv); static void stm32_macaddress(struct stm32_ethmac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void stm32_ipv6multicast(struct stm32_ethmac_s *priv);
#endif
static int stm32_macenable(struct stm32_ethmac_s *priv); static int stm32_macenable(struct stm32_ethmac_s *priv);
static int stm32_ethconfig(struct stm32_ethmac_s *priv); static int stm32_ethconfig(struct stm32_ethmac_s *priv);
@ -3731,79 +3728,6 @@ static void stm32_macaddress(struct stm32_ethmac_s *priv)
stm32_putreg(regval, STM32_ETH_MACA0LR); stm32_putreg(regval, STM32_ETH_MACA0LR);
} }
/****************************************************************************
* Function: stm32_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void stm32_ipv6multicast(struct stm32_ethmac_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
stm32_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
stm32_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
stm32_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: stm32_macenable * Function: stm32_macenable
* *
@ -3828,12 +3752,6 @@ static int stm32_macenable(struct stm32_ethmac_s *priv)
stm32_macaddress(priv); stm32_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up the IPv6 multicast address */
stm32_ipv6multicast(priv);
#endif
/* Enable transmit state machine of the MAC for transmission on the MII */ /* Enable transmit state machine of the MAC for transmission on the MII */
regval = stm32_getreg(STM32_ETH_MACCR); regval = stm32_getreg(STM32_ETH_MACCR);

View File

@ -776,9 +776,6 @@ static inline void stm32_ethgpioconfig(struct stm32_ethmac_s *priv);
static void stm32_ethreset(struct stm32_ethmac_s *priv); static void stm32_ethreset(struct stm32_ethmac_s *priv);
static int stm32_macconfig(struct stm32_ethmac_s *priv); static int stm32_macconfig(struct stm32_ethmac_s *priv);
static void stm32_macaddress(struct stm32_ethmac_s *priv); static void stm32_macaddress(struct stm32_ethmac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void stm32_ipv6multicast(struct stm32_ethmac_s *priv);
#endif
static int stm32_macenable(struct stm32_ethmac_s *priv); static int stm32_macenable(struct stm32_ethmac_s *priv);
static int stm32_ethconfig(struct stm32_ethmac_s *priv); static int stm32_ethconfig(struct stm32_ethmac_s *priv);
@ -3958,79 +3955,6 @@ static void stm32_macaddress(struct stm32_ethmac_s *priv)
stm32_putreg(regval, STM32_ETH_MACA0LR); stm32_putreg(regval, STM32_ETH_MACA0LR);
} }
/****************************************************************************
* Function: stm32_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void stm32_ipv6multicast(struct stm32_ethmac_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
stm32_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
stm32_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
stm32_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: stm32_macenable * Function: stm32_macenable
* *
@ -4055,12 +3979,6 @@ static int stm32_macenable(struct stm32_ethmac_s *priv)
stm32_macaddress(priv); stm32_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up the IPv6 multicast address */
stm32_ipv6multicast(priv);
#endif
/* Enable transmit state machine of the MAC for transmission on the MII */ /* Enable transmit state machine of the MAC for transmission on the MII */
regval = stm32_getreg(STM32_ETH_MACCR); regval = stm32_getreg(STM32_ETH_MACCR);

View File

@ -758,9 +758,6 @@ static inline void tiva_phy_initialize(struct tiva_ethmac_s *priv);
static void tiva_ethreset(struct tiva_ethmac_s *priv); static void tiva_ethreset(struct tiva_ethmac_s *priv);
static int tiva_macconfig(struct tiva_ethmac_s *priv); static int tiva_macconfig(struct tiva_ethmac_s *priv);
static void tiva_macaddress(struct tiva_ethmac_s *priv); static void tiva_macaddress(struct tiva_ethmac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void tiva_ipv6multicast(struct tiva_ethmac_s *priv);
#endif
static int tiva_macenable(struct tiva_ethmac_s *priv); static int tiva_macenable(struct tiva_ethmac_s *priv);
static int tive_emac_configure(struct tiva_ethmac_s *priv); static int tive_emac_configure(struct tiva_ethmac_s *priv);
@ -3647,79 +3644,6 @@ static void tiva_macaddress(struct tiva_ethmac_s *priv)
tiva_putreg(regval, TIVA_EMAC_ADDR0L); tiva_putreg(regval, TIVA_EMAC_ADDR0L);
} }
/****************************************************************************
* Function: tiva_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void tiva_ipv6multicast(struct tiva_ethmac_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
tiva_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
tiva_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
tiva_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Function: tiva_macenable * Function: tiva_macenable
* *
@ -3744,12 +3668,6 @@ static int tiva_macenable(struct tiva_ethmac_s *priv)
tiva_macaddress(priv); tiva_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up the IPv6 multicast address */
tiva_ipv6multicast(priv);
#endif
/* Enable transmit state machine of the MAC for transmission on the MII */ /* Enable transmit state machine of the MAC for transmission on the MII */
regval = tiva_getreg(TIVA_EMAC_CFG); regval = tiva_getreg(TIVA_EMAC_CFG);

View File

@ -160,9 +160,6 @@ static int misoc_net_addmac(struct net_driver_s *dev,
static int misoc_net_rmmac(struct net_driver_s *dev, static int misoc_net_rmmac(struct net_driver_s *dev,
const uint8_t *mac); const uint8_t *mac);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
static void misoc_net_ipv6multicast(struct misoc_net_driver_s *priv);
#endif
#endif #endif
/**************************************************************************** /****************************************************************************
@ -685,16 +682,6 @@ static int misoc_net_ifup(struct net_driver_s *dev)
/* Initialize PHYs, Ethernet interface, and setup up Ethernet interrupts */ /* Initialize PHYs, Ethernet interface, and setup up Ethernet interrupts */
/* Instantiate the MAC address from
* priv->misoc_net_dev.d_mac.ether.ether_addr_octet
*/
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
misoc_net_ipv6multicast(priv);
#endif
flags = enter_critical_section(); flags = enter_critical_section();
priv->misoc_net_bifup = true; priv->misoc_net_bifup = true;
@ -895,79 +882,6 @@ static int misoc_net_rmmac(struct net_driver_s *dev,
} }
#endif #endif
/****************************************************************************
* Function: misoc_net_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void misoc_net_ipv6multicast(struct misoc_net_driver_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
misoc_net_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
misoc_net_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
misoc_net_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/

View File

@ -267,9 +267,6 @@ static int bl602_net_addmac(struct net_driver_s *dev,
static int bl602_net_rmmac(struct net_driver_s *dev, static int bl602_net_rmmac(struct net_driver_s *dev,
const uint8_t *mac); const uint8_t *mac);
# endif # endif
# ifdef CONFIG_NET_ICMPv6
static void bl602_net_ipv6multicast(struct bl602_net_driver_s *priv);
# endif
#endif #endif
#ifdef CONFIG_NETDEV_IOCTL #ifdef CONFIG_NETDEV_IOCTL
@ -796,12 +793,6 @@ static int bl602_net_ifup(struct net_driver_s *dev)
dev->d_ipv6addr[7]); dev->d_ipv6addr[7]);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
bl602_net_ipv6multicast(priv);
#endif
return OK; return OK;
} }
@ -1024,83 +1015,6 @@ static int bl602_net_rmmac(struct net_driver_s *dev,
} }
#endif #endif
/****************************************************************************
* Name: bl602_net_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void bl602_net_ipv6multicast(struct bl602_net_driver_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Wireless MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Wireless MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->net_dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0],
mac[1],
mac[2],
mac[3],
mac[4],
mac[5]);
bl602_net_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes MAC address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
bl602_net_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers MAC address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
bl602_net_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
static void scan_complete_indicate(void *data, void *param) static void scan_complete_indicate(void *data, void *param)
{ {
int i; int i;

View File

@ -233,10 +233,6 @@ static int wlan_ioctl(struct net_driver_s *dev, int cmd,
unsigned long arg); unsigned long arg);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
static void wlan_ipv6multicast(struct wlan_priv_s *priv);
#endif
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@ -826,13 +822,6 @@ static int wlan_ifup(struct net_driver_s *dev)
return ret; return ret;
} }
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
wlan_ipv6multicast(priv);
#endif
IOB_QINIT(&priv->rxb); IOB_QINIT(&priv->rxb);
IOB_QINIT(&priv->txb); IOB_QINIT(&priv->txb);
@ -1001,76 +990,6 @@ static int wlan_rmmac(struct net_driver_s *dev, const uint8_t *mac)
} }
#endif #endif
/****************************************************************************
* Name: wlan_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void wlan_ipv6multicast(struct wlan_priv_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
wlan_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
wlan_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
wlan_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Name: wlan_ioctl * Name: wlan_ioctl
* *

View File

@ -387,9 +387,6 @@ static void mpfs_rxreset(struct mpfs_ethmac_s *priv);
static int mpfs_macenable(struct mpfs_ethmac_s *priv); static int mpfs_macenable(struct mpfs_ethmac_s *priv);
static int mpfs_ethconfig(struct mpfs_ethmac_s *priv); static int mpfs_ethconfig(struct mpfs_ethmac_s *priv);
static void mpfs_ethreset(struct mpfs_ethmac_s *priv); static void mpfs_ethreset(struct mpfs_ethmac_s *priv);
#ifdef CONFIG_NET_ICMPv6
static void mpfs_ipv6multicast(struct sam_gmac_s *priv);
#endif
static void mpfs_interrupt_work(void *arg); static void mpfs_interrupt_work(void *arg);
@ -1526,12 +1523,6 @@ static int mpfs_ifup(struct net_driver_s *dev)
mpfs_macaddress(priv); mpfs_macaddress(priv);
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
mpfs_ipv6multicast(priv);
#endif
/* Initialize for PHY access */ /* Initialize for PHY access */
ret = mpfs_phyinit(priv); ret = mpfs_phyinit(priv);

View File

@ -287,10 +287,6 @@ static int wlan_ioctl(struct net_driver_s *dev, int cmd,
unsigned long arg); unsigned long arg);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
static void wlan_ipv6multicast(struct wlan_priv_s *priv);
#endif
static struct wlan_pktbuf *wlan_recvframe(struct wlan_priv_s *priv); static struct wlan_pktbuf *wlan_recvframe(struct wlan_priv_s *priv);
static struct wlan_pktbuf *wlan_txframe(struct wlan_priv_s *priv); static struct wlan_pktbuf *wlan_txframe(struct wlan_priv_s *priv);
static inline void wlan_free_buffer(struct wlan_priv_s *priv, static inline void wlan_free_buffer(struct wlan_priv_s *priv,
@ -1158,13 +1154,6 @@ static int wlan_ifup(struct net_driver_s *dev)
return OK; return OK;
} }
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
wlan_ipv6multicast(priv);
#endif
wlan_init_buffer(priv); wlan_init_buffer(priv);
ret = priv->ops->start(); ret = priv->ops->start();
if (ret < 0) if (ret < 0)
@ -1340,76 +1329,6 @@ static int wlan_rmmac(struct net_driver_s *dev, const uint8_t *mac)
} }
#endif #endif
/****************************************************************************
* Name: wlan_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void wlan_ipv6multicast(struct wlan_priv_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
wlan_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
wlan_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
wlan_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Name: wlan_ioctl * Name: wlan_ioctl
* *

View File

@ -237,10 +237,6 @@ static int wlan_ioctl(struct net_driver_s *dev, int cmd,
unsigned long arg); unsigned long arg);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
static void wlan_ipv6multicast(struct wlan_priv_s *priv);
#endif
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@ -819,13 +815,6 @@ static int wlan_ifup(struct net_driver_s *dev)
return ret; return ret;
} }
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
wlan_ipv6multicast(priv);
#endif
IOB_QINIT(&priv->rxb); IOB_QINIT(&priv->rxb);
IOB_QINIT(&priv->txb); IOB_QINIT(&priv->txb);
@ -994,76 +983,6 @@ static int wlan_rmmac(struct net_driver_s *dev, const uint8_t *mac)
} }
#endif #endif
/****************************************************************************
* Name: wlan_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void wlan_ipv6multicast(struct wlan_priv_s *priv)
{
struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
wlan_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
wlan_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
wlan_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Name: wlan_ioctl * Name: wlan_ioctl
* *

View File

@ -221,9 +221,6 @@ static int ftmac100_addmac(FAR struct net_driver_s *dev,
static int ftmac100_rmmac(FAR struct net_driver_s *dev, static int ftmac100_rmmac(FAR struct net_driver_s *dev,
FAR const uint8_t *mac); FAR const uint8_t *mac);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
static void ftmac100_ipv6multicast(FAR struct ftmac100_driver_s *priv);
#endif
#endif #endif
/**************************************************************************** /****************************************************************************
@ -1061,12 +1058,6 @@ static int ftmac100_ifup(struct net_driver_s *dev)
ftmac100_set_mac(priv, priv->ft_dev.d_mac.ether.ether_addr_octet); ftmac100_set_mac(priv, priv->ft_dev.d_mac.ether.ether_addr_octet);
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
ftmac100_ipv6multicast(priv);
#endif
/* Enable the Ethernet interrupt */ /* Enable the Ethernet interrupt */
priv->ft_bifup = true; priv->ft_bifup = true;
@ -1309,79 +1300,6 @@ static int ftmac100_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac)
} }
#endif #endif
/****************************************************************************
* Name: ftmac100_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void ftmac100_ipv6multicast(FAR struct ftmac100_driver_s *priv)
{
FAR struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->ft_dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
ftmac100_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
ftmac100_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
ftmac100_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/

View File

@ -129,9 +129,6 @@ static int lan91c111_addmac(FAR struct net_driver_s *dev,
static int lan91c111_rmmac(FAR struct net_driver_s *dev, static int lan91c111_rmmac(FAR struct net_driver_s *dev,
FAR const uint8_t *mac); FAR const uint8_t *mac);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
static void lan91c111_ipv6multicast(FAR struct net_driver_s *dev);
#endif
#endif #endif
#ifdef CONFIG_NETDEV_IOCTL #ifdef CONFIG_NETDEV_IOCTL
static int lan91c111_ioctl(FAR struct net_driver_s *dev, int cmd, static int lan91c111_ioctl(FAR struct net_driver_s *dev, int cmd,
@ -974,12 +971,6 @@ static int lan91c111_ifup(FAR struct net_driver_s *dev)
copyto16(priv, ADDR0_REG, &dev->d_mac.ether, sizeof(dev->d_mac.ether)); copyto16(priv, ADDR0_REG, &dev->d_mac.ether, sizeof(dev->d_mac.ether));
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
lan91c111_ipv6multicast(dev);
#endif
net_unlock(); net_unlock();
/* Enable the Ethernet interrupt */ /* Enable the Ethernet interrupt */
@ -1248,76 +1239,6 @@ static int lan91c111_rmmac(FAR struct net_driver_s *dev,
} }
#endif #endif
/****************************************************************************
* Name: lan91c111_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Parameters:
* dev - Reference to the NuttX driver state structure
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void lan91c111_ipv6multicast(FAR struct net_driver_s *dev)
{
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
lan91c111_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
lan91c111_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
lan91c111_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Name: lan91c111_ioctl * Name: lan91c111_ioctl
* *

View File

@ -131,9 +131,6 @@ static int net_rpmsg_drv_addmac(FAR struct net_driver_s *dev,
static int net_rpmsg_drv_rmmac(FAR struct net_driver_s *dev, static int net_rpmsg_drv_rmmac(FAR struct net_driver_s *dev,
FAR const uint8_t *mac); FAR const uint8_t *mac);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
static void net_rpmsg_drv_ipv6multicast(FAR struct net_driver_s *dev);
#endif
#endif #endif
#ifdef CONFIG_NETDEV_IOCTL #ifdef CONFIG_NETDEV_IOCTL
static int net_rpmsg_drv_ioctl(FAR struct net_driver_s *dev, int cmd, static int net_rpmsg_drv_ioctl(FAR struct net_driver_s *dev, int cmd,
@ -715,12 +712,6 @@ static int net_rpmsg_drv_ifup(FAR struct net_driver_s *dev)
net_ipv6addr_copy(dev->d_ipv6netmask, msg.ipv6netmask); net_ipv6addr_copy(dev->d_ipv6netmask, msg.ipv6netmask);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
net_rpmsg_drv_ipv6multicast(dev);
#endif
net_unlock(); net_unlock();
#ifdef CONFIG_NETDB_DNSCLIENT #ifdef CONFIG_NETDB_DNSCLIENT
@ -960,77 +951,6 @@ static int net_rpmsg_drv_rmmac(FAR struct net_driver_s *dev,
} }
#endif #endif
/****************************************************************************
* Name: net_rpmsg_drv_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Parameters:
* dev - Reference to the NuttX driver state structure
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void net_rpmsg_drv_ipv6multicast(FAR struct net_driver_s *dev)
{
if (dev->d_lltype == NET_LL_ETHERNET || dev->d_lltype == NET_LL_IEEE80211)
{
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
net_rpmsg_drv_addmac(dev, mac);
#if defined(CONFIG_NET_ETHERNET) && defined(CONFIG_NET_ICMPv6_AUTOCONF)
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
net_rpmsg_drv_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ETHERNET && CONFIG_NET_ICMPv6_AUTOCONF */
#if defined(CONFIG_NET_ETHERNET) && defined(CONFIG_NET_ICMPv6_ROUTER)
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
net_rpmsg_drv_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ETHERNET && CONFIG_NET_ICMPv6_ROUTER */
}
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Name: net_rpmsg_drv_ioctl * Name: net_rpmsg_drv_ioctl
* *

View File

@ -174,9 +174,6 @@ static int skel_addmac(FAR struct net_driver_s *dev,
static int skel_rmmac(FAR struct net_driver_s *dev, static int skel_rmmac(FAR struct net_driver_s *dev,
FAR const uint8_t *mac); FAR const uint8_t *mac);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
static void skel_ipv6multicast(FAR struct skel_driver_s *priv);
#endif
#endif #endif
#ifdef CONFIG_NETDEV_IOCTL #ifdef CONFIG_NETDEV_IOCTL
static int skel_ioctl(FAR struct net_driver_s *dev, int cmd, static int skel_ioctl(FAR struct net_driver_s *dev, int cmd,
@ -650,14 +647,6 @@ static int skel_ifup(FAR struct net_driver_s *dev)
/* Initialize PHYs, Ethernet interface, and setup up Ethernet interrupts */ /* Initialize PHYs, Ethernet interface, and setup up Ethernet interrupts */
/* Instantiate MAC address from priv->sk_dev.d_mac.ether.ether_addr_octet */
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
skel_ipv6multicast(priv);
#endif
/* Enable the Ethernet interrupt */ /* Enable the Ethernet interrupt */
priv->sk_bifup = true; priv->sk_bifup = true;
@ -849,78 +838,6 @@ static int skel_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
} }
#endif #endif
/****************************************************************************
* Name: skel_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void skel_ipv6multicast(FAR struct skel_driver_s *priv)
{
FAR struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->sk_dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
skel_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
skel_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
skel_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Name: skel_ioctl * Name: skel_ioctl
* *

View File

@ -433,9 +433,6 @@ static int w5500_addmac(FAR struct net_driver_s *dev,
static int w5500_rmmac(FAR struct net_driver_s *dev, static int w5500_rmmac(FAR struct net_driver_s *dev,
FAR const uint8_t *mac); FAR const uint8_t *mac);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
static void w5500_ipv6multicast(FAR struct w5500_driver_s *priv);
#endif
#endif #endif
#ifdef CONFIG_NETDEV_IOCTL #ifdef CONFIG_NETDEV_IOCTL
static int w5500_ioctl(FAR struct net_driver_s *dev, int cmd, static int w5500_ioctl(FAR struct net_driver_s *dev, int cmd,
@ -1768,12 +1765,6 @@ static int w5500_ifup(FAR struct net_driver_s *dev)
return ret; return ret;
} }
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
w5500_ipv6multicast(self);
#endif
/* Enable the Ethernet interrupt */ /* Enable the Ethernet interrupt */
self->w_bifup = true; self->w_bifup = true;
@ -1934,6 +1925,7 @@ static int w5500_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
/* Add the MAC address to the hardware multicast routing table */ /* Add the MAC address to the hardware multicast routing table */
UNUSED(priv);
return OK; return OK;
} }
#endif #endif
@ -1962,82 +1954,11 @@ static int w5500_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
/* Add the MAC address to the hardware multicast routing table */ /* Add the MAC address to the hardware multicast routing table */
UNUSED(priv);
return OK; return OK;
} }
#endif #endif
/****************************************************************************
* Name: w5500_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void w5500_ipv6multicast(FAR struct w5500_driver_s *priv)
{
FAR struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
w5500_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
w5500_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
w5500_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Name: w5500_ioctl * Name: w5500_ioctl
* *

View File

@ -175,9 +175,6 @@ static int cdcecm_addmac(FAR struct net_driver_s *dev,
static int cdcecm_rmmac(FAR struct net_driver_s *dev, static int cdcecm_rmmac(FAR struct net_driver_s *dev,
FAR const uint8_t *mac); FAR const uint8_t *mac);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
static void cdcecm_ipv6multicast(FAR struct cdcecm_driver_s *priv);
#endif
#endif #endif
#ifdef CONFIG_NETDEV_IOCTL #ifdef CONFIG_NETDEV_IOCTL
static int cdcecm_ioctl(FAR struct net_driver_s *dev, int cmd, static int cdcecm_ioctl(FAR struct net_driver_s *dev, int cmd,
@ -597,16 +594,6 @@ static int cdcecm_ifup(FAR struct net_driver_s *dev)
dev->d_ipv6addr[6], dev->d_ipv6addr[7]); dev->d_ipv6addr[6], dev->d_ipv6addr[7]);
#endif #endif
/* Initialize PHYs, Ethernet interface, and setup up Ethernet interrupts */
/* Instantiate MAC address from priv->dev.d_mac.ether.ether_addr_octet */
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
cdcecm_ipv6multicast(priv);
#endif
priv->bifup = true; priv->bifup = true;
return OK; return OK;
} }
@ -787,78 +774,6 @@ static int cdcecm_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
} }
#endif #endif
/****************************************************************************
* Name: cdcecm_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void cdcecm_ipv6multicast(FAR struct cdcecm_driver_s *priv)
{
FAR struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
cdcecm_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
cdcecm_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
cdcecm_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Name: cdcecm_ioctl * Name: cdcecm_ioctl
* *

View File

@ -123,9 +123,6 @@ static int bcmf_addmac(FAR struct net_driver_s *dev,
static int bcmf_rmmac(FAR struct net_driver_s *dev, static int bcmf_rmmac(FAR struct net_driver_s *dev,
FAR const uint8_t *mac); FAR const uint8_t *mac);
#endif #endif
#ifdef CONFIG_NET_ICMPv6
static void bcmf_ipv6multicast(FAR struct bcmf_dev_s *priv);
#endif
#endif #endif
#ifdef CONFIG_NETDEV_IOCTL #ifdef CONFIG_NETDEV_IOCTL
static int bcmf_ioctl(FAR struct net_driver_s *dev, int cmd, static int bcmf_ioctl(FAR struct net_driver_s *dev, int cmd,
@ -636,14 +633,6 @@ static int bcmf_ifup(FAR struct net_driver_s *dev)
CONFIG_IEEE80211_BROADCOM_DEFAULT_COUNTRY); CONFIG_IEEE80211_BROADCOM_DEFAULT_COUNTRY);
} }
/* Instantiate MAC address from priv->bc_dev.d_mac.ether.ether_addr_octet */
#ifdef CONFIG_NET_ICMPv6
/* Set up IPv6 multicast address filtering */
bcmf_ipv6multicast(priv);
#endif
/* Enable the hardware interrupt */ /* Enable the hardware interrupt */
priv->bc_bifup = true; priv->bc_bifup = true;
@ -880,6 +869,7 @@ static int bcmf_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
/* Add the MAC address to the hardware multicast routing table */ /* Add the MAC address to the hardware multicast routing table */
UNUSED(priv);
return OK; return OK;
} }
#endif #endif
@ -909,82 +899,11 @@ static int bcmf_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
/* Add the MAC address to the hardware multicast routing table */ /* Add the MAC address to the hardware multicast routing table */
UNUSED(priv);
return OK; return OK;
} }
#endif #endif
/****************************************************************************
* Name: bcmf_ipv6multicast
*
* Description:
* Configure the IPv6 multicast MAC address.
*
* Input Parameters:
* priv - A reference to the private driver state structure
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void bcmf_ipv6multicast(FAR struct bcmf_dev_s *priv)
{
FAR struct net_driver_s *dev;
uint16_t tmp16;
uint8_t mac[6];
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
dev = &priv->bc_dev;
tmp16 = dev->d_ipv6addr[6];
mac[2] = 0xff;
mac[3] = tmp16 >> 8;
tmp16 = dev->d_ipv6addr[7];
mac[4] = tmp16 & 0xff;
mac[5] = tmp16 >> 8;
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
bcmf_addmac(dev, mac);
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
bcmf_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
bcmf_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
#endif /* CONFIG_NET_ICMPv6_ROUTER */
}
#endif /* CONFIG_NET_ICMPv6 */
/**************************************************************************** /****************************************************************************
* Name: bcmf_ioctl * Name: bcmf_ioctl
* *

View File

@ -22,7 +22,7 @@ if(CONFIG_NET_ICMPv6 AND NOT CONFIG_NET_ICMPv6_NO_STACK)
# ICMPv6 source files # ICMPv6 source files
set(SRCS icmpv6_input.c icmpv6_solicit.c icmpv6_advertise.c set(SRCS icmpv6_input.c icmpv6_solicit.c icmpv6_advertise.c
icmpv6_linkipaddr.c icmpv6_reply.c) icmpv6_linkipaddr.c icmpv6_reply.c icmpv6_initialize.c)
if(CONFIG_NET_ICMPv6_SOCKET) if(CONFIG_NET_ICMPv6_SOCKET)
list( list(

View File

@ -8,6 +8,7 @@ menu "ICMPv6 Networking Support"
config NET_ICMPv6 config NET_ICMPv6
bool "Enable ICMPv6 networking" bool "Enable ICMPv6 networking"
default n default n
select NET_MCASTGROUP
depends on NET depends on NET
---help--- ---help---
Enable minimal ICMPv6 support. Includes built-in support Enable minimal ICMPv6 support. Includes built-in support

View File

@ -24,7 +24,7 @@ ifneq ($(CONFIG_NET_ICMPv6_NO_STACK),y)
# ICMPv6 source files # ICMPv6 source files
NET_CSRCS += icmpv6_input.c icmpv6_solicit.c icmpv6_advertise.c NET_CSRCS += icmpv6_input.c icmpv6_solicit.c icmpv6_advertise.c
NET_CSRCS += icmpv6_linkipaddr.c icmpv6_reply.c NET_CSRCS += icmpv6_linkipaddr.c icmpv6_reply.c icmpv6_initialize.c
ifeq ($(CONFIG_NET_ICMPv6_SOCKET),y) ifeq ($(CONFIG_NET_ICMPv6_SOCKET),y)
SOCK_CSRCS += icmpv6_sockif.c icmpv6_conn.c icmpv6_sendmsg.c SOCK_CSRCS += icmpv6_sockif.c icmpv6_conn.c icmpv6_sendmsg.c

View File

@ -165,6 +165,26 @@ EXTERN const struct sock_intf_s g_icmpv6_sockif;
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: icmpv6_devinit
*
* Description:
* Called when a new network device is registered to configure that device
* for ICMPv6 support.
*
* Input Parameters:
* dev - The device driver structure to configure.
*
* Returned Value:
* None
*
* Assumptions:
* The network is locked.
*
****************************************************************************/
void icmpv6_devinit(FAR struct net_driver_s *dev);
/**************************************************************************** /****************************************************************************
* Name: icmpv6_input * Name: icmpv6_input
* *

View File

@ -0,0 +1,86 @@
/****************************************************************************
* net/icmpv6/icmpv6_initialize.c
* ICMPv6 initialization logic
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <nuttx/net/ethernet.h>
#include <nuttx/net/netdev.h>
#include "icmpv6/icmpv6.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: icmpv6_devinit
*
* Description:
* Called when a new network device is registered to configure that device
* for ICMPv6 support.
*
* Input Parameters:
* dev - The device driver structure to configure.
*
* Returned Value:
* None
*
* Assumptions:
* The network is locked.
*
****************************************************************************/
void icmpv6_devinit(FAR struct net_driver_s *dev)
{
ninfo("ICMPv6 initializing dev %p\n", dev);
#ifdef CONFIG_NET_ETHERNET
# ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Add the IPv6 all link-local nodes Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Advertisement
* packets.
*/
if (dev->d_addmac != NULL)
{
dev->d_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
}
# endif /* CONFIG_NET_ICMPv6_AUTOCONF */
# ifdef CONFIG_NET_ICMPv6_ROUTER
/* Add the IPv6 all link-local routers Ethernet address. This is the
* address that we expect to receive ICMPv6 Router Solicitation
* packets.
*/
if (dev->d_addmac != NULL)
{
dev->d_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
}
# endif /* CONFIG_NET_ICMPv6_ROUTER */
#endif /* CONFIG_NET_ETHERNET */
}

View File

@ -495,6 +495,35 @@ void netdown_notifier_teardown(int key);
void netdown_notifier_signal(FAR struct net_driver_s *dev); void netdown_notifier_signal(FAR struct net_driver_s *dev);
#endif #endif
/****************************************************************************
* Name: netdev_ipv6_addmcastmac/removemcastmac
*
* Description:
* Add / Remove an MAC address corresponds to the IPv6 address to / from
* the device's MAC filter table.
*
* Input Parameters:
* dev - The device driver structure to be modified
* addr - The IPv6 address whose related MAC will be added or removed
*
* Returned Value:
* None
*
* Assumptions:
* The caller has locked the network.
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
void netdev_ipv6_addmcastmac(FAR struct net_driver_s *dev,
const net_ipv6addr_t addr);
void netdev_ipv6_removemcastmac(FAR struct net_driver_s *dev,
const net_ipv6addr_t addr);
#else
# define netdev_ipv6_addmcastmac(dev,addr)
# define netdev_ipv6_removemcastmac(dev,addr)
#endif
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -913,7 +913,11 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
{ {
FAR struct lifreq *lreq = (FAR struct lifreq *)req; FAR struct lifreq *lreq = (FAR struct lifreq *)req;
idx = MIN(idx, CONFIG_NETDEV_MAX_IPv6_ADDR - 1); idx = MIN(idx, CONFIG_NETDEV_MAX_IPv6_ADDR - 1);
netdev_ipv6_removemcastmac(dev, dev->d_ipv6[idx].addr);
ioctl_set_ipv6addr(dev->d_ipv6[idx].addr, &lreq->lifr_addr); ioctl_set_ipv6addr(dev->d_ipv6[idx].addr, &lreq->lifr_addr);
netdev_ipv6_addmcastmac(dev, dev->d_ipv6[idx].addr);
netlink_device_notify_ipaddr(dev, RTM_NEWADDR, AF_INET6, netlink_device_notify_ipaddr(dev, RTM_NEWADDR, AF_INET6,
dev->d_ipv6[idx].addr, net_ipv6_mask2pref(dev->d_ipv6[idx].mask)); dev->d_ipv6[idx].addr, net_ipv6_mask2pref(dev->d_ipv6[idx].mask));
} }

View File

@ -31,6 +31,7 @@
#include <nuttx/net/netdev.h> #include <nuttx/net/netdev.h>
#include "inet/inet.h" #include "inet/inet.h"
#include "netdev/netdev.h"
#include "utils/utils.h" #include "utils/utils.h"
/**************************************************************************** /****************************************************************************
@ -50,6 +51,41 @@
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: netdev_ipv6_mcastmac
*
* Description:
* Given an IPv6 address (in network order), create a IPv6 multicast MAC
* address for ICMPv6 Neighbor Solicitation message.
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
static void netdev_ipv6_mcastmac(const net_ipv6addr_t addr, FAR uint8_t *mac)
{
FAR const uint8_t *ipaddr8 = (FAR const uint8_t *)addr;
/* For ICMPv6, we need to add the IPv6 multicast address
*
* For IPv6 multicast addresses, the Ethernet MAC is derived by
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
* to the Ethernet MAC address 33:33:00:01:00:03.
*
* NOTES: This appears correct for the ICMPv6 Router Solicitation
* Message, but the ICMPv6 Neighbor Solicitation message seems to
* use 33:33:ff:01:00:03.
*/
mac[0] = 0x33;
mac[1] = 0x33;
mac[2] = 0xff;
mac[3] = ipaddr8[13]; /* Bits: 104-111 */
mac[4] = ipaddr8[14]; /* Bits: 112-119 */
mac[5] = ipaddr8[15]; /* Bits: 120-127 */
}
#endif
/**************************************************************************** /****************************************************************************
* Name: netdev_ipv6_get_scope * Name: netdev_ipv6_get_scope
****************************************************************************/ ****************************************************************************/
@ -176,6 +212,8 @@ int netdev_ipv6_add(FAR struct net_driver_s *dev, const net_ipv6addr_t addr,
net_ipv6addr_copy(ifaddr->addr, addr); net_ipv6addr_copy(ifaddr->addr, addr);
net_ipv6_pref2mask(ifaddr->mask, preflen); net_ipv6_pref2mask(ifaddr->mask, preflen);
netdev_ipv6_addmcastmac(dev, addr);
return OK; return OK;
} }
@ -213,9 +251,105 @@ int netdev_ipv6_del(FAR struct net_driver_s *dev, const net_ipv6addr_t addr,
net_ipv6addr_copy(ifaddr->addr, g_ipv6_unspecaddr); net_ipv6addr_copy(ifaddr->addr, g_ipv6_unspecaddr);
net_ipv6addr_copy(ifaddr->mask, g_ipv6_unspecaddr); net_ipv6addr_copy(ifaddr->mask, g_ipv6_unspecaddr);
netdev_ipv6_removemcastmac(dev, addr);
return OK; return OK;
} }
/****************************************************************************
* Name: netdev_ipv6_addmcastmac/removemcastmac
*
* Description:
* Add / Remove an MAC address corresponds to the IPv6 address to / from
* the device's MAC filter table.
*
* Input Parameters:
* dev - The device driver structure to be modified
* addr - The IPv6 address whose related MAC will be added or removed
*
* Returned Value:
* None
*
* Assumptions:
* The caller has locked the network.
*
****************************************************************************/
#ifdef CONFIG_NET_ICMPv6
void netdev_ipv6_addmcastmac(FAR struct net_driver_s *dev,
const net_ipv6addr_t addr)
{
uint8_t mcastmac[ETHER_ADDR_LEN];
if (net_ipv6addr_cmp(addr, g_ipv6_unspecaddr))
{
return;
}
if (dev->d_addmac != NULL)
{
netdev_ipv6_mcastmac(addr, mcastmac);
ninfo("Add IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mcastmac[0], mcastmac[1], mcastmac[2],
mcastmac[3], mcastmac[4], mcastmac[5]);
dev->d_addmac(dev, mcastmac);
}
}
void netdev_ipv6_removemcastmac(FAR struct net_driver_s *dev,
const net_ipv6addr_t addr)
{
uint8_t mcastmac[ETHER_ADDR_LEN];
#ifdef CONFIG_NETDEV_MULTIPLE_IPv6
int i;
#endif
if (net_ipv6addr_cmp(addr, g_ipv6_unspecaddr))
{
return;
}
if (dev->d_rmmac != NULL)
{
netdev_ipv6_mcastmac(addr, mcastmac);
#ifdef CONFIG_NETDEV_MULTIPLE_IPv6
/* Avoid removing mac needed by other addresses. */
for (i = 0; i < CONFIG_NETDEV_MAX_IPv6_ADDR; i++)
{
FAR struct netdev_ifaddr6_s *current = &dev->d_ipv6[i];
uint8_t currentmac[ETHER_ADDR_LEN];
/* Skip empty address and target address */
if (net_ipv6addr_cmp(current->addr, g_ipv6_unspecaddr) ||
net_ipv6addr_cmp(current->addr, addr))
{
continue;
}
/* Generate multicast MAC for this address. */
netdev_ipv6_mcastmac(current->addr, currentmac);
/* We don't remove the MAC if any other IPv6 address needs it. */
if (memcmp(currentmac, mcastmac, ETHER_ADDR_LEN) == 0)
{
return;
}
}
#endif /* CONFIG_NETDEV_MULTIPLE_IPv6 */
ninfo("Remove IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
mcastmac[0], mcastmac[1], mcastmac[2],
mcastmac[3], mcastmac[4], mcastmac[5]);
dev->d_rmmac(dev, mcastmac);
}
}
#endif
/**************************************************************************** /****************************************************************************
* Name: netdev_ipv6_srcaddr/srcifaddr * Name: netdev_ipv6_srcaddr/srcifaddr
* *

View File

@ -40,6 +40,7 @@
#include <nuttx/net/can.h> #include <nuttx/net/can.h>
#include "utils/utils.h" #include "utils/utils.h"
#include "icmpv6/icmpv6.h"
#include "igmp/igmp.h" #include "igmp/igmp.h"
#include "mld/mld.h" #include "mld/mld.h"
#include "netdev/netdev.h" #include "netdev/netdev.h"
@ -475,6 +476,12 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
mld_devinit(dev); mld_devinit(dev);
#endif #endif
#ifdef NET_ICMPv6_HAVE_STACK
/* Configure the device for ICMPv6 support */
icmpv6_devinit(dev);
#endif
net_unlock(); net_unlock();
#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_DRIVERS_IEEE80211) #if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_DRIVERS_IEEE80211)

View File

@ -843,6 +843,7 @@ static int macnet_addmac(FAR struct net_driver_s *dev,
* Not used with IEEE 802.15.4 radios. * Not used with IEEE 802.15.4 radios.
*/ */
UNUSED(priv);
return -ENOSYS; return -ENOSYS;
} }
#endif #endif
@ -874,6 +875,7 @@ static int macnet_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
* Not used with IEEE 802.15.4 radios. * Not used with IEEE 802.15.4 radios.
*/ */
UNUSED(priv);
return -ENOSYS; return -ENOSYS;
} }
#endif #endif