Skip to content

Instantly share code, notes, and snippets.

View supermartian's full-sized avatar
🐶
Focusing

Yuzhong Wen supermartian

🐶
Focusing
  • Hangzhou, Zhejiang
View GitHub Profile
@supermartian
supermartian / compile.txt
Created November 6, 2015 04:04
Compile eglibc on ubuntu
IT IS PAINFUL.
./configure --disable-sanity-checks CFLAGS="-O2 -U_FORTIFY_SOURCE -fno-stack-protector -march=native" --disable-profile --enable-kernel=2.6.25
@supermartian
supermartian / gist:207b3b0ec81f56da6b8e
Created October 1, 2015 18:59
pthread_mutex_lock
pthread mutex lock comes with different types:
1. private: process only
2. shared: cross the process boundary
Private:
Spins in the userspace for a while, after a timeout, goes to futex. In this way it saves some system calls.
Shared:
Goes to futex directly.
@supermartian
supermartian / gist:5747765
Last active December 18, 2015 07:39
miscs on beaglebone
opkg install kernel-dev
opkg install wireless-tools
CONFIG_POWER_SAVING=n
@supermartian
supermartian / gist:5400996
Created April 17, 2013 01:10
Linux HTB configuration
<M> Hierarchical Token Bucket (HTB)
<M> Hierarchical Fair Service Curve (HFSC)
<M> Multi Band Priority Queueing (PRIO) (NEW)
<M> Stochastic Fairness Queueing (SFQ)
<M> Token Bucket Filter (TBF) (NEW)
<M> Elementary classification (BASIC)
<M> Traffic-Control Index (TCINDEX)
<M> Routing decision (ROUTE)
<M> Netfilter mark (FW)
<M> Universal 32bit comparisons w/ hashing (U32)
@supermartian
supermartian / netlink_demo.c
Created March 12, 2013 07:27
Netlink programming demo.
@supermartian
supermartian / netfilter
Created October 17, 2012 01:28
Netfilter snippets
1、Netfilter核心基于在IP层插入的5个HOOK
PREROUTING: NF_IP_PRE_ROUTING
LOCAL_INPUT: NF_IP_LOCAL_IN
FORWARD: NF_IP_FORWARD
LOCAL_OUTPUT: NF_IP_LOCAL_OUT
POSTROUTING: NF_IP_POST_ROUTING
2、Netfilter在PRE_ROUTING和LOCAL_OUT处进行分片重组,也就是进入Netfilter的模块确保全部都是不分片的(?)
nf_defrag_ipv4.c
重组从外面进来的包,和本地主机生成的数据包