Networking: New domain field in socket structure is created by socket(), but missed cases where a socket is created via accept() or dup()

This commit is contained in:
Gregory Nutt 2015-01-22 07:50:31 -06:00
parent fbbce64623
commit 2e8667d304
3 changed files with 5 additions and 3 deletions

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* net/socket/accept.c * 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> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * 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). * interrupt handler).
*/ */
pnewsock->s_domain = psock->s_domain;
pnewsock->s_type = SOCK_STREAM; pnewsock->s_type = SOCK_STREAM;
pnewsock->s_conn = state.acpt_newconn; pnewsock->s_conn = state.acpt_newconn;
pnewsock->s_flags |= _SF_CONNECTED; pnewsock->s_flags |= _SF_CONNECTED;

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* net/socket/net_clone.c * 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> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * 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 */ /* 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_type = psock1->s_type; /* Protocol type: Only SOCK_STREAM or SOCK_DGRAM */
psock2->s_flags = psock1->s_flags; /* See _SF_* definitions */ psock2->s_flags = psock1->s_flags; /* See _SF_* definitions */
#ifdef CONFIG_NET_SOCKOPTS #ifdef CONFIG_NET_SOCKOPTS

View File

@ -211,7 +211,7 @@ static void recvfrom_newpktdata(FAR struct net_driver_s *dev,
* Copy the read data from the packet * Copy the read data from the packet
* *
* Parameters: * 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 * pstate recvfrom state structure
* *
* Returned Value: * Returned Value: