Recent Posts
-
June 10, 2021
Xxhash测试
#include <stdio.h>#include <string.h>#define XXH_INLINE_ALL 1#define XXH_VECTOR XXH_SSE2#include "xxhash.h"void main(){ char s[128]; while(1) { printf("input:"); scanf("%s", s); XXH64_hash_t a = XXH3_64bits(s, strlen(s)); printf("...
-
May 26, 2021
Linux平台的pppoe Server
参数配置cat /etc/ppp/pppoe-server-options# PPP options for the PPPoE server# LIC: GPLauthrequire-paprequire-chap# loginlcp-echo-interval 10lcp-echo-failure 2ms-dns 119.29.29.29ms-dns 180.76.76.76配置用户名和密码/ # cat /etc/ppp/pap-secrets # Secrets for authe...
-
April 28, 2021
终端程序清屏和用背景色绘制柱状图
主要使用“ANSI escape codes”printf("\e[2J"); // ANSI escape codes (Erase in Display)printf("\e[H"); // ANSI escape codes (Cursor Position 0 0)printf("\e[42m"); // yellow color for (j = 0; j < len; j++) { printf(" ");}printf("\e[0m\n"); printf("\e[...
-
March 18, 2021
C语言最简单的makefile
makefile 的默认target是第一个 target ,所以把all放到最前面才行。这个makefile要学习一下才行SRC = .CFLAGS = -O2 -Wall -g -I../include LDFLAGS = -Wl,-rpath="/usr/mylibdir" -L/usr/mylibdirLIBS = -lmylibCC := gccAR := arobjs = main.o util.o \ test.ohdrs = test.hall:...
-
February 19, 2021
Golang的抓包程序
https://github.com/google/gopacket例子在example目录下https://github.com/google/gopacket/blob/master/examples/afpacket/afpacket.go
-
January 12, 2021
Vim Go插件和filetype plugin
https://github.com/fatih/vim-go最新的这个版本 vim-go的 保存文件是自动gofmt格式化的功能没起作用,执行:GoFmt是可以的格式化话,说明gofmt.exe的路径没有问题。看代码应该是.vim\bundle\vim-go\ftplugin\go.vim 文件里面的 autocmd BufWritePre <buffer> call go#auto#fmt_autosave()这一行代码起作用的,但这个好像没有加载。gvim默认集成了C:...
-
January 12, 2021
Bpftrace要取代systemtap了吗
https://lwn.net/Articles/793749/ Kernel analysis with bpftrace https://kernel.taobao.org/2020/01/Kernel-analysis-with-bpftrace/https://github.com/iovisor/bpftracehttps://www.brendangregg.com/blog/2021-07-03/how-to-add-bpf-observabili...
-
January 12, 2021
Centos 8.3的tcp Bbr还没有合并上游的wifi场景的补丁
高速wifi场景下ack包积聚发送问题,导致传输速度不稳定吧。https://groups.google.com/forum/#!topic/bbr-dev/8pgyOyUavvY1: Higher throughput for WiFi and other paths with aggregationAggregation effects are extremely common with WiFi, cellular, and cable modem link technologies...
-
December 07, 2020
Fuse文件系统启用page cache
fuse文件系统默认没有启用page cache的,需要配置mount选项 High-level mount options: These following options are not actually passed to the kernel but interpreted by libfuse. They can only be specified for filesystems that use the high-level libfuse AP...
-
November 23, 2020
Linux内核检查ip是否为本地接口的ip
内核有一个函数inet_lookup_ifaddr_rcu,但这个函数没有导出的,也可以inet_addr_type_dev_table这个获取路由项是否为本地ip来判断。ip_dev_find应该可以可以通过查找ip在哪个设备上来确人,不过这个麻烦些完了需要dev_put(dev);释放掉资源/* called under RCU lock */struct in_ifaddr *inet_lookup_ifaddr_rcu(struct net *net, __be32 addr){ ...