From 5aeb15469a22b744eb42fdfd4375030cf331f8ce Mon Sep 17 00:00:00 2001 From: Zhe Weng Date: Wed, 13 Dec 2023 12:39:43 +0800 Subject: [PATCH] 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 --- arch/arm/src/at32/at32_eth.c | 82 ----------- arch/arm/src/imx6/imx_enet.c | 2 +- arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c | 82 ----------- arch/arm/src/lpc43xx/lpc43_ethernet.c | 82 ----------- arch/arm/src/sam34/sam_emac.c | 82 ----------- arch/arm/src/sama5/sam_emaca.c | 82 ----------- arch/arm/src/sama5/sam_emacb.c | 82 ----------- arch/arm/src/sama5/sam_gmac.c | 82 ----------- arch/arm/src/samd5e5/sam_gmac.c | 82 ----------- arch/arm/src/samv7/sam_emac.c | 82 ----------- arch/arm/src/stm32/stm32_eth.c | 82 ----------- arch/arm/src/stm32f7/stm32_ethernet.c | 82 ----------- arch/arm/src/stm32h7/stm32_ethernet.c | 82 ----------- arch/arm/src/tiva/tm4c/tm4c_ethernet.c | 82 ----------- arch/misoc/src/common/misoc_net.c | 86 ----------- arch/risc-v/src/bl602/bl602_netdev.c | 86 ----------- arch/risc-v/src/esp32c3/esp32c3_wlan.c | 81 ----------- arch/risc-v/src/mpfs/mpfs_ethernet.c | 9 -- arch/xtensa/src/esp32/esp32_wlan.c | 81 ----------- arch/xtensa/src/esp32s3/esp32s3_wlan.c | 81 ----------- drivers/net/ftmac100.c | 82 ----------- drivers/net/lan91c111.c | 79 ----------- drivers/net/rpmsgdrv.c | 80 ----------- drivers/net/skeleton.c | 83 ----------- drivers/net/w5500.c | 83 +---------- drivers/usbdev/cdcecm.c | 85 ----------- .../wireless/ieee80211/bcm43xxx/bcmf_netdev.c | 85 +---------- net/icmpv6/CMakeLists.txt | 2 +- net/icmpv6/Kconfig | 1 + net/icmpv6/Make.defs | 2 +- net/icmpv6/icmpv6.h | 20 +++ net/icmpv6/icmpv6_initialize.c | 86 +++++++++++ net/netdev/netdev.h | 29 ++++ net/netdev/netdev_ioctl.c | 4 + net/netdev/netdev_ipv6.c | 134 ++++++++++++++++++ net/netdev/netdev_register.c | 7 + wireless/ieee802154/mac802154_netdev.c | 2 + 37 files changed, 290 insertions(+), 2066 deletions(-) create mode 100644 net/icmpv6/icmpv6_initialize.c diff --git a/arch/arm/src/at32/at32_eth.c b/arch/arm/src/at32/at32_eth.c index b371537a5a017..0ae6da4d8d838 100644 --- a/arch/arm/src/at32/at32_eth.c +++ b/arch/arm/src/at32/at32_eth.c @@ -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_macconfig(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_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); } -/**************************************************************************** - * 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 * @@ -3748,12 +3672,6 @@ static int at32_macenable(struct at32_ethmac_s *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 */ regval = at32_getreg(AT32_ETH_MACCR); diff --git a/arch/arm/src/imx6/imx_enet.c b/arch/arm/src/imx6/imx_enet.c index 10a49b3971ed4..d895c0e3d5e4b 100644 --- a/arch/arm/src/imx6/imx_enet.c +++ b/arch/arm/src/imx6/imx_enet.c @@ -1657,7 +1657,7 @@ static int imx_addmac(struct net_driver_s *dev, const uint8_t *mac) temp = imx_enet_getreg32(priv, registeraddress); temp |= 1 << hashindex; - imx_rt_enet_putreg32(priv, temp, registeraddress); + imx_enet_putreg32(priv, temp, registeraddress); return OK; } diff --git a/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c b/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c index 01e56802fbcee..871dc0c0fede5 100644 --- a/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c +++ b/arch/arm/src/lpc17xx_40xx/lpc17_40_ethernet.c @@ -366,9 +366,6 @@ static void lpc17_40_txtimeout_expiry(wdparm_t arg); /* 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_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 * @@ -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]; 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 */ lpc17_40_macmode(priv->lp_mode); diff --git a/arch/arm/src/lpc43xx/lpc43_ethernet.c b/arch/arm/src/lpc43xx/lpc43_ethernet.c index 6cc77709acca6..e24d12635f421 100644 --- a/arch/arm/src/lpc43xx/lpc43_ethernet.c +++ b/arch/arm/src/lpc43xx/lpc43_ethernet.c @@ -643,9 +643,6 @@ static inline void lpc43_ethgpioconfig(struct lpc43_ethmac_s *priv); static void lpc43_ethreset(struct lpc43_ethmac_s *priv); static int lpc43_macconfig(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_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); } -/**************************************************************************** - * 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 * @@ -3514,12 +3438,6 @@ static int lpc43_macenable(struct lpc43_ethmac_s *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 */ regval = lpc43_getreg(LPC43_ETH_MACCR); diff --git a/arch/arm/src/sam34/sam_emac.c b/arch/arm/src/sam34/sam_emac.c index a2b82704dc39c..d957e078f43c5 100644 --- a/arch/arm/src/sam34/sam_emac.c +++ b/arch/arm/src/sam34/sam_emac.c @@ -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_emac_reset(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); /**************************************************************************** @@ -1690,12 +1687,6 @@ static int sam_ifup(struct net_driver_s *dev) sam_macaddress(priv); -#ifdef CONFIG_NET_ICMPv6 - /* Set up IPv6 multicast address filtering */ - - sam_ipv6multicast(priv); -#endif - /* Initialize for PHY access */ ret = sam_phyinit(priv); @@ -3309,79 +3300,6 @@ static void sam_macaddress(struct sam_emac_s *priv) 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 * diff --git a/arch/arm/src/sama5/sam_emaca.c b/arch/arm/src/sama5/sam_emaca.c index 726d768d5c25c..e5fb8c1454feb 100644 --- a/arch/arm/src/sama5/sam_emaca.c +++ b/arch/arm/src/sama5/sam_emaca.c @@ -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_emac_reset(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); /**************************************************************************** @@ -1751,12 +1748,6 @@ static int sam_ifup(struct net_driver_s *dev) sam_macaddress(priv); -#ifdef CONFIG_NET_ICMPv6 - /* Set up IPv6 multicast address filtering */ - - sam_ipv6multicast(priv); -#endif - /* Initialize for PHY access */ ret = sam_phyinit(priv); @@ -3373,79 +3364,6 @@ static void sam_macaddress(struct sam_emac_s *priv) 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 * diff --git a/arch/arm/src/sama5/sam_emacb.c b/arch/arm/src/sama5/sam_emacb.c index 6f07a3e1e7b37..a4c94e13f35b5 100644 --- a/arch/arm/src/sama5/sam_emacb.c +++ b/arch/arm/src/sama5/sam_emacb.c @@ -517,9 +517,6 @@ static void sam_emac_disableclk(struct sam_emac_s *priv); #endif static void sam_emac_reset(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); /**************************************************************************** @@ -2096,12 +2093,6 @@ static int sam_ifup(struct net_driver_s *dev) sam_macaddress(priv); -#ifdef CONFIG_NET_ICMPv6 - /* Set up IPv6 multicast address filtering */ - - sam_ipv6multicast(priv); -#endif - /* Initialize for PHY access */ 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); } -/**************************************************************************** - * 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 * diff --git a/arch/arm/src/sama5/sam_gmac.c b/arch/arm/src/sama5/sam_gmac.c index 1c5b252c134f1..81b99548358da 100644 --- a/arch/arm/src/sama5/sam_gmac.c +++ b/arch/arm/src/sama5/sam_gmac.c @@ -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_gmac_reset(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); /**************************************************************************** @@ -1735,12 +1732,6 @@ static int sam_ifup(struct net_driver_s *dev) sam_macaddress(priv); -#ifdef CONFIG_NET_ICMPv6 - /* Set up IPv6 multicast address filtering */ - - sam_ipv6multicast(priv); -#endif - /* Initialize for PHY access */ ret = sam_phyinit(priv); @@ -3453,79 +3444,6 @@ static void sam_macaddress(struct sam_gmac_s *priv) 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 * diff --git a/arch/arm/src/samd5e5/sam_gmac.c b/arch/arm/src/samd5e5/sam_gmac.c index a5ae82bcb5818..04123c46d6c06 100644 --- a/arch/arm/src/samd5e5/sam_gmac.c +++ b/arch/arm/src/samd5e5/sam_gmac.c @@ -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_gmac_reset(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); /**************************************************************************** @@ -1700,12 +1697,6 @@ static int sam_ifup(struct net_driver_s *dev) sam_macaddress(priv); -#ifdef CONFIG_NET_ICMPv6 - /* Set up IPv6 multicast address filtering */ - - sam_ipv6multicast(priv); -#endif - /* Initialize for PHY access */ ret = sam_phyinit(priv); @@ -3391,79 +3382,6 @@ static void sam_macaddress(struct sam_gmac_s *priv) 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 * diff --git a/arch/arm/src/samv7/sam_emac.c b/arch/arm/src/samv7/sam_emac.c index 74ddc64f2d9eb..52780e61f5f8d 100644 --- a/arch/arm/src/samv7/sam_emac.c +++ b/arch/arm/src/samv7/sam_emac.c @@ -617,9 +617,6 @@ static void sam_emac_disableclk(struct sam_emac_s *priv); #endif static void sam_emac_reset(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_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); -#ifdef CONFIG_NET_ICMPv6 - /* Set up IPv6 multicast address filtering */ - - sam_ipv6multicast(priv); -#endif - /* Initialize for PHY access */ 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); } -/**************************************************************************** - * 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 * diff --git a/arch/arm/src/stm32/stm32_eth.c b/arch/arm/src/stm32/stm32_eth.c index f6f2df8789d26..be74c61376963 100644 --- a/arch/arm/src/stm32/stm32_eth.c +++ b/arch/arm/src/stm32/stm32_eth.c @@ -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_macconfig(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_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); } -/**************************************************************************** - * 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 * @@ -4095,12 +4019,6 @@ static int stm32_macenable(struct stm32_ethmac_s *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 */ regval = stm32_getreg(STM32_ETH_MACCR); diff --git a/arch/arm/src/stm32f7/stm32_ethernet.c b/arch/arm/src/stm32f7/stm32_ethernet.c index 28c80a43ef867..9771561a20d9d 100644 --- a/arch/arm/src/stm32f7/stm32_ethernet.c +++ b/arch/arm/src/stm32f7/stm32_ethernet.c @@ -770,9 +770,6 @@ static inline void stm32_ethgpioconfig(struct stm32_ethmac_s *priv); static void stm32_ethreset(struct stm32_ethmac_s *priv); static int stm32_macconfig(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_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); } -/**************************************************************************** - * 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 * @@ -3828,12 +3752,6 @@ static int stm32_macenable(struct stm32_ethmac_s *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 */ regval = stm32_getreg(STM32_ETH_MACCR); diff --git a/arch/arm/src/stm32h7/stm32_ethernet.c b/arch/arm/src/stm32h7/stm32_ethernet.c index c2719303b488e..4815970a9f441 100644 --- a/arch/arm/src/stm32h7/stm32_ethernet.c +++ b/arch/arm/src/stm32h7/stm32_ethernet.c @@ -776,9 +776,6 @@ static inline void stm32_ethgpioconfig(struct stm32_ethmac_s *priv); static void stm32_ethreset(struct stm32_ethmac_s *priv); static int stm32_macconfig(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_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); } -/**************************************************************************** - * 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 * @@ -4055,12 +3979,6 @@ static int stm32_macenable(struct stm32_ethmac_s *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 */ regval = stm32_getreg(STM32_ETH_MACCR); diff --git a/arch/arm/src/tiva/tm4c/tm4c_ethernet.c b/arch/arm/src/tiva/tm4c/tm4c_ethernet.c index 6eb38dbba188f..86271ba231325 100644 --- a/arch/arm/src/tiva/tm4c/tm4c_ethernet.c +++ b/arch/arm/src/tiva/tm4c/tm4c_ethernet.c @@ -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 int tiva_macconfig(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 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); } -/**************************************************************************** - * 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 * @@ -3744,12 +3668,6 @@ static int tiva_macenable(struct tiva_ethmac_s *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 */ regval = tiva_getreg(TIVA_EMAC_CFG); diff --git a/arch/misoc/src/common/misoc_net.c b/arch/misoc/src/common/misoc_net.c index 7c00f3cba4bbd..98945b52f899f 100644 --- a/arch/misoc/src/common/misoc_net.c +++ b/arch/misoc/src/common/misoc_net.c @@ -160,9 +160,6 @@ static int misoc_net_addmac(struct net_driver_s *dev, static int misoc_net_rmmac(struct net_driver_s *dev, const uint8_t *mac); #endif -#ifdef CONFIG_NET_ICMPv6 -static void misoc_net_ipv6multicast(struct misoc_net_driver_s *priv); -#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 */ - /* 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(); priv->misoc_net_bifup = true; @@ -895,79 +882,6 @@ static int misoc_net_rmmac(struct net_driver_s *dev, } #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 ****************************************************************************/ diff --git a/arch/risc-v/src/bl602/bl602_netdev.c b/arch/risc-v/src/bl602/bl602_netdev.c index 7351f575b54d3..9ca67224ef730 100644 --- a/arch/risc-v/src/bl602/bl602_netdev.c +++ b/arch/risc-v/src/bl602/bl602_netdev.c @@ -267,9 +267,6 @@ static int bl602_net_addmac(struct net_driver_s *dev, static int bl602_net_rmmac(struct net_driver_s *dev, const uint8_t *mac); # endif -# ifdef CONFIG_NET_ICMPv6 -static void bl602_net_ipv6multicast(struct bl602_net_driver_s *priv); -# endif #endif #ifdef CONFIG_NETDEV_IOCTL @@ -796,12 +793,6 @@ static int bl602_net_ifup(struct net_driver_s *dev) dev->d_ipv6addr[7]); #endif -#ifdef CONFIG_NET_ICMPv6 - /* Set up IPv6 multicast address filtering */ - - bl602_net_ipv6multicast(priv); -#endif - return OK; } @@ -1024,83 +1015,6 @@ static int bl602_net_rmmac(struct net_driver_s *dev, } #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) { int i; diff --git a/arch/risc-v/src/esp32c3/esp32c3_wlan.c b/arch/risc-v/src/esp32c3/esp32c3_wlan.c index 22a28efba2448..ecd1603b806b1 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_wlan.c +++ b/arch/risc-v/src/esp32c3/esp32c3_wlan.c @@ -233,10 +233,6 @@ static int wlan_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif -#ifdef CONFIG_NET_ICMPv6 -static void wlan_ipv6multicast(struct wlan_priv_s *priv); -#endif - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -826,13 +822,6 @@ static int wlan_ifup(struct net_driver_s *dev) return ret; } -#ifdef CONFIG_NET_ICMPv6 - - /* Set up IPv6 multicast address filtering */ - - wlan_ipv6multicast(priv); -#endif - IOB_QINIT(&priv->rxb); IOB_QINIT(&priv->txb); @@ -1001,76 +990,6 @@ static int wlan_rmmac(struct net_driver_s *dev, const uint8_t *mac) } #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 * diff --git a/arch/risc-v/src/mpfs/mpfs_ethernet.c b/arch/risc-v/src/mpfs/mpfs_ethernet.c index 56aea17efe58a..382477fa9e60e 100644 --- a/arch/risc-v/src/mpfs/mpfs_ethernet.c +++ b/arch/risc-v/src/mpfs/mpfs_ethernet.c @@ -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_ethconfig(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); @@ -1526,12 +1523,6 @@ static int mpfs_ifup(struct net_driver_s *dev) mpfs_macaddress(priv); -#ifdef CONFIG_NET_ICMPv6 - /* Set up IPv6 multicast address filtering */ - - mpfs_ipv6multicast(priv); -#endif - /* Initialize for PHY access */ ret = mpfs_phyinit(priv); diff --git a/arch/xtensa/src/esp32/esp32_wlan.c b/arch/xtensa/src/esp32/esp32_wlan.c index 44b26fc3b6b16..f66a429aec9b3 100644 --- a/arch/xtensa/src/esp32/esp32_wlan.c +++ b/arch/xtensa/src/esp32/esp32_wlan.c @@ -287,10 +287,6 @@ static int wlan_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #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_txframe(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; } -#ifdef CONFIG_NET_ICMPv6 - - /* Set up IPv6 multicast address filtering */ - - wlan_ipv6multicast(priv); -#endif - wlan_init_buffer(priv); ret = priv->ops->start(); if (ret < 0) @@ -1340,76 +1329,6 @@ static int wlan_rmmac(struct net_driver_s *dev, const uint8_t *mac) } #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 * diff --git a/arch/xtensa/src/esp32s3/esp32s3_wlan.c b/arch/xtensa/src/esp32s3/esp32s3_wlan.c index 919953b572657..5ea27357387bd 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_wlan.c +++ b/arch/xtensa/src/esp32s3/esp32s3_wlan.c @@ -237,10 +237,6 @@ static int wlan_ioctl(struct net_driver_s *dev, int cmd, unsigned long arg); #endif -#ifdef CONFIG_NET_ICMPv6 -static void wlan_ipv6multicast(struct wlan_priv_s *priv); -#endif - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -819,13 +815,6 @@ static int wlan_ifup(struct net_driver_s *dev) return ret; } -#ifdef CONFIG_NET_ICMPv6 - - /* Set up IPv6 multicast address filtering */ - - wlan_ipv6multicast(priv); -#endif - IOB_QINIT(&priv->rxb); IOB_QINIT(&priv->txb); @@ -994,76 +983,6 @@ static int wlan_rmmac(struct net_driver_s *dev, const uint8_t *mac) } #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 * diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index 7ed1bbb19af6e..a00c781292e85 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -221,9 +221,6 @@ static int ftmac100_addmac(FAR struct net_driver_s *dev, static int ftmac100_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NET_ICMPv6 -static void ftmac100_ipv6multicast(FAR struct ftmac100_driver_s *priv); -#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); -#ifdef CONFIG_NET_ICMPv6 - /* Set up IPv6 multicast address filtering */ - - ftmac100_ipv6multicast(priv); -#endif - /* Enable the Ethernet interrupt */ priv->ft_bifup = true; @@ -1309,79 +1300,6 @@ static int ftmac100_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac) } #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 ****************************************************************************/ diff --git a/drivers/net/lan91c111.c b/drivers/net/lan91c111.c index 84672bc08161b..293c22e140127 100644 --- a/drivers/net/lan91c111.c +++ b/drivers/net/lan91c111.c @@ -129,9 +129,6 @@ static int lan91c111_addmac(FAR struct net_driver_s *dev, static int lan91c111_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NET_ICMPv6 -static void lan91c111_ipv6multicast(FAR struct net_driver_s *dev); -#endif #endif #ifdef CONFIG_NETDEV_IOCTL 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)); -#ifdef CONFIG_NET_ICMPv6 - /* Set up IPv6 multicast address filtering */ - - lan91c111_ipv6multicast(dev); -#endif - net_unlock(); /* Enable the Ethernet interrupt */ @@ -1248,76 +1239,6 @@ static int lan91c111_rmmac(FAR struct net_driver_s *dev, } #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 * diff --git a/drivers/net/rpmsgdrv.c b/drivers/net/rpmsgdrv.c index 12a829be0ba1a..3f55c31584b21 100644 --- a/drivers/net/rpmsgdrv.c +++ b/drivers/net/rpmsgdrv.c @@ -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, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NET_ICMPv6 -static void net_rpmsg_drv_ipv6multicast(FAR struct net_driver_s *dev); -#endif #endif #ifdef CONFIG_NETDEV_IOCTL 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); #endif -#ifdef CONFIG_NET_ICMPv6 - /* Set up IPv6 multicast address filtering */ - - net_rpmsg_drv_ipv6multicast(dev); -#endif - net_unlock(); #ifdef CONFIG_NETDB_DNSCLIENT @@ -960,77 +951,6 @@ static int net_rpmsg_drv_rmmac(FAR struct net_driver_s *dev, } #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 * diff --git a/drivers/net/skeleton.c b/drivers/net/skeleton.c index 991a8425ab90b..c58439a11db77 100644 --- a/drivers/net/skeleton.c +++ b/drivers/net/skeleton.c @@ -174,9 +174,6 @@ static int skel_addmac(FAR struct net_driver_s *dev, static int skel_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NET_ICMPv6 -static void skel_ipv6multicast(FAR struct skel_driver_s *priv); -#endif #endif #ifdef CONFIG_NETDEV_IOCTL 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 */ - /* 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 */ priv->sk_bifup = true; @@ -849,78 +838,6 @@ static int skel_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac) } #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 * diff --git a/drivers/net/w5500.c b/drivers/net/w5500.c index 356675d240dd0..fe46992305513 100644 --- a/drivers/net/w5500.c +++ b/drivers/net/w5500.c @@ -433,9 +433,6 @@ static int w5500_addmac(FAR struct net_driver_s *dev, static int w5500_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NET_ICMPv6 -static void w5500_ipv6multicast(FAR struct w5500_driver_s *priv); -#endif #endif #ifdef CONFIG_NETDEV_IOCTL 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; } -#ifdef CONFIG_NET_ICMPv6 - /* Set up IPv6 multicast address filtering */ - - w5500_ipv6multicast(self); -#endif - /* Enable the Ethernet interrupt */ 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 */ + UNUSED(priv); return OK; } #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 */ + UNUSED(priv); return OK; } #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 * diff --git a/drivers/usbdev/cdcecm.c b/drivers/usbdev/cdcecm.c index da661f83a23a6..7faf8a501775b 100644 --- a/drivers/usbdev/cdcecm.c +++ b/drivers/usbdev/cdcecm.c @@ -175,9 +175,6 @@ static int cdcecm_addmac(FAR struct net_driver_s *dev, static int cdcecm_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NET_ICMPv6 -static void cdcecm_ipv6multicast(FAR struct cdcecm_driver_s *priv); -#endif #endif #ifdef CONFIG_NETDEV_IOCTL 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]); #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; return OK; } @@ -787,78 +774,6 @@ static int cdcecm_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac) } #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 * diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c index d9c066bc28c03..0c5dbe88b759f 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c @@ -123,9 +123,6 @@ static int bcmf_addmac(FAR struct net_driver_s *dev, static int bcmf_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac); #endif -#ifdef CONFIG_NET_ICMPv6 -static void bcmf_ipv6multicast(FAR struct bcmf_dev_s *priv); -#endif #endif #ifdef CONFIG_NETDEV_IOCTL 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); } - /* 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 */ 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 */ + UNUSED(priv); return OK; } #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 */ + UNUSED(priv); return OK; } #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 * diff --git a/net/icmpv6/CMakeLists.txt b/net/icmpv6/CMakeLists.txt index a871778c5c1f0..f256f4f6fbaec 100644 --- a/net/icmpv6/CMakeLists.txt +++ b/net/icmpv6/CMakeLists.txt @@ -22,7 +22,7 @@ if(CONFIG_NET_ICMPv6 AND NOT CONFIG_NET_ICMPv6_NO_STACK) # ICMPv6 source files 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) list( diff --git a/net/icmpv6/Kconfig b/net/icmpv6/Kconfig index 13a8bbbb15007..b9ac220d89bba 100644 --- a/net/icmpv6/Kconfig +++ b/net/icmpv6/Kconfig @@ -8,6 +8,7 @@ menu "ICMPv6 Networking Support" config NET_ICMPv6 bool "Enable ICMPv6 networking" default n + select NET_MCASTGROUP depends on NET ---help--- Enable minimal ICMPv6 support. Includes built-in support diff --git a/net/icmpv6/Make.defs b/net/icmpv6/Make.defs index 4f576ef6735fd..24f41feaa45fa 100644 --- a/net/icmpv6/Make.defs +++ b/net/icmpv6/Make.defs @@ -24,7 +24,7 @@ ifneq ($(CONFIG_NET_ICMPv6_NO_STACK),y) # ICMPv6 source files 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) SOCK_CSRCS += icmpv6_sockif.c icmpv6_conn.c icmpv6_sendmsg.c diff --git a/net/icmpv6/icmpv6.h b/net/icmpv6/icmpv6.h index f737b3993bd3b..98e52a17090f7 100644 --- a/net/icmpv6/icmpv6.h +++ b/net/icmpv6/icmpv6.h @@ -165,6 +165,26 @@ EXTERN const struct sock_intf_s g_icmpv6_sockif; * 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 * diff --git a/net/icmpv6/icmpv6_initialize.c b/net/icmpv6/icmpv6_initialize.c new file mode 100644 index 0000000000000..b49faee5072cf --- /dev/null +++ b/net/icmpv6/icmpv6_initialize.c @@ -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 + +#include + +#include +#include + +#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 */ +} diff --git a/net/netdev/netdev.h b/net/netdev/netdev.h index ba5e393a3c5b2..08bb7d000b74e 100644 --- a/net/netdev/netdev.h +++ b/net/netdev/netdev.h @@ -495,6 +495,35 @@ void netdown_notifier_teardown(int key); void netdown_notifier_signal(FAR struct net_driver_s *dev); #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 #ifdef __cplusplus } diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index 1b8e0cebe21d8..54538e79591c2 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -913,7 +913,11 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd, { FAR struct lifreq *lreq = (FAR struct lifreq *)req; 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); + netdev_ipv6_addmcastmac(dev, dev->d_ipv6[idx].addr); + netlink_device_notify_ipaddr(dev, RTM_NEWADDR, AF_INET6, dev->d_ipv6[idx].addr, net_ipv6_mask2pref(dev->d_ipv6[idx].mask)); } diff --git a/net/netdev/netdev_ipv6.c b/net/netdev/netdev_ipv6.c index bb548631e052c..9bf2c2121a608 100644 --- a/net/netdev/netdev_ipv6.c +++ b/net/netdev/netdev_ipv6.c @@ -31,6 +31,7 @@ #include #include "inet/inet.h" +#include "netdev/netdev.h" #include "utils/utils.h" /**************************************************************************** @@ -50,6 +51,41 @@ * 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 ****************************************************************************/ @@ -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_ipv6_pref2mask(ifaddr->mask, preflen); + netdev_ipv6_addmcastmac(dev, addr); + 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->mask, g_ipv6_unspecaddr); + netdev_ipv6_removemcastmac(dev, addr); + 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 * diff --git a/net/netdev/netdev_register.c b/net/netdev/netdev_register.c index 2f3c77b033b98..af3fa582b88de 100644 --- a/net/netdev/netdev_register.c +++ b/net/netdev/netdev_register.c @@ -40,6 +40,7 @@ #include #include "utils/utils.h" +#include "icmpv6/icmpv6.h" #include "igmp/igmp.h" #include "mld/mld.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); #endif +#ifdef NET_ICMPv6_HAVE_STACK + /* Configure the device for ICMPv6 support */ + + icmpv6_devinit(dev); +#endif + net_unlock(); #if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_DRIVERS_IEEE80211) diff --git a/wireless/ieee802154/mac802154_netdev.c b/wireless/ieee802154/mac802154_netdev.c index ec9984c6b5819..2a813b8692881 100644 --- a/wireless/ieee802154/mac802154_netdev.c +++ b/wireless/ieee802154/mac802154_netdev.c @@ -843,6 +843,7 @@ static int macnet_addmac(FAR struct net_driver_s *dev, * Not used with IEEE 802.15.4 radios. */ + UNUSED(priv); return -ENOSYS; } #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. */ + UNUSED(priv); return -ENOSYS; } #endif