mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-26 09:35:23 +00:00
Fix three bugs during tests.
This commit is contained in:
parent
29df95c514
commit
9dd10e46ab
@ -526,7 +526,7 @@ etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
|||||||
struct eth_addr *dest, *srcaddr, mcastaddr;
|
struct eth_addr *dest, *srcaddr, mcastaddr;
|
||||||
struct eth_hdr *ethhdr;
|
struct eth_hdr *ethhdr;
|
||||||
s8_t i;
|
s8_t i;
|
||||||
err_t result;
|
err_t result = ERR_OK;
|
||||||
|
|
||||||
/* make room for Ethernet header - should not fail*/
|
/* make room for Ethernet header - should not fail*/
|
||||||
if (pbuf_header(q, sizeof(struct eth_hdr)) != 0) {
|
if (pbuf_header(q, sizeof(struct eth_hdr)) != 0) {
|
||||||
@ -631,6 +631,7 @@ etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
|||||||
err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
||||||
{
|
{
|
||||||
struct pbuf *p;
|
struct pbuf *p;
|
||||||
|
struct eth_addr * srcaddr = (struct eth_addr *)netif->hwaddr;
|
||||||
err_t result = ERR_OK;
|
err_t result = ERR_OK;
|
||||||
s8_t i; /* ARP entry index */
|
s8_t i; /* ARP entry index */
|
||||||
u8_t k; /* Ethernet address octet index */
|
u8_t k; /* Ethernet address octet index */
|
||||||
@ -720,12 +721,11 @@ err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
|||||||
/* { i is either a (new or existing) PENDING or STABLE entry } */
|
/* { i is either a (new or existing) PENDING or STABLE entry } */
|
||||||
|
|
||||||
/* packet given? */
|
/* packet given? */
|
||||||
if (q != NULL)
|
if (q != NULL) {
|
||||||
/* stable entry? */
|
/* stable entry? */
|
||||||
if (arp_table[i].state == ETHARP_STATE_STABLE) {
|
if (arp_table[i].state == ETHARP_STATE_STABLE) {
|
||||||
/* we have a valid IP->Ethernet address mapping,
|
/* we have a valid IP->Ethernet address mapping,
|
||||||
* fill in the Ethernet header for the outgoing packet */
|
* fill in the Ethernet header for the outgoing packet */
|
||||||
struct eth_addr * srcaddr = (struct eth_addr *)netif->hwaddr;
|
|
||||||
struct eth_hdr *ethhdr = q->payload;
|
struct eth_hdr *ethhdr = q->payload;
|
||||||
for(k = 0; k < netif->hwaddr_len; k++) {
|
for(k = 0; k < netif->hwaddr_len; k++) {
|
||||||
ethhdr->dest.addr[k] = arp_table[i].ethaddr.addr[k];
|
ethhdr->dest.addr[k] = arp_table[i].ethaddr.addr[k];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user