mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-16 14:11:02 +00:00
fixed bug #35595: Impossible to send broadcast without a gateway (introduced when fixing bug# 33551)
This commit is contained in:
parent
5deeaa652a
commit
6486c4b1d7
@ -62,6 +62,10 @@ HISTORY
|
||||
|
||||
++ 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
|
||||
* ppp.c: fixed pbuf leak when PPP session is aborted through pppSigHUP()
|
||||
(bug #35541: PPP Memory Leak)
|
||||
|
@ -895,10 +895,31 @@ etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr)
|
||||
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
|
||||
a subnet broadcast. */
|
||||
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
|
||||
struct ip_hdr *iphdr = (struct ip_hdr*)((u8_t*)q->payload +
|
||||
sizeof(struct eth_hdr));
|
||||
@ -937,27 +958,6 @@ etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr)
|
||||
}
|
||||
#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
|
||||
throughput and etharp_find_entry() is kind of slow */
|
||||
for (i = 0; i < ARP_TABLE_SIZE; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user