mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-18 20:10:53 +00:00
fixed bug #35595: Impossible to send broadcast without a gateway (introduced when fixing bug# 33551)
This commit is contained in:
parent
fc7da615fb
commit
7f81c62bf0
@ -76,6 +76,10 @@ HISTORY
|
|||||||
|
|
||||||
++ Bugfixes:
|
++ Bugfixes:
|
||||||
|
|
||||||
|
2012-02-23: Simon Goldschmidt
|
||||||
|
* etharp.c: fixed bug #35595: Impossible to send broadcast without a gateway
|
||||||
|
(introduced when fixing bug# 33551)
|
||||||
|
|
||||||
2012-02-16: Simon Goldschmidt
|
2012-02-16: Simon Goldschmidt
|
||||||
* ppp.c: fixed pbuf leak when PPP session is aborted through pppSigHUP()
|
* ppp.c: fixed pbuf leak when PPP session is aborted through pppSigHUP()
|
||||||
(bug #35541: PPP Memory Leak)
|
(bug #35541: PPP Memory Leak)
|
||||||
|
@ -896,10 +896,31 @@ etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr)
|
|||||||
return ERR_BUF;
|
return ERR_BUF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Determine on destination hardware address. Broadcasts and multicasts
|
||||||
|
* are special, other IP addresses are looked up in the ARP table. */
|
||||||
|
|
||||||
|
/* broadcast destination IP address? */
|
||||||
|
if (ip_addr_isbroadcast(ipaddr, netif)) {
|
||||||
|
/* broadcast on Ethernet also */
|
||||||
|
dest = (struct eth_addr *)ðbroadcast;
|
||||||
|
/* multicast destination IP address? */
|
||||||
|
} else if (ip_addr_ismulticast(ipaddr)) {
|
||||||
|
/* Hash IP multicast address to MAC address.*/
|
||||||
|
mcastaddr.addr[0] = LL_MULTICAST_ADDR_0;
|
||||||
|
mcastaddr.addr[1] = LL_MULTICAST_ADDR_1;
|
||||||
|
mcastaddr.addr[2] = LL_MULTICAST_ADDR_2;
|
||||||
|
mcastaddr.addr[3] = ip4_addr2(ipaddr) & 0x7f;
|
||||||
|
mcastaddr.addr[4] = ip4_addr3(ipaddr);
|
||||||
|
mcastaddr.addr[5] = ip4_addr4(ipaddr);
|
||||||
|
/* destination Ethernet address is multicast */
|
||||||
|
dest = &mcastaddr;
|
||||||
|
/* unicast destination IP address? */
|
||||||
|
} else {
|
||||||
|
s8_t i;
|
||||||
/* outside local network? if so, this can neither be a global broadcast nor
|
/* outside local network? if so, this can neither be a global broadcast nor
|
||||||
a subnet broadcast. */
|
a subnet broadcast. */
|
||||||
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_ismulticast(ipaddr)) {
|
!ip_addr_islinklocal(ipaddr)) {
|
||||||
#if LWIP_AUTOIP
|
#if LWIP_AUTOIP
|
||||||
struct ip_hdr *iphdr = (struct ip_hdr*)((u8_t*)q->payload +
|
struct ip_hdr *iphdr = (struct ip_hdr*)((u8_t*)q->payload +
|
||||||
sizeof(struct eth_hdr));
|
sizeof(struct eth_hdr));
|
||||||
@ -938,27 +959,6 @@ etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr)
|
|||||||
}
|
}
|
||||||
#endif /* LWIP_NETIF_HWADDRHINT */
|
#endif /* LWIP_NETIF_HWADDRHINT */
|
||||||
|
|
||||||
/* Determine on destination hardware address. Broadcasts and multicasts
|
|
||||||
* are special, other IP addresses are looked up in the ARP table. */
|
|
||||||
|
|
||||||
/* broadcast destination IP address? */
|
|
||||||
if (ip_addr_isbroadcast(ipaddr, netif)) {
|
|
||||||
/* broadcast on Ethernet also */
|
|
||||||
dest = (struct eth_addr *)ðbroadcast;
|
|
||||||
/* multicast destination IP address? */
|
|
||||||
} else if (ip_addr_ismulticast(ipaddr)) {
|
|
||||||
/* Hash IP multicast address to MAC address.*/
|
|
||||||
mcastaddr.addr[0] = LL_MULTICAST_ADDR_0;
|
|
||||||
mcastaddr.addr[1] = LL_MULTICAST_ADDR_1;
|
|
||||||
mcastaddr.addr[2] = LL_MULTICAST_ADDR_2;
|
|
||||||
mcastaddr.addr[3] = ip4_addr2(ipaddr) & 0x7f;
|
|
||||||
mcastaddr.addr[4] = ip4_addr3(ipaddr);
|
|
||||||
mcastaddr.addr[5] = ip4_addr4(ipaddr);
|
|
||||||
/* destination Ethernet address is multicast */
|
|
||||||
dest = &mcastaddr;
|
|
||||||
/* unicast destination IP address? */
|
|
||||||
} else {
|
|
||||||
s8_t i;
|
|
||||||
/* find stable entry: do this here since this is a critical path for
|
/* find stable entry: do this here since this is a critical path for
|
||||||
throughput and etharp_find_entry() is kind of slow */
|
throughput and etharp_find_entry() is kind of slow */
|
||||||
for (i = 0; i < ARP_TABLE_SIZE; i++) {
|
for (i = 0; i < ARP_TABLE_SIZE; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user