mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-11 10:13:48 +00:00
Fix bug #47641: lwIP would accept IPv6 source addresses from the network that are mapped IPv4 adresses
This commit is contained in:
parent
30e6f908ee
commit
2e05856f90
@ -444,6 +444,14 @@ ip6_input(struct pbuf *p, struct netif *inp)
|
||||
ip_addr_copy_from_ip6(ip_data.current_iphdr_dest, ip6hdr->dest);
|
||||
ip_addr_copy_from_ip6(ip_data.current_iphdr_src, ip6hdr->src);
|
||||
|
||||
/* Don't accept virtual IPv6 mapped IPv4 addresses */
|
||||
if(ip6_addr_isipv6mappedipv4(ip_2_ip6(&ip_data.current_iphdr_dest)) ||
|
||||
ip6_addr_isipv6mappedipv4(ip_2_ip6(&ip_data.current_iphdr_src)) ) {
|
||||
IP6_STATS_INC(ip6.err);
|
||||
IP6_STATS_INC(ip6.drop);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/* current header pointer. */
|
||||
ip_data.current_ip6_header = ip6hdr;
|
||||
|
||||
|
@ -179,6 +179,8 @@ Little-endian version, stored in network order (no htonl). */
|
||||
|
||||
#define ip6_addr_isuniquelocal(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xfe000000UL)) == PP_HTONL(0xfc000000UL))
|
||||
|
||||
#define ip6_addr_isipv6mappedipv4(ip6addr) (((ip6addr)->addr[0] == 0) && ((ip6addr)->addr[1] == 0) && (((ip6addr)->addr[2]) == PP_HTONL(0x0000FFFFUL)))
|
||||
|
||||
#define ip6_addr_ismulticast(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xff000000UL)) == PP_HTONL(0xff000000UL))
|
||||
#define ip6_addr_multicast_transient_flag(ip6addr) ((ip6addr)->addr[0] & PP_HTONL(0x00100000UL))
|
||||
#define ip6_addr_multicast_prefix_flag(ip6addr) ((ip6addr)->addr[0] & PP_HTONL(0x00200000UL))
|
||||
|
Loading…
x
Reference in New Issue
Block a user