|
From: | Jonathan Ross |
Subject: | [lwip-users] Multicast Example? |
Date: | Wed, 16 Dec 2009 16:25:25 -0500 |
I'm using lwip 1.3.0 and I'm using it in raw mode (as provided in Xilinx EDK 11.1/11.4 - I had to change a .tcl script though to include igmp.c). Using the code below I can see an IGMP join message exit my device and enter the switch its plugged into, but the router in charge of IGMP does not subsequently list my device/interface as being subscribed to the multicast group 239.253.1.1. The IGMP join message it sends out also has a lot of trailing zeros that I don't see when I issue a similar IGMP join from my workstation (OS X 10.6), and also unlike my workstation and other desktops at work, lwIP sends out a single IGMP join, and all other device send 2 or 3 (any idea why?). Also, whenever the IGMP Membership Query message is sent out, my device does not re-issue a join to 239.253.1.1. Did I do something wrong? Below is the code. int main() { struct netif *netif, server_netif; struct ip_addr ipaddr, netmask, gw, ipgroup; unsigned char mac_ethernet_address[] = { /* REDACTED */ }; err_t igmp_result; netif = &server_netif; init_platform(); /* initliaze IP addresses to be used */ IP4_ADDR( &ipaddr, 10, 10, 12, 58 ); IP4_ADDR( &gw, 10, 10, 12, 254 ); IP4_ADDR( &netmask, 255, 255, 255, 0 ); IP4_ADDR( &ipgroup, 239, 253, 1, 1 ); print_ip_settings(&ipaddr, &netmask, &gw); lwip_init(); netif->flags |= NETIF_FLAG_IGMP; // This has no effect as netif->flags is zeroed by netif_add when called in xemac_add... // but netif has conditional statements based on the value... so I'm confused. /* Add network interface to the netif_list, and set it as default */ if (!xemac_add(netif, &ipaddr, &netmask, &gw, mac_ethernet_address, PLATFORM_EMAC_BASEADDR)) { xil_printf("Error adding N/W interface\n\r"); return -1; } netif_set_default(netif); /* now enable interrupts */ platform_enable_interrupts(); /* specify that the network if is up */ netif_set_up( netif ); /* start the application (web server, rxtest, txtest, etc..) */ udp_echo_init(); netif->flags |= NETIF_FLAG_IGMP; igmp_result = igmp_start( netif ); igmp_result = igmp_joingroup( &ipaddr, &ipgroup ); /* receive and process packets */ while (1) { xemacif_input(netif); //transfer_data(); } /* never reached */ cleanup_platform(); return 0; } Also, xemac_add calls netif_add, and within which there is the following code: netif->flags = 0; // ... #if LWIP_IGMP /* start IGMP processing */ if (netif->flags & NETIF_FLAG_IGMP) { igmp_start( netif); } #endif /* LWIP_IGMP */ How does igmp_start ever get called? I don't see any code in the file (where I write //... above) that could reset the flag to include NETIF_FLAG_IGMP. Thanks! Jonathan |
[Prev in Thread] | Current Thread | [Next in Thread] |