From 47d628d22ee0b99680754a02e84ebf3e8f1fe15f Mon Sep 17 00:00:00 2001
From: chao an <anchao@xiaomi.com>
Date: Wed, 11 Jan 2023 19:44:41 +0800
Subject: [PATCH] net/mld: fix build break of mld router

Signed-off-by: chao an <anchao@xiaomi.com>
---
 net/mld/Kconfig      | 2 +-
 net/mld/mld_group.c  | 2 ++
 net/mld/mld_join.c   | 2 +-
 net/mld/mld_query.c  | 2 +-
 net/mld/mld_report.c | 2 +-
 net/mld/mld_send.c   | 2 +-
 6 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/mld/Kconfig b/net/mld/Kconfig
index 40ebda602c..f7512e1c32 100644
--- a/net/mld/Kconfig
+++ b/net/mld/Kconfig
@@ -16,7 +16,7 @@ menuconfig NET_MLD
 if NET_MLD
 
 config NET_MLD_ROUTER
-	bool # "MLD Router support"
+	bool "MLD Router support"
 	default n
 	---help---
 		Enables a few hooks that will be needed for router support in the
diff --git a/net/mld/mld_group.c b/net/mld/mld_group.c
index a8e3612afe..e3dbe13bd8 100644
--- a/net/mld/mld_group.c
+++ b/net/mld/mld_group.c
@@ -58,6 +58,7 @@
  *
  ****************************************************************************/
 
+#ifndef CONFIG_NET_MLD_ROUTER
 static int mld_ngroups(FAR struct net_driver_s *dev)
 {
   FAR struct mld_group_s *group;
@@ -79,6 +80,7 @@ static int mld_ngroups(FAR struct net_driver_s *dev)
 
   return ngroups > 0 ? ngroups - 1 : 0;
 }
+#endif
 
 /****************************************************************************
  * Public Functions
diff --git a/net/mld/mld_join.c b/net/mld/mld_join.c
index fd41d41690..4305261944 100644
--- a/net/mld/mld_join.c
+++ b/net/mld/mld_join.c
@@ -206,7 +206,7 @@ int mld_joingroup(FAR const struct ipv6_mreq *mrec)
        * perform the group startup operations.
        */
 
-      if (group->join == 0)
+      if (group->njoins == 0)
         {
           /* This is the for join from this host.  Perform out start up
            * operations.
diff --git a/net/mld/mld_query.c b/net/mld/mld_query.c
index 706e7c8795..fd144a4032 100644
--- a/net/mld/mld_query.c
+++ b/net/mld/mld_query.c
@@ -321,7 +321,7 @@ int mld_query(FAR struct net_driver_s *dev,
        * cycle
        */
 
-      mld_new_pollcycle(dev)
+      mld_new_pollcycle(dev);
 #endif
 
       /* Check MLDv1 compatibility mode */
diff --git a/net/mld/mld_report.c b/net/mld/mld_report.c
index e874987bd8..6e2d1b1580 100644
--- a/net/mld/mld_report.c
+++ b/net/mld/mld_report.c
@@ -65,7 +65,7 @@ int mld_report(FAR struct net_driver_s *dev,
 #ifdef CONFIG_NET_MLD_ROUTER
   /* Assure that the group address is an IPv6 multicast address */
 
-  if (!net_is_addr_mcast(mrec->ipv6mr_multiaddr.s6_addr16))
+  if (!net_is_addr_mcast(grpaddr))
     {
       return -EINVAL;
     }
diff --git a/net/mld/mld_send.c b/net/mld/mld_send.c
index 30de73e732..f3fab001d8 100644
--- a/net/mld/mld_send.c
+++ b/net/mld/mld_send.c
@@ -280,7 +280,7 @@ void mld_send(FAR struct net_driver_s *dev, FAR struct mld_group_s *group,
             {
               /* Update accumulated membership for all groups. */
 
-              mld_new_pollcycle(dev)
+              mld_new_pollcycle(dev);
             }
           else
             {