lsof-org / lsof

LiSt Open Files
https://lsof.readthedocs.io
Other
424 stars 106 forks source link

[BUG] Cannot specify state for UDP protocol #322

Open informatik01 opened 3 months ago

informatik01 commented 3 months ago

Describe the bug

The documented feature of filtering processes that use UDP protocol with the specified state does not work on the latest (at the time of writing this) version of macOS Sonoma 14.6.

To Reproduce

Steps to reproduce the behavior (tried both the macOS supplied lsof revision 4.91 and the latest version 4.99.3 installed using Homebrew):

  1. Run this example from the lsof man documentation: sudo lsof -iUDP -sUDP:Idle
  2. See error:

    lsof: unknown -s protocol: "UDP:Idle"

Expected behavior

The normal output showing the results if present.

Program output

lsof: unknown -s protocol: "UDP:Idle" lsof 4.91 latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/ latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man usage: [-?abhlnNoOPRtUvVX] [+|-c c] [+|-d s] [+D D] [+|-f[cgG]] [-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+|-M] [-o [o]] [-p s] [+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names] Use the ``-h'' option to get more help information.


Environment (please complete the following information):

Additional context

Quote from the man lsof documentation:

Two common UDP state names are Unbound and Idle.

jiegec commented 3 months ago

The real problem is, the macOS kernel does not provide the information to lsof: no UDP socket info in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/proc_info.h

informatik01 commented 3 months ago

@jiegec So there is no solution / workaround to this problem?

If not, at least it would be nice to mention such moments in the man documentation to avoid confusion. It's not uncommon to mention platform specific nuances in the documentation so that users would be aware etc.

jiegec commented 3 months ago

@jiegec So there is no solution / workaround to this problem?

No that I am aware as of now. But I am not expert on this, you could investigate further to see if there is such way to find status.

If not, at least it would be nice to mention such moments in the man documentation to avoid confusion. It's not uncommon to mention platform specific nuances in the documentation so that users would be aware etc.

That's correct.