summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-01-22 07:50:31 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-01-22 07:50:31 -0600
commitfe707e4a546c72263c70be87c5fc5b5a13306075 (patch)
treec76dd22de90a1d9ffcebf1611655e1c0208cd09a
parenteb102a1fe4d709bab907d75e3725e38d1cc2fa5b (diff)
downloadnuttx-fe707e4a546c72263c70be87c5fc5b5a13306075.tar.gz
nuttx-fe707e4a546c72263c70be87c5fc5b5a13306075.tar.bz2
nuttx-fe707e4a546c72263c70be87c5fc5b5a13306075.zip
Networking: New domain field in socket structure is created by socket(), but missed cases where a socket is created via accept() or dup()
-rw-r--r--nuttx/net/socket/accept.c3
-rw-r--r--nuttx/net/socket/net_clone.c3
-rw-r--r--nuttx/net/socket/recvfrom.c2
3 files changed, 5 insertions, 3 deletions
diff --git a/nuttx/net/socket/accept.c b/nuttx/net/socket/accept.c
index 46622d318..1a4dbd04c 100644
--- a/nuttx/net/socket/accept.c
+++ b/nuttx/net/socket/accept.c
@@ -1,7 +1,7 @@
/****************************************************************************
* net/socket/accept.c
*
- * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2012, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -489,6 +489,7 @@ int accept(int sockfd, FAR struct sockaddr *addr, FAR socklen_t *addrlen)
* interrupt handler).
*/
+ pnewsock->s_domain = psock->s_domain;
pnewsock->s_type = SOCK_STREAM;
pnewsock->s_conn = state.acpt_newconn;
pnewsock->s_flags |= _SF_CONNECTED;
diff --git a/nuttx/net/socket/net_clone.c b/nuttx/net/socket/net_clone.c
index 1ecd50eba..5d46f45ea 100644
--- a/nuttx/net/socket/net_clone.c
+++ b/nuttx/net/socket/net_clone.c
@@ -1,7 +1,7 @@
/****************************************************************************
* net/socket/net_clone.c
*
- * Copyright (C) 2009, 2011-2014 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009, 2011-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -75,6 +75,7 @@ int net_clone(FAR struct socket *psock1, FAR struct socket *psock2)
/* Duplicate the socket state */
+ psock2->s_domain = psock1->s_domain; /* IP domain: PF_INET, PF_INET6, or PF_PACKET */
psock2->s_type = psock1->s_type; /* Protocol type: Only SOCK_STREAM or SOCK_DGRAM */
psock2->s_flags = psock1->s_flags; /* See _SF_* definitions */
#ifdef CONFIG_NET_SOCKOPTS
diff --git a/nuttx/net/socket/recvfrom.c b/nuttx/net/socket/recvfrom.c
index 7fe248395..fe194ac86 100644
--- a/nuttx/net/socket/recvfrom.c
+++ b/nuttx/net/socket/recvfrom.c
@@ -211,7 +211,7 @@ static void recvfrom_newpktdata(FAR struct net_driver_s *dev,
* Copy the read data from the packet
*
* Parameters:
- * dev The sructure of the network driver that caused the interrupt
+ * dev The structure of the network driver that caused the interrupt
* pstate recvfrom state structure
*
* Returned Value: