linux – 确定TCP套接字是否在内核空间中
发布时间:2020-12-14 02:33:35 所属栏目:Linux 来源:网络整理
导读:我没有问题找出一个套接字属于用户空间 – 我只是扫描/ proc /看看哪个PID拥有[套接字].但是在内核空间中打开TCP套接字时,/ proc /中没有条目(因为内核没有PID). 我认为假设仅仅因为在/ proc中找不到套接字是不安全的,它是由内核启动的. 我虽然关于/ proc /
我没有问题找出一个套接字属于用户空间 – 我只是扫描/ proc /看看哪个PID拥有[套接字].但是在内核空间中打开TCP套接字时,/ proc /中没有条目(因为内核没有PID).
我认为假设仅仅因为在/ proc中找不到套接字是不安全的,它是由内核启动的. 我虽然关于/ proc / net / tcp的最终未记载的7列.也许其中一个人可以提供太多套接字来源的提示?我无法破译内核的源代码来弄清楚这7个字段代表什么. 请有人借给我一些帮助. 解决方法
尝试使用附加args的netstat:
sudo netstat -wtpeav sudo是为了确保你以root身份运行它,否则它不会向你展示一切. 选项是: -w,--raw Show raw sockets. -t,--tcp Show TCP protocol sockets. -p,--program Show the PID and name of the program to which each socket belongs. -e,--extend Display additional information. Use this option twice for maximum detail. -a,--all Show both listening and non-listening sockets. With the --interfaces option,show interfaces that are not up --verbose,-v Tell the user what is going on by being verbose. Especially print some useful informa |
推荐文章
站长推荐
热点阅读