That's what I already tried. However if I netif_set_up the second
interface then the communication over the first interface doesn't
work anymore. I found out that the interfaces must have IP
addresses differing inside the network mask. That may be
obvious to you but I thought that's what the default is for. If
no interfaces match or more than one then use the default
instead of just the first found. Because I'd like to have both
interfaces in the same subnet even with differing IP addresses.
If there's no rule/standard on what to do in this case then I'd
change core/ipv4/ip.c like this (could use some more error
handling):
struct netif *
ip_route(ip_addr_t *dest)
{
struct netif *netif;
u8_t matches=0;
struct netif *firstmatch=NULL;
#ifdef LWIP_HOOK_IP4_ROUTE
netif = LWIP_HOOK_IP4_ROUTE(dest);
if (netif != NULL) {
return netif;
}
#endif
/* iterate through netifs */
for (netif = netif_list; netif != NULL; netif = netif->next) {
/* network mask matches? */
if (netif_is_up(netif)) {
if (ip_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask)))
{
/* return netif on which to forward IP packet */
/* return netif;*/
matches=matches+1;
if (firstmatch==NULL) {
firstmatch=netif;
}
}
}
}
/* only return netif if there's exactly one match, otherwise return
default */
if (matches==1) {
return firstmatch;
}
if ((netif_default == NULL) || (!netif_is_up(netif_default))) {
LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip_route: No
route to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
ip4_addr1_16(dest), ip4_addr2_16(dest), ip4_addr3_16(dest),
ip4_addr4_16(dest)));
IP_STATS_INC(ip.rterr);
snmp_inc_ipoutnoroutes();
return NULL;
}
/* no matching netif found, use default netif */
return netif_default;
}
Thanks
bye Fabi