mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-26 12:14:56 +00:00
Fix lwIP builds
fixes #3119 lwIP does not export ip_mreq by default, it requires enabling support for IGMP by setting LWIP_IGMP, with the associated extra stuff. Mongoose will print an error if mg_multicast_add() is called with no multicast support in lwIP.
This commit is contained in:
1 parent
8ab514fabc
commit
f618fe125c
2 files changed
+8
No files matched your search
@@ -8394,11 +8394,15 @@ void mg_multicast_add(struct mg_connection *c, char *ip) {
|
||||
// TODO(): prvAllowIPPacketIPv4()
|
||||
#else
|
||||
// lwIP, Unix, Windows, Zephyr(, AzureRTOS ?)
|
||||
#if MG_ENABLE_LWIP && !LWIP_IGMP
|
||||
MG_ERROR(("LWIP_IGMP not defined, no multicast support"));
|
||||
#else
|
||||
struct ip_mreq mreq;
|
||||
mreq.imr_multiaddr.s_addr = inet_addr(ip);
|
||||
mreq.imr_interface.s_addr = mg_htonl(INADDR_ANY);
|
||||
setsockopt(FD(c), IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) &mreq, sizeof(mreq));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
bool mg_open_listener(struct mg_connection *c, const char *url) {
|
||||
|
||||
@@ -184,11 +184,15 @@ void mg_multicast_add(struct mg_connection *c, char *ip) {
|
||||
// TODO(): prvAllowIPPacketIPv4()
|
||||
#else
|
||||
// lwIP, Unix, Windows, Zephyr(, AzureRTOS ?)
|
||||
#if MG_ENABLE_LWIP && !LWIP_IGMP
|
||||
MG_ERROR(("LWIP_IGMP not defined, no multicast support"));
|
||||
#else
|
||||
struct ip_mreq mreq;
|
||||
mreq.imr_multiaddr.s_addr = inet_addr(ip);
|
||||
mreq.imr_interface.s_addr = mg_htonl(INADDR_ANY);
|
||||
setsockopt(FD(c), IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) &mreq, sizeof(mreq));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
bool mg_open_listener(struct mg_connection *c, const char *url) {
|
||||
|
||||
Reference in new issue
Block a user