diff -Nur lwip-2.2.0old/src/api/sockets.c lwip-2.2.0/src/api/sockets.c
--- lwip-2.2.0old/src/api/sockets.c	2024-05-07 11:16:33.896085084 +0800
+++ lwip-2.2.0/src/api/sockets.c	2024-05-07 11:27:00.444968722 +0800
@@ -3905,6 +3905,29 @@
               return ENOPROTOOPT;
             }
             break;
+        case MCAST_BLOCK_SOURCE:
+        case MCAST_UNBLOCK_SOURCE:
+          LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, optlen, struct group_source_req);
+          if ((((const struct group_source_req *)optval)->gsr_group.ss_family != AF_INET) ||
+              (((const struct group_source_req *)optval)->gsr_source.ss_family != AF_INET)) {
+             done_socket(sock);
+           return EINVAL;
+          }
+#if LWIP_UDP
+          if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_UDP) {
+            err = mcast_sock_block_unblock_source_group(&sock->conn->pcb.udp->ipmc, optname, (const struct group_source_req *)optval);
+          } else
+#endif /* LWIP_UDP */
+#if LWIP_RAW
+          if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_RAW) {
+            err = mcast_sock_block_unblock_source_group(&sock->conn->pcb.raw->ipmc, optname, (const struct group_source_req *)optval);
+          } else
+#endif /* LWIP_RAW */
+          {
+            done_socket(sock);
+            return ENOPROTOOPT;
+          }
+          break;
 #endif /* LWIP_IGMP */
         default:
           LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IP, UNIMPL: optname=0x%x, ..)\n",
