启动netd的位置,编译完成二进制的位置,源码的位置,main函数位置,以及调用hook初始化脚本
@android/system/core/rootdir/init.rc - start netd
@android/out/target/product/msmnile_gvmq/obj/EXECUTABLES/netd_intermediates/netd - binary location
@android/system/netd/server - source code
@android/system/netd/server/main.cpp - main function entry
gCtls = new android::net::Controllers();
gCtls->init();
initIptablesRules
setupOemIptablesHook
system("/system/bin/oem-iptables-init.sh")
简单验证
#adb root
#adb remount
reboot your board
#adb root
#adb push oem-iptables-init.sh /system/bin/
#adb shell sync
reboot your board
oem-iptables-init.sh内容为关掉防火墙
#!/system/bin/sh
iptables -F
查看效果
iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destinationChain FORWARD (policy ACCEPT)
target prot opt source destinationChain OUTPUT (policy ACCEPT)
target prot opt source destination