|
From: | Benjamin Schelte |
Subject: | [lwip-users] Question about a specific error handling in "lwip_sendto" (1.4.0.rc1) |
Date: | Wed, 20 Oct 2010 15:30:29 +0200 |
Dear all, I have just seen a possible misbehavior of
the first LWIP_ERROR() macro in “lwIP_sendto”. Therefore I have a
question. The code says the following:
LWIP_ERROR("lwip_sendto: invalid address", (((to == NULL) &&
(tolen == 0)) ||
((tolen == sizeof(struct sockaddr_in)) &&
((to->sa_family) == AF_INET) && ((((mem_ptr_t)to) % 4) == 0))),
sock_set_errno(sock, err_to_errno(ERR_ARG)); return -1;); The API itself is declared as the
following: int lwip_sendto(int s, const void
*data, size_t size, int flags,
const struct
sockaddr *to, socklen_t tolen) My usage of that function comes in with a “struct
sockaddr*” for the 2nd last parameter and (sizeof(struct sockaddr)) for
the last one. So LWIP_ERROR will throw an error here,
because (sizeof(struct sockaddr)) != (sizeof(struct sockaddr_in)). Is this intended behavior? Or is either the
LWIP_ERROR condition or the parameter list of lwIP_sendto incorrect? Best regards, Benjamin |
[Prev in Thread] | Current Thread | [Next in Thread] |