Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] UDP connection status display #287

Open
TouchOdeath opened this issue Apr 7, 2023 · 3 comments
Open

[FEATURE] UDP connection status display #287

TouchOdeath opened this issue Apr 7, 2023 · 3 comments

Comments

@TouchOdeath
Copy link

TouchOdeath commented Apr 7, 2023

Is your feature request related to a problem? Please describe.
TCP results will say whether the connection is ESTABLISHED, LISTEN, etc. UDP will not. At first glance, I thought there was a bug with lsof. After careful inspection, I realized its probably just a display discrepancy.

Describe the solution you'd like
UDP results need to mimic how TCP results are displayed as far as connection status.

Describe alternatives you've considered
Use netstat instead of lsof

Additional context
lsof TCP example:
command: lsof -nPi | grep TCP
results:
httpd 54175 user1234 9u IPv6 34820 0t0 TCP *:443 (LISTEN)
httpd 54175 user1234 21u IPv6 22049696 0t0 TCP 127.0.0.1:443->127.0.0.1:55212 (ESTABLISHED)

lsof UDP example:
command: lsof -nPi | grep UDP
results: NetworkMa 734 user1234 25u IPv4 20544929 0t0 UDP 10.0.2.15:68->10.0.2.2:67

netstat UDP example:
command: netstat -an | grep udp
results: udp 0 0 10.0.2.15:68 10.0.2.2:67 ESTABLISHED

@TouchOdeath TouchOdeath changed the title [FEATURE] [FEATURE] UDP connection status display Apr 7, 2023
@jiegec
Copy link
Contributor

jiegec commented Apr 8, 2023

From the protocol perspective UDP is connectionless. From the socket perspective, UDP can be Bound or Unbound. Which OS are you using?

@TouchOdeath
Copy link
Author

TouchOdeath commented Apr 10, 2023

RHEL8. Why would netstat choose to say 'ESTABLISHED' for their UDP? lsof does specify if its connected (->), and its easy to miss. Thanks for the reply.

@cloud-account
Copy link

Hello,

What TouchOdeath refers to is probably known as "connected" UDP:

https://man7.org/linux/man-pages/man7/udp.7.html
"When connect(2) is called on the socket, the default destination address is set and datagrams can now be sent using send(2) or write(2) without specifying a destination address. It is still possible to send to other destinations by passing an address to sendto(2) or sendmsg(2)."

https://man7.org/linux/man-pages/man2/connect.2.html
"If the socket sockfd is of type SOCK_DGRAM, then addr is the address to which datagrams are sent by default, and the only address from which datagrams are received."

Such UDP connections are displayed as ESTABLISHED by tools like netstat or ss.

Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants