From be6069649405dc79e1cfe36e88cc2a324b8f7a96 Mon Sep 17 00:00:00 2001 From: JacobCrabill Date: Wed, 25 May 2022 15:06:04 -0700 Subject: [PATCH] Revert "[BACKPORT] net/can: remove psock reference from can connect" This reverts commit 9ce3fab0ecffade260a886473097b3fc3b1100ea. PR reference: https://github.com/apache/incubator-nuttx/pull/5467 In order for this commit to be valid, the following other PRs must also be back-ported first: - https://github.com/apache/incubator-nuttx/pull/5434 Additional PRs that fix related bugs: - https://github.com/apache/incubator-nuttx/pull/5462 - https://github.com/apache/incubator-nuttx/pull/5466 --- net/can/can.h | 4 ++++ net/can/can_sockif.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/net/can/can.h b/net/can/can.h index ea67fe1c948..b2b51b778de 100644 --- a/net/can/can.h +++ b/net/can/can.h @@ -117,6 +117,10 @@ struct can_conn_s int32_t tx_deadline; # endif #endif + +#ifdef CONFIG_NET_TIMESTAMP + FAR struct socket *psock; /* Needed to get SO_TIMESTAMP value */ +#endif }; /**************************************************************************** diff --git a/net/can/can_sockif.c b/net/can/can_sockif.c index 780641f9727..60b38bba11e 100644 --- a/net/can/can_sockif.c +++ b/net/can/can_sockif.c @@ -221,6 +221,12 @@ static int can_setup(FAR struct socket *psock, int protocol) return -ENOMEM; } +#ifdef CONFIG_NET_TIMESTAMP + /* Store psock in conn se we can read the SO_TIMESTAMP value */ + + conn->psock = psock; +#endif + /* Initialize the connection instance */ conn->protocol = (uint8_t)protocol;