Http://bbs.chinaunix.net/thread-4090162-1-1.html
First, why do you want to do this
read kernel route subsystem code, when I understand the relationship between the data structure and control process,
is still inappropriate, there is always a "paper on the end of light, I know this thing to preach" feeling.
at this time, Systemtap can play a big role.
Second, prepare to work
Install SYSTEMTAP, kernel, kernel-debuginfo, Kernel-debuginfo-common, etc.
Uname-r
2.6.38.6-26.rc1.fc15.i686
Http://ftp.jaist.ac.jp/pub/Linux ... 26.rc1.fc15.src.rpm
Rpmbuild--rebuild--target=i686--without PAE--without perf--with firmware--without debug KERNEL-2.6.38.6-26.RC1.FC15.SRC.RPM
Three, scripting
This script is written for 2.6.38.6-26 code, and if you use a different kernel version,
needs to be modified accordingly. Need to rename to Route.tap.
<ignore_js_op> route.tap.tar.gz (171 Bytes, download times:
Four, run
run at one terminal:
stap-v route.tap |tee log
Run at another terminal:
IP route flush Cache
SSH 10.66.66.66
Five: Parse
parses the log file and you can see the entire route lookup process.
such as <ignore_js_op> log.tar.gz (1.07 KB, Download number of times:
Fish drinking water, lengnuanzizhi, fun in it!
Learning Linux routing code with SYSTEMTAP