Hello, I am trying to support multiple ips in my embedded application. I have followed what I found out and enabled LWIP_ARP_FILTER_NETIF and implemented LWIP_ARP_FILTER_NETIF_FN as documented. I also want it to work along VLAN.
Here is my function hook for LWIP_ARP_FILTER_NETIF_FN: struct netif* find_netif_based_on_dest_ip(struct pbuf *p, u16_t type, struct netif* source_netif){ ip4_addr_t dest; struct netif* netif; s16_t ip_hdr_offset = SIZEOF_ETH_HDR; #if ETHARP_SUPPORT_VLAN struct eth_hdr* ethhdr = (struct eth_hdr *)p->payload; if ( ethhdr->type == PP_HTONS(ETHTYPE_VLAN)) { ip_hdr_offset += SIZEOF_VLAN_HDR; } #endif //ETHARP_SUPPORT_VLAN void* temp_pbuf = (u8_t *)p->payload + ip_hdr_offset; if(type == PP_HTONS(ETHTYPE_ARP)){ struct etharp_hdr *ethhdr = (struct etharp_hdr *)temp_pbuf; IPADDR2_COPY(&dest, ðhdr->dipaddr); } else if(type == PP_HTONS(ETHTYPE_IP)){ struct ip_hdr *iphdr = (struct ip_hdr *)temp_pbuf; ip_addr_copy_from_ip4(dest, iphdr->dest); } else { return source_netif; } for (netif = netif_list; netif != NULL; netif = netif->next) { if (netif_is_up(netif) && netif_is_link_up(netif) && !ip4_addr_isany_val(*netif_ip4_addr(netif))) { u8_t for_us = (u8_t)ip4_addr_cmp(&dest, netif_ip4_addr(netif)); if(for_us){ break; } } } return netif == NULL ? source_netif : netif; } (pastebin link if you want to read it like a normal person: https://pastebin.com/GdzBJYv2). Have I missed anything? It seems to work on my minimal setup, but before we start developing our application I thought a quick check with you might help. Sorry if that is not the right communication method to ask, if not where one might ask? Thank you! Dor
_______________________________________________ lwip-users mailing list lwip-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/lwip-users