From cfbe12adb208a67412f7d9be76b33848ec76dc87 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 17 Jan 2015 17:00:19 -0600 Subject: [PATCH] Networking: Fix some errors detected by Travis in configuration that have TCP on and UDP off and vice versa --- net/socket/net_close.c | 2 ++ net/socket/recvfrom.c | 2 ++ net/socket/sendto.c | 11 ++++++----- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/net/socket/net_close.c b/net/socket/net_close.c index 42949baf8a..a2ef7e91fa 100644 --- a/net/socket/net_close.c +++ b/net/socket/net_close.c @@ -273,6 +273,7 @@ end_wait: * ****************************************************************************/ +#ifdef CONFIG_NET_TCP static inline void netclose_txnotify(FAR struct socket *psock, FAR struct tcp_conn_s *conn) { @@ -311,6 +312,7 @@ static inline void netclose_txnotify(FAR struct socket *psock, } #endif /* CONFIG_NET_IPv6 */ } +#endif /* CONFIG_NET_TCP */ /**************************************************************************** * Function: netclose_disconnect diff --git a/net/socket/recvfrom.c b/net/socket/recvfrom.c index cf07e69c7c..6bbe9deeac 100644 --- a/net/socket/recvfrom.c +++ b/net/socket/recvfrom.c @@ -1077,6 +1077,7 @@ static void recvfromo_pkt_rxnotify(FAR struct pkt_conn_s *conn) * ****************************************************************************/ +#ifdef CONFIG_NET_UDP static inline void recvfrom_udp_rxnotify(FAR struct socket *psock, FAR struct udp_conn_s *conn) { @@ -1115,6 +1116,7 @@ static inline void recvfrom_udp_rxnotify(FAR struct socket *psock, } #endif /* CONFIG_NET_IPv6 */ } +#endif /* CONFIG_NET_UDP */ /**************************************************************************** * Function: pkt_recvfrom diff --git a/net/socket/sendto.c b/net/socket/sendto.c index 394dca5d76..f917ef940a 100644 --- a/net/socket/sendto.c +++ b/net/socket/sendto.c @@ -310,6 +310,7 @@ static uint16_t sendto_interrupt(FAR struct net_driver_s *dev, FAR void *conn, * ****************************************************************************/ +#ifdef CONFIG_NET_UDP static inline void sendto_txnotify(FAR struct socket *psock, FAR struct udp_conn_s *conn) { @@ -348,6 +349,7 @@ static inline void sendto_txnotify(FAR struct socket *psock, } #endif /* CONFIG_NET_IPv6 */ } +#endif /* CONFIG_NET_UDP */ /**************************************************************************** * Public Functions @@ -424,10 +426,8 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf, { #ifdef CONFIG_NET_UDP FAR struct udp_conn_s *conn; -#ifdef CONFIG_NET_IPv6 - FAR const struct sockaddr_in6 *into = (const struct sockaddr_in6 *)to; -#else - FAR const struct sockaddr_in *into = (const struct sockaddr_in *)to; +#ifdef CONFIG_NET_ARP_SEND + FAR const struct sockaddr_in *into; #endif struct sendto_s state; net_lock_t save; @@ -484,6 +484,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf, /* Make sure that the IP address mapping is in the ARP table */ #ifdef CONFIG_NET_ARP_SEND + into = (FAR const struct sockaddr_in *)to; ret = arp_send(into->sin_addr.s_addr); if (ret < 0) { @@ -582,7 +583,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf, return state.st_sndlen; #else err = ENOSYS; -#endif +#endif /* CONFIG_NET_UDP */ errout: set_errno(err);