diff --git a/net/icmp/icmp_ioctl.c b/net/icmp/icmp_ioctl.c index 7c38638d635..8f1364b24e2 100644 --- a/net/icmp/icmp_ioctl.c +++ b/net/icmp/icmp_ioctl.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -77,6 +78,12 @@ int icmp_ioctl(FAR struct socket *psock, int cmd, unsigned long arg) case FIONSPACE: *(FAR int *)((uintptr_t)arg) = MIN_UDP_MSS; break; + case FIOC_FILEPATH: + snprintf((FAR char *)(uintptr_t)arg, PATH_MAX, + "icmp:[dev %s, id %" PRIu16 ", flg %" PRIx8 "]", + conn->dev ? conn->dev->d_ifname : "NULL", + NTOHS(conn->id), conn->sconn.s_flags); + break; default: ret = -ENOTTY; break; diff --git a/net/icmpv6/icmpv6_ioctl.c b/net/icmpv6/icmpv6_ioctl.c index 6e97bd3f9b4..16ad6428009 100644 --- a/net/icmpv6/icmpv6_ioctl.c +++ b/net/icmpv6/icmpv6_ioctl.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -77,6 +78,12 @@ int icmpv6_ioctl(FAR struct socket *psock, int cmd, unsigned long arg) case FIONSPACE: *(FAR int *)((uintptr_t)arg) = MIN_UDP_MSS; break; + case FIOC_FILEPATH: + snprintf((FAR char *)(uintptr_t)arg, PATH_MAX, + "icmp6:[dev %s, id %" PRIu16 ", flg %" PRIx8 "]", + conn->dev ? conn->dev->d_ifname : "NULL", + NTOHS(conn->id), conn->sconn.s_flags); + break; default: ret = -ENOTTY; break; diff --git a/net/local/local_sockif.c b/net/local/local_sockif.c index d7827a69430..cc6c21a71f5 100644 --- a/net/local/local_sockif.c +++ b/net/local/local_sockif.c @@ -885,7 +885,6 @@ static int local_ioctl(FAR struct socket *psock, int cmd, unsigned long arg) case FIOC_FILEPATH: snprintf((FAR char *)(uintptr_t)arg, PATH_MAX, "local:[%s]", conn->lc_path); - ret = OK; break; case BIOC_FLUSH: ret = -EINVAL; diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index e0443a62b3b..f906f6af9cd 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -1591,6 +1591,9 @@ ssize_t net_ioctl_arglen(int cmd) case FIONREAD: return sizeof(int); + case FIOC_FILEPATH: + return PATH_MAX; + case SIOCGIFCONF: return sizeof(struct ifconf); diff --git a/net/rpmsg/rpmsg_sockif.c b/net/rpmsg/rpmsg_sockif.c index 6aa5bdd7b36..5f662d07cab 100644 --- a/net/rpmsg/rpmsg_sockif.c +++ b/net/rpmsg/rpmsg_sockif.c @@ -1346,6 +1346,25 @@ static int rpmsg_socket_close(FAR struct socket *psock) return 0; } +static void rpmsg_socket_path(FAR struct rpmsg_socket_conn_s *conn, + FAR char *buf, size_t len) +{ + if (conn->backlog) /* Server */ + { + snprintf(buf, len, + "rpmsg:[%s:[%s%s]<->%s]", + CONFIG_RPTUN_LOCAL_CPUNAME, conn->rpaddr.rp_name, + conn->nameid, conn->rpaddr.rp_cpu); + } + else /* Client */ + { + snprintf(buf, len, + "rpmsg:[%s<->%s:[%s%s]]", + CONFIG_RPTUN_LOCAL_CPUNAME, conn->rpaddr.rp_cpu, + conn->rpaddr.rp_name, conn->nameid); + } +} + static int rpmsg_socket_ioctl(FAR struct socket *psock, int cmd, unsigned long arg) { @@ -1362,6 +1381,10 @@ static int rpmsg_socket_ioctl(FAR struct socket *psock, *(FAR int *)((uintptr_t)arg) = rpmsg_socket_get_space(conn); break; + case FIOC_FILEPATH: + rpmsg_socket_path(conn, (FAR char *)(uintptr_t)arg, PATH_MAX); + break; + default: ret = -ENOTTY; break; diff --git a/net/tcp/tcp_ioctl.c b/net/tcp/tcp_ioctl.c index 3bf5905ce61..83754efa34e 100644 --- a/net/tcp/tcp_ioctl.c +++ b/net/tcp/tcp_ioctl.c @@ -154,7 +154,6 @@ int tcp_ioctl(FAR struct tcp_conn_s *conn, int cmd, unsigned long arg) break; case FIOC_FILEPATH: tcp_path(conn, (FAR char *)(uintptr_t)arg, PATH_MAX); - ret = OK; break; default: ret = -ENOTTY; diff --git a/net/udp/udp_ioctl.c b/net/udp/udp_ioctl.c index 1262ef52451..79ce573c200 100644 --- a/net/udp/udp_ioctl.c +++ b/net/udp/udp_ioctl.c @@ -149,7 +149,6 @@ int udp_ioctl(FAR struct udp_conn_s *conn, int cmd, unsigned long arg) break; case FIOC_FILEPATH: udp_path(conn, (FAR char *)(uintptr_t)arg, PATH_MAX); - ret = OK; break; default: ret = -ENOTTY;