buglwIP - A Lightweight TCP/IP stack - Bugs: bug #52154, Support for multiple network...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #52154: Support for multiple network interfaces of the same subnet on one host

Submitted by:  Jeffle Xu <jeffle>
Submitted on:  Tue 03 Oct 2017 02:01:22 AM UTC  
 
Category: UDPSeverity: 3 - Normal
Item Group: Feature RequestStatus: None
Privacy: PublicAssigned to: None
Open/Closed: OpenPlanned Release: None
lwIP version: 2.0.0

Tue 03 Oct 2017 02:01:22 AM UTC, original submission:

I posted one mail about the issue previously, and the replying says that currently lwIP doesn't support multiple netifs of the same subnet on one host. Once the situation occurred, the following code in udp_sendto_if() will return an error.

```c
/* check if UDP PCB local IP address is correct

  • this could be an old address if netif->ip_addr has changed */

if (!ip4_addr_cmp(ip_2_ip4(&(pcb->local_ip)), netif_ip4_addr(netif))) {
/* local_ip doesn't match, drop the packet */
return ERR_VAL;
}
```

My posted mail:

```
Before calling udp_sendto_if(), the stack will call ip_route(), which will find an egress netif based on source/destination ip address. In the assumption that we use IPv4 only and LWIP_HOOK_IP4_ROUTE_SRC not defined, ip_route() is degraded to ip4_route(), which finds the appropriate egress netif only based on destination address.

Besides, if we have 2 network interfaces on one host, which are netif1 with address 192.168.19.17 / netmask 255.255.255.0, and netif2 with address 192.168.19.18 / netmask 255.255.255.0, and now a udp pcb, which is bound to 192.168.19.18, wants to send a packet to 192.168.19.20. The ip_route() would searches the registered netif list linearly and if netif1 is prior to netif2, then netif1 would be selected as the egress netif, which would violates the following snippet from udp_sendto_if().

```c
/* check if UDP PCB local IP address is correct

  • this could be an old address if netif->ip_addr has changed */

if (!ip4_addr_cmp(ip_2_ip4(&(pcb->local_ip)), netif_ip4_addr(netif))) {
/* local_ip doesn't match, drop the packet */
return ERR_VAL;
}
```

I think it is valid to send the packet with source address 192.168.19.18 using netif1. However it will fail in
udp_sendto_if().

I?m confused about the logic and would appreciate it if someone could tell me that I?ve missed something.
```

The replying: http://lists.nongnu.org/archive/html/lwip-users/2017-10/msg00005.html

Jeffle Xu <jeffle>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jeffle (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item

    Back to the top


    Powered by Savane 3.1-cleanup1