Fixed bug #31722: IP packets sent with an AutoIP source addr must be sent link-local

This commit is contained in:
goldsimon 2010-11-22 19:55:05 +00:00
parent b49cf5e7a2
commit f7627929d5
2 changed files with 23 additions and 8 deletions

View File

@ -233,6 +233,10 @@ HISTORY
++ Bugfixes: ++ Bugfixes:
2010-11-20: Simon Goldschmidt
* etharp.c: Fixed bug #31722: IP packets sent with an AutoIP source addr
must be sent link-local
2010-11-20: Simon Goldschmidt 2010-11-20: Simon Goldschmidt
* timers.c: patch #7329: tcp_timer_needed prototype was ifdef'ed out for * timers.c: patch #7329: tcp_timer_needed prototype was ifdef'ed out for
LWIP_TIMERS==0 LWIP_TIMERS==0

View File

@ -871,6 +871,16 @@ etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr)
/* outside local network? */ /* outside local network? */
if (!ip_addr_netcmp(ipaddr, &(netif->ip_addr), &(netif->netmask)) && if (!ip_addr_netcmp(ipaddr, &(netif->ip_addr), &(netif->netmask)) &&
!ip_addr_islinklocal(ipaddr)) { !ip_addr_islinklocal(ipaddr)) {
#if LWIP_AUTOIP
struct ip_hdr *iphdr = (struct ip_hdr*)((u8_t*)q->payload +
sizeof(struct eth_hdr));
/* According to RFC 3297, chapter 2.6.2 (Forwarding Rules), a packet with
a link-local source address must always be "directly to its destination
on the same physical link. The host MUST NOT send the packet to any
router for forwarding". */
if (!ip_addr_islinklocal(&iphdr->src))
#endif /* LWIP_AUTOIP */
{
/* interface has default gateway? */ /* interface has default gateway? */
if (!ip_addr_isany(&netif->gw)) { if (!ip_addr_isany(&netif->gw)) {
/* send to hardware address of default gateway IP address */ /* send to hardware address of default gateway IP address */
@ -881,6 +891,7 @@ etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr)
return ERR_RTE; return ERR_RTE;
} }
} }
}
#if LWIP_NETIF_HWADDRHINT #if LWIP_NETIF_HWADDRHINT
if (netif->addr_hint != NULL) { if (netif->addr_hint != NULL) {
/* per-pcb cached entry was given */ /* per-pcb cached entry was given */