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

Submitter:  Jeffle Xu <jeffle>
Submitted:  Tue 03 Oct 2017 02:01:22 AM UTC
   
 
Category:  UDP Severity:  3 - Normal
Item Group:  Feature Request Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned 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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code