From 2e8667d3044858354a25902f011fbb5f7a471474 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 22 Jan 2015 07:50:31 -0600 Subject: [PATCH] Networking: New domain field in socket structure is created by socket(), but missed cases where a socket is created via accept() or dup() --- net/socket/accept.c | 3 ++- net/socket/net_clone.c | 3 ++- net/socket/recvfrom.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/socket/accept.c b/net/socket/accept.c index 46622d318e..1a4dbd04c0 100644 --- a/net/socket/accept.c +++ b/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 * * 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/net/socket/net_clone.c b/net/socket/net_clone.c index 1ecd50ebad..5d46f45ead 100644 --- a/net/socket/net_clone.c +++ b/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 * * 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/net/socket/recvfrom.c b/net/socket/recvfrom.c index 7fe2483956..fe194ac864 100644 --- a/net/socket/recvfrom.c +++ b/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: