[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #52154] Support for multiple network interfaces of the
From: |
Jeffle Xu |
Subject: |
[lwip-devel] [bug #52154] Support for multiple network interfaces of the same subnet on one host |
Date: |
Mon, 2 Oct 2017 22:01:24 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/601.4.4 (KHTML, like Gecko) Version/9.0.3 Safari/601.4.4 |
URL:
<http://savannah.nongnu.org/bugs/?52154>
Summary: Support for multiple network interfaces of the same
subnet on one host
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: jeffle
Submitted on: 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
Discussion Lock: Any
Planned Release: None
lwIP version: 2.0.0
_______________________________________________________
Details:
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
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?52154>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-devel] [bug #52154] Support for multiple network interfaces of the same subnet on one host,
Jeffle Xu <=