Merge branch 'master' into ppp-new

This commit is contained in:
Sylvain Rochet 2014-02-21 20:37:10 +01:00
commit 75ef1278e6
3 changed files with 11 additions and 8 deletions

View File

@ -829,20 +829,19 @@ netconn_gethostbyname(const char *name, ip_addr_t *addr)
API_VAR_ALLOC(struct dns_api_msg, MEMP_DNS_API_MSG, msg);
#if LWIP_MPU_COMPATIBLE
if (addr == NULL) {
addr = IP_ADDR_ANY;
}
#else
strncpy(API_VAR_REF(msg).name, name, DNS_MAX_NAME_LENGTH-1);
API_VAR_REF(msg).name[DNS_MAX_NAME_LENGTH-1] = 0;
#else /* LWIP_MPU_COMPATIBLE */
msg.err = &err;
msg.sem = &sem;
API_VAR_REF(msg).addr = API_VAR_REF(addr);
API_VAR_REF(msg).name = name;
#endif /* LWIP_MPU_COMPATIBLE */
err = sys_sem_new(API_EXPR_REF(API_VAR_REF(msg).sem), 0);
if (err != ERR_OK) {
API_VAR_FREE(MEMP_DNS_API_MSG, msg);
return err;
}
API_VAR_REF(msg).name = name;
tcpip_callback(lwip_netconn_do_gethostbyname, &API_VAR_REF(msg));
sys_sem_wait(API_EXPR_REF(API_VAR_REF(msg).sem));

View File

@ -318,9 +318,9 @@ raw_sendto(struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr)
/* If requested, based on the IPV6_CHECKSUM socket option per RFC3542,
compute the checksum and update the checksum in the payload. */
if (PCB_ISIPV6(pcb) && pcb->chksum_reqd) {
u16_t chksum;
chksum = ip6_chksum_pseudo(q, pcb->protocol, q->tot_len, ipX_2_ip6(src_ip), ipX_2_ip6(dst_ip));
*(u16_t *)(((u8_t *)q->payload) + pcb->chksum_offset) = chksum;
u16_t chksum = ip6_chksum_pseudo(p, pcb->protocol, p->tot_len, ipX_2_ip6(src_ip), ipX_2_ip6(dst_ip));
LWIP_ASSERT("Checksum must fit into first pbuf", p->len >= (pcb->chksum_offset + 2));
SMEMCPY(((u8_t *)p->payload) + pcb->chksum_offset, &chksum, sizeof(u16_t));
}
#endif

View File

@ -140,7 +140,11 @@ struct api_msg {
(see netconn_gethostbyname). */
struct dns_api_msg {
/** Hostname to query or dotted IP address string */
#if LWIP_MPU_COMPATIBLE
char name[DNS_MAX_NAME_LENGTH];
#else /* LWIP_MPU_COMPATIBLE */
const char *name;
#endif /* LWIP_MPU_COMPATIBLE */
/** Rhe resolved address is stored here */
ip_addr_t API_MSG_M_DEF(addr);
/** This semaphore is posted when the name is resolved, the application thread