mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-06 22:44:38 +08:00
Fix compile when UDP is disabled
This commit is contained in:
parent
34682facd1
commit
aeae4e91db
@ -969,8 +969,6 @@ int
|
||||
lwip_sendmsg(int s, const struct msghdr *msg, int flags)
|
||||
{
|
||||
struct lwip_sock *sock;
|
||||
struct netbuf *chain_buf;
|
||||
u16_t remote_port;
|
||||
int i;
|
||||
#if LWIP_TCP
|
||||
u8_t write_flags;
|
||||
@ -1027,6 +1025,8 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
|
||||
}
|
||||
/* else, UDP and RAW NETCONNs */
|
||||
#if LWIP_UDP || LWIP_RAW
|
||||
{
|
||||
struct netbuf *chain_buf;
|
||||
|
||||
LWIP_UNUSED_ARG(flags);
|
||||
LWIP_ERROR("lwip_sendmsg: invalid msghdr name", (((msg->msg_name == NULL) && (msg->msg_namelen == 0)) ||
|
||||
@ -1040,6 +1040,7 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
|
||||
return -1;
|
||||
}
|
||||
if (msg->msg_name) {
|
||||
u16_t remote_port;
|
||||
SOCKADDR_TO_IPADDR_PORT((const struct sockaddr *)msg->msg_name, &chain_buf->addr, remote_port);
|
||||
netbuf_fromport(chain_buf) = remote_port;
|
||||
}
|
||||
@ -1050,8 +1051,7 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
|
||||
/* Allocate a new netbuf and copy the data into it. */
|
||||
if (netbuf_alloc(chain_buf, (u16_t)size) == NULL) {
|
||||
err = ERR_MEM;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
/* flatten the IO vectors */
|
||||
size_t offset = 0;
|
||||
for (i = 0; i < msg->msg_iovlen; i++) {
|
||||
@ -1103,6 +1103,7 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
|
||||
|
||||
sock_set_errno(sock, err_to_errno(err));
|
||||
return (err == ERR_OK ? size : -1);
|
||||
}
|
||||
#else /* LWIP_UDP || LWIP_RAW */
|
||||
sock_set_errno(sock, err_to_errno(ERR_ARG));
|
||||
return -1;
|
||||
|
@ -978,7 +978,7 @@
|
||||
* IP_MULTICAST_TTL/IP_MULTICAST_IF/IP_MULTICAST_LOOP
|
||||
*/
|
||||
#if !defined LWIP_MULTICAST_TX_OPTIONS || defined __DOXYGEN__
|
||||
#define LWIP_MULTICAST_TX_OPTIONS LWIP_IGMP
|
||||
#define LWIP_MULTICAST_TX_OPTIONS (LWIP_IGMP && LWIP_UDP)
|
||||
#endif
|
||||
/**
|
||||
* @}
|
||||
|
Loading…
x
Reference in New Issue
Block a user