summaryrefslogtreecommitdiff
path: root/nuttx/net
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-06 15:44:41 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-06 15:44:41 +0000
commit77598342d00348e0b97f05b2c6735bdf8dde8e33 (patch)
treea6d10071812c10e0221dc7a8d15d603f9e4b1ad8 /nuttx/net
parentbf15faf28c3826541af41632784beaefdb9a2254 (diff)
downloadpx4-nuttx-77598342d00348e0b97f05b2c6735bdf8dde8e33.tar.gz
px4-nuttx-77598342d00348e0b97f05b2c6735bdf8dde8e33.tar.bz2
px4-nuttx-77598342d00348e0b97f05b2c6735bdf8dde8e33.zip
TFTP Get integration
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@885 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net')
-rw-r--r--nuttx/net/socket.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/nuttx/net/socket.c b/nuttx/net/socket.c
index 644f5a8c2..d9d4e440b 100644
--- a/nuttx/net/socket.c
+++ b/nuttx/net/socket.c
@@ -107,12 +107,16 @@ int socket(int domain, int type, int protocol)
/* Only SOCK_STREAM and possible SOCK_DRAM are supported */
-#if defined(CONFIG_NET_UDP) && defined(CONFIG_NET_TCP)
- if (protocol != 0 || (type != SOCK_STREAM && type != SOCK_DGRAM))
+#if defined(CONFIG_NET_TCP) && defined(CONFIG_NET_UDP)
+ if ((type == SOCK_STREAM && protocol != 0 && protocol != IPPROTO_TCP) ||
+ (type == SOCK_DGRAM && protocol != 0 && protocol != IPPROTO_UDP) ||
+ (type != SOCK_STREAM && type != SOCK_DGRAM))
#elif defined(CONFIG_NET_TCP)
- if (protocol != 0 || type != SOCK_STREAM)
+ if ((type == SOCK_STREAM && protocol != 0 && protocol != IPPROTO_TCP) ||
+ (type != SOCK_STREAM))
#elif defined(CONFIG_NET_UDP)
- if (protocol != 0 || type != SOCK_DGRAM)
+ if ((type == SOCK_DGRAM && protocol != 0 && protocol != IPPROTO_UDP) ||
+ (type != SOCK_DGRAM))
#endif
{
err = EPROTONOSUPPORT;