加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

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                        

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读