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); API_VAR_ALLOC(struct dns_api_msg, MEMP_DNS_API_MSG, msg);
#if LWIP_MPU_COMPATIBLE #if LWIP_MPU_COMPATIBLE
if (addr == NULL) { strncpy(API_VAR_REF(msg).name, name, DNS_MAX_NAME_LENGTH-1);
addr = IP_ADDR_ANY; API_VAR_REF(msg).name[DNS_MAX_NAME_LENGTH-1] = 0;
} #else /* LWIP_MPU_COMPATIBLE */
#else
msg.err = &err; msg.err = &err;
msg.sem = &sem; msg.sem = &sem;
API_VAR_REF(msg).addr = API_VAR_REF(addr); API_VAR_REF(msg).addr = API_VAR_REF(addr);
API_VAR_REF(msg).name = name;
#endif /* LWIP_MPU_COMPATIBLE */ #endif /* LWIP_MPU_COMPATIBLE */
err = sys_sem_new(API_EXPR_REF(API_VAR_REF(msg).sem), 0); err = sys_sem_new(API_EXPR_REF(API_VAR_REF(msg).sem), 0);
if (err != ERR_OK) { if (err != ERR_OK) {
API_VAR_FREE(MEMP_DNS_API_MSG, msg); API_VAR_FREE(MEMP_DNS_API_MSG, msg);
return err; return err;
} }
API_VAR_REF(msg).name = name;
tcpip_callback(lwip_netconn_do_gethostbyname, &API_VAR_REF(msg)); tcpip_callback(lwip_netconn_do_gethostbyname, &API_VAR_REF(msg));
sys_sem_wait(API_EXPR_REF(API_VAR_REF(msg).sem)); 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, /* If requested, based on the IPV6_CHECKSUM socket option per RFC3542,
compute the checksum and update the checksum in the payload. */ compute the checksum and update the checksum in the payload. */
if (PCB_ISIPV6(pcb) && pcb->chksum_reqd) { if (PCB_ISIPV6(pcb) && pcb->chksum_reqd) {
u16_t chksum; u16_t chksum = ip6_chksum_pseudo(p, pcb->protocol, p->tot_len, ipX_2_ip6(src_ip), ipX_2_ip6(dst_ip));
chksum = ip6_chksum_pseudo(q, pcb->protocol, q->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));
*(u16_t *)(((u8_t *)q->payload) + pcb->chksum_offset) = chksum; SMEMCPY(((u8_t *)p->payload) + pcb->chksum_offset, &chksum, sizeof(u16_t));
} }
#endif #endif

View File

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