mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-06-16 18:03:44 +08:00
Fixed tcp unit tests after introducing ip_addr_p_t and letting tcp_input check for broadcasts by using current_iphdr_dest.
This commit is contained in:
@@ -88,7 +88,8 @@ tcp_create_segment(ip_addr_t* src_ip, ip_addr_t* dst_ip,
|
||||
memcpy((char*)tcphdr + sizeof(struct tcp_hdr), data, data_len);
|
||||
|
||||
/* calculate checksum */
|
||||
tcphdr->chksum = inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest),
|
||||
|
||||
tcphdr->chksum = inet_chksum_pseudo(p, src_ip, dst_ip,
|
||||
IP_PROTO_TCP, p->tot_len);
|
||||
|
||||
pbuf_header(p, sizeof(struct ip_hdr));
|
||||
@@ -193,3 +194,20 @@ test_tcp_new_counters_pcb(struct test_tcp_counters* counters)
|
||||
}
|
||||
return pcb;
|
||||
}
|
||||
|
||||
/** Calls tcp_input() after adjusting current_iphdr_dest */
|
||||
void test_tcp_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
struct ip_hdr *iphdr = (struct ip_hdr*)p->payload;
|
||||
ip_addr_copy(current_iphdr_dest, iphdr->dest);
|
||||
ip_addr_copy(current_iphdr_src, iphdr->src);
|
||||
current_netif = inp;
|
||||
current_header = iphdr;
|
||||
|
||||
tcp_input(p, inp);
|
||||
|
||||
current_iphdr_dest.addr = 0;
|
||||
current_iphdr_src.addr = 0;
|
||||
current_netif = NULL;
|
||||
current_header = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user