修改的代码:
登录 - Gitee.comhttps://gitee.com/r77683962/linux-6.9.0/commit/544b50c78fda2b7fc4b804fc9c9ce52680ea30ea登录 - Gitee.com
https://gitee.com/r77683962/linux-6.9.0/commit/40c1317470be408dac492846df615e48922d026d
操作步骤:
代码修改后,要重新编译内核,然后重启电脑(auto_comiple.sh · r77683962/linux-6.9.0 - Gitee.com),要看自已的代码是否生效,需要看看系统启动日志,或者直接 grep搜索:
1、访问www.baidu.com之前先通过echo "" > /var/log/kern.log把原来内容清空,
2、然后访问www.baidu.com,当浏览器百度网页打开后;
3、把kern.log 文件备份下:cp /var/log/kern.log /home(类似这样);
部分日志(去掉很多相同的部分,便于观察完整日志:dmesg_log/kern_small.log · r77683962/linux-6.9.0 - Gitee.com):
12:14:35.798558: tcp_output.c tcp_send_ack
12:14:35.799290: tcp_output.c tcp_event_ack_sent
12:14:35.799444: tcp_output.c tcp_send_delayed_ack
12:14:35.799457: tcp_output.c tcp_event_ack_sent
12:14:35.799461: tcp_output.c tcp_event_data_sent
12:14:35.799497: tcp_output.c tcp_event_new_data_sent
12:14:35.799502: tcp_output.c tcp_send_fin
12:14:35.799988: tcp_output.c tcp_event_ack_sent
12:14:35.886768: tcp_output.c tcp_event_new_data_sent
12:14:36.225003: tcp_output.c tcp_event_ack_sent
12:14:36.553888: tcp_output.c tcp_event_ack_sent
12:14:36.912717: tcp_output.c tcp_event_ack_sent
12:14:37.454211: tcp_output.c tcp_event_ack_sent
12:14:42.816052: tcp_output.c tcp_connect
12:14:42.817108: tcp_output.c tcp_connect_init
12:14:42.860954: tcp_output.c tcp_send_ack
12:14:42.860977: tcp_output.c tcp_event_ack_sent
12:14:42.862993: tcp_output.c tcp_event_ack_sent
12:14:42.862998: tcp_output.c tcp_event_data_sent
12:14:42.863000: tcp_output.c tcp_event_new_data_sent
12:14:42.921052: tcp_output.c tcp_send_ack
12:14:42.921915: tcp_output.c tcp_event_ack_sent
12:14:42.921937: tcp_output.c tcp_send_ack
12:14:42.921942: tcp_output.c tcp_event_ack_sent
12:14:42.921952: tcp_output.c tcp_send_ack
12:14:42.923025: tcp_output.c tcp_event_ack_sent
12:14:42.952965: tcp_output.c tcp_event_ack_sent
12:14:42.952968: tcp_output.c tcp_event_data_sent
12:14:42.952980: tcp_output.c tcp_event_new_data_sent
12:14:42.996891: tcp_output.c tcp_send_ack
12:14:42.996911: tcp_output.c tcp_event_ack_sent
12:14:42.999007: tcp_output.c tcp_event_ack_sent
12:14:42.999022: tcp_output.c tcp_event_data_sent
12:14:42.999024: tcp_output.c tcp_event_new_data_sent
12:14:42.999037: tcp_output.c tcp_event_ack_sent
12:14:43.000904: tcp_output.c tcp_event_data_sent
12:14:43.000929: tcp_output.c tcp_event_new_data_sent
12:14:43.000932: tcp_output.c tcp_event_ack_sent
12:14:43.000933: tcp_output.c tcp_event_data_sent
12:14:43.000934: tcp_output.c tcp_event_new_data_sent
12:14:43.039908: tcp_output.c tcp_send_ack
12:14:43.039926: tcp_output.c tcp_event_ack_sent
12:14:43.042769: tcp_output.c tcp_event_ack_sent
12:14:43.042858: tcp_output.c tcp_event_data_sent
12:14:43.042865: tcp_output.c tcp_event_new_data_sent
12:14:43.050933: tcp_output.c tcp_send_delayed_ack
12:14:43.052812: tcp_output.c tcp_send_delayed_ack
12:14:43.052976: tcp_output.c tcp_send_ack
12:14:43.052978: tcp_output.c tcp_event_ack_sent
12:14:43.052992: tcp_output.c tcp_send_delayed_ack
12:14:43.052997: tcp_output.c tcp_send_delayed_ack
12:14:43.053164: tcp_output.c tcp_send_ack
12:14:43.053206: tcp_output.c tcp_event_ack_sent
12:14:43.053215: tcp_output.c tcp_event_ack_sent
12:14:43.053220: tcp_output.c tcp_event_data_sent
12:14:43.053222: tcp_output.c tcp_event_new_data_sent
12:14:43.075964: tcp_output.c tcp_connect
12:14:43.079257: tcp_output.c tcp_connect_init
12:14:43.120128: tcp_output.c tcp_send_ack
12:14:43.120207: tcp_output.c tcp_event_ack_sent
12:14:43.123620: tcp_output.c tcp_event_ack_sent
12:14:43.123676: tcp_output.c tcp_event_data_sent
12:14:43.123681: tcp_output.c tcp_event_new_data_sent
12:14:43.184113: tcp_output.c tcp_send_ack
12:14:43.184119: tcp_output.c tcp_event_ack_sent
12:14:43.184127: tcp_output.c tcp_send_ack
12:14:43.184130: tcp_output.c tcp_event_ack_sent
12:14:43.200723: tcp_output.c tcp_event_ack_sent
12:14:43.202239: tcp_output.c tcp_event_data_sent
12:14:43.202281: tcp_output.c tcp_event_new_data_sent
12:14:43.247894: tcp_output.c tcp_send_ack
12:14:43.249335: tcp_output.c tcp_event_ack_sent
12:14:43.253191: tcp_output.c tcp_event_ack_sent
12:14:43.253328: tcp_output.c tcp_event_data_sent
12:14:43.255094: tcp_output.c tcp_event_new_data_sent
12:14:43.255385: tcp_output.c tcp_event_ack_sent
12:14:43.255406: tcp_output.c tcp_event_data_sent
12:14:43.255455: tcp_output.c tcp_event_new_data_sent
12:14:43.255557: tcp_output.c tcp_event_ack_sent
12:14:43.256537: tcp_output.c tcp_event_data_sent
12:14:43.256640: tcp_output.c tcp_event_new_data_sent
12:14:43.297384: tcp_output.c tcp_send_ack
12:14:43.297478: tcp_output.c tcp_event_ack_sent
12:14:43.297535: tcp_output.c tcp_send_ack
12:14:43.299444: tcp_output.c tcp_event_ack_sent
12:14:43.299593: tcp_output.c tcp_event_ack_sent
12:14:43.299644: tcp_output.c tcp_event_data_sent
12:14:43.299654: tcp_output.c tcp_event_new_data_sent
12:14:43.435056: tcp_output.c tcp_send_delayed_ack
12:14:43.435246: message repeated 3 times: [ tcp_output.c tcp_send_delayed_ack ]
12:14:43.437353: tcp_output.c tcp_send_ack
12:14:43.437453: tcp_output.c tcp_event_ack_sent
12:14:43.437463: tcp_output.c tcp_event_ack_sent
12:14:43.437468: tcp_output.c tcp_event_data_sent
12:14:43.437473: tcp_output.c tcp_event_new_data_sent
12:14:43.487288: tcp_output.c tcp_connect
12:14:43.491911: tcp_output.c tcp_connect_init
12:14:43.659722: tcp_output.c tcp_event_ack_sent
12:14:43.660115: tcp_output.c tcp_send_ack
12:14:43.660132: tcp_output.c tcp_event_ack_sent
12:14:43.664089: tcp_output.c tcp_event_ack_sent
12:14:43.664101: tcp_output.c tcp_event_data_sent
12:14:43.664148: tcp_output.c tcp_event_new_data_sent
12:14:43.869087: tcp_output.c tcp_send_ack
12:14:43.869197: tcp_output.c tcp_event_ack_sent
12:14:43.869210: tcp_output.c tcp_send_ack
12:14:43.870004: tcp_output.c tcp_event_ack_sent
12:14:43.882371: tcp_output.c tcp_event_ack_sent
12:14:43.882478: tcp_output.c tcp_event_data_sent
12:14:43.884192: tcp_output.c tcp_event_new_data_sent
12:14:43.884583: tcp_output.c tcp_event_ack_sent
12:14:43.884631: tcp_output.c tcp_event_data_sent
12:14:43.884635: tcp_output.c tcp_event_new_data_sent
12:14:43.884640: tcp_output.c tcp_event_ack_sent
12:14:43.884988: tcp_output.c tcp_event_data_sent
12:14:43.886150: tcp_output.c tcp_event_new_data_sent
12:14:44.056311: tcp_output.c tcp_send_delayed_ack
12:14:44.056432: message repeated 2 times: [ tcp_output.c tcp_send_delayed_ack ]
12:14:44.058538: tcp_output.c tcp_event_ack_sent
12:14:44.058634: tcp_output.c tcp_event_data_sent
12:14:44.058642: tcp_output.c tcp_event_new_data_sent
12:14:44.061140: tcp_output.c tcp_event_ack_sent
12:14:44.061245: tcp_output.c tcp_event_data_sent
12:14:44.061448: tcp_output.c tcp_event_new_data_sent
12:14:46.138542: tcp_output.c tcp_event_ack_sent
12:14:46.864209: tcp_output.c tcp_event_ack_sent
12:14:47.798856: tcp_output.c tcp_event_ack_sent
12:14:53.806617: tcp_output.c tcp_event_ack_sent
12:14:53.873023: tcp_output.c tcp_event_ack_sent
12:14:56.513387: tcp_output.c tcp_event_ack_sent
从这里边可以看到类似TCP协议操作的一些流程:
12:14:43.487288: tcp_output.c tcp_connect
12:14:43.491911: tcp_output.c tcp_connect_init
12:14:43.659722: tcp_output.c tcp_event_ack_sent
12:14:43.660115: tcp_output.c tcp_send_ack
12:14:43.660132: tcp_output.c tcp_event_ack_sent
12:14:43.664089: tcp_output.c tcp_event_ack_sent
12:14:43.664101: tcp_output.c tcp_event_data_sent
12:14:43.664148: tcp_output.c tcp_event_new_data_sent
12:14:43.869087: tcp_output.c tcp_send_ack
12:14:43.869197: tcp_output.c tcp_event_ack_sent
12:14:43.869210: tcp_output.c tcp_send_ack
12:14:43.870004: tcp_output.c tcp_event_ack_sent
12:14:43.882371: tcp_output.c tcp_event_ack_sent
12:14:43.882478: tcp_output.c tcp_event_data_sent
12:14:43.884192: tcp_output.c tcp_event_new_data_sent
12:14:43.884583: tcp_output.c tcp_event_ack_sent
12:14:43.884631: tcp_output.c tcp_event_data_sent
12:14:43.884635: tcp_output.c tcp_event_new_data_sent
12:14:43.884640: tcp_output.c tcp_event_ack_sent
12:14:43.884988: tcp_output.c tcp_event_data_sent
12:14:43.886150: tcp_output.c tcp_event_new_data_sent
12:14:44.056311: tcp_output.c tcp_send_delayed_ack
12:14:44.056432: message repeated 2 times: [ tcp_output.c tcp_send_delayed_ack ]
12:14:44.058538: tcp_output.c tcp_event_ack_sent
12:14:44.058634: tcp_output.c tcp_event_data_sent
12:14:44.058642: tcp_output.c tcp_event_new_data_sent
12:14:44.061140: tcp_output.c tcp_event_ack_sent
12:14:44.061245: tcp_output.c tcp_event_data_sent
12:14:44.061448: tcp_output.c tcp_event_new_data_sent
在实际操作的时候需要注意,现在发现根目录分配50G磁盘空间不太够用,如果/目录磁盘空间耗尽,极有可能导致操作系统起不来,要注意,昨天碰到 了,使用的这个办法:
VMware 修复 Ubuntu 启动不了问题_vmware恢复ubuntu系统-CSDN博客
昨天发现磁盘空间不够用,新挂载了一块磁盘,不过这个博客有点啰嗦。。。
ubuntu 18.04 增加新磁盘、挂载、格式化_ubuntu 修改guazai-CSDN博客
在/var/log目录增长比较快,内核速度有点快,我们添加打印日志,会导致日志增长比较快,过一阵子要清理下,或者使用df -h 瞅下磁盘空间。。。
以上皆为自已测试的数据,也不知道具体是否正确。。。
如果要更加严谨,需要自已写一个程序与外网建立TCP,并进行数据传输,或者用操作系统的CURL命令,TCPDUMP抓包等等这些手段,并且在内核打印日志的时候把TCP报文的端口号信息等等打印出来,这样可以确保万无一失,可是不想搞,嫌麻烦。。。。