'mdns-sd-server' and 'MG_ENABLE_TCPIP=1' #3495
Replies: 4 comments 6 replies
|
Hi Gisle, please review the TAP example and let me know. That pointer is set at driver initialization and we don't have an automated test for the pcap example. I'm the one who's more likely to test that stuff and I don't use Windows, it is possible that I forgot to incorporate some changes into the pcap example. WRT MG_ENABLE_MDNS: yes, you're right, that has been deprecated long ago but somehow it stayed there. I'll get it removed. Thank you ! |
|
@gvanem I don't see anything has to be added. mg_tcpip_init(&mgr, &mif);
MG_INFO(("Init done, starting main loop"));
// Desired name must NOT have any dots in it, nor a domain
if (mg_mdns_listen(&mgr, fn, "Mongoose") // Start mDNS server
== NULL) exit(1);
while (s_signo == 0) mg_mgr_poll(&mgr, 100); // Infinite event loopThat struct is filled at the driver initialization and that happens after calling that function (except when you enable auto driver init, in which case it happens within mg_init() itself, thing these examples don't do) |
So I added this for my case: #if defined(MG_ENABLE_TCPIP_DRIVER_INIT)
extern struct mg_tcpip_if mg_pcap_mif;
extern void *mg_pcap_init (void);
#define MG_TCPIP_DRIVER_INIT(mgr) do { $\\
mg_pcap_mif.driver_data = mg_pcap_init(); $\\
mg_tcpip_init (mgr, &mg_pcap_mif); $\\
} while (0)
#endifThe added This seems to work fine. No crash at least. |
So I added this for my case: #if defined(MG_ENABLE_TCPIP_DRIVER_INIT)
extern struct mg_tcpip_if mg_pcap_mif;
extern void *mg_pcap_init (void);
#define MG_TCPIP_DRIVER_INIT(mgr) do { $\\
mg_pcap_mif.driver_data = mg_pcap_init(); $\\
mg_tcpip_init (mgr, &mg_pcap_mif); $\\
} while (0)
#endifThe added This seems to work fine. No crash at least: |
Uh oh!
There was an error while loading. Please reload this page.
I'm having troubles with running
mdns-sd-server.exeunder Windows with the built-in TCP/IP-stack.I.e.
MG_ENABLE_TCPIP=1.The program crashes with a NULL-ptr reference on
c->mgr->ifp. Here:How and where should
c->mgr->ifpbe set?I would assume this sample should have some extra code like in
tutorials/tcpip/pcap-driver/main.c.But obviously not.
BTW. the
tutorials/udp/mdns-sd-server/Makefilementions-DMG_ENABLE_MDNS=1which seems no-where.All reactions