[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #45829] ipX_to_ip() function does not work when just o
From: |
Erik Ekman |
Subject: |
[lwip-devel] [bug #45829] ipX_to_ip() function does not work when just one IP version supported |
Date: |
Wed, 26 Aug 2015 09:05:49 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0 |
URL:
<http://savannah.nongnu.org/bugs/?45829>
Summary: ipX_to_ip() function does not work when just one IP
version supported
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: yarrick
Submitted on: Wed 26 Aug 2015 09:05:48 AM GMT
Category: IPv4
Severity: 3 - Normal
Item Group: Faulty Behaviour
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release:
lwIP version: git head
_______________________________________________________
Details:
When both IP versions are supported, ip4_to_ip()/ip6_to_ip() converts the IP
version-specific first argument to an IP version-independent type given as the
second argument.
To work the same way when only one IP version is supported the first argument
needs to be copied to the second.
Consider the following code (choose destination address and pcb based on IP
version of incoming packet):
#if LWIP_IPV4
ip4_addr_t v4addr = ..;
#endif
#if LWIP_IPV6
ip6_addr_t v6addr = ..;
#endif
struct {
#if LWIP_IPV4
struct udp_pcb *v4pcb;
#endif
#if LWIP_IPV6
struct udp_pcb *v6pcb;
#endif
} data;
....
{
ip_addr_t tempaddr;
struct udp_pcb *pcb = NULL;
if (IP_IS_V6_VAL(source_addr)) {
#if LWIP_IPV6
ip6_2_ip(&v6addr, &tempaddr);
pcb = data.v6pcb;
#endif
} else {
#if LWIP_IPV4
ip4_2_ip(&v4addr, &tempaddr);
pcb = data.v4pcb;
#endif
}
udp_sendto_if(pcb, pbuf, &tempaddr, port, netif);
}
This code works when both IP versions are enabled but break if only one is,
since the ipX_to_ip() functions do different things.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Wed 26 Aug 2015 09:05:48 AM GMT Name:
0001-Make-ipX_to_ip-work-when-just-one-IP-version-support.patch Size: 2kB
By: yarrick
<http://savannah.nongnu.org/bugs/download.php?file_id=34733>
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?45829>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [lwip-devel] [bug #45829] ipX_to_ip() function does not work when just one IP version supported,
Erik Ekman <=