on boot
iptables blah --blah
iptables blah --blah
service myservice /system/bin/myarm64binary --config /path/to/conf.cfg
class main
user root
According to the documentation: https://android.googlesource.com/platform/system/core/+/master/init/README.md
/ init.rc is the most important. RC file. It is loaded by init process at the time of initialization. It is mainly responsible for system initialization. It will import / init.${ro.hardware}.rc, which is the main. RC file provided by system-level core vendors.
When the mount_all statement is executed, the init process loads all files in the /{system,vendor,odm}/etc/init/ directory, which will serve Actions and Services when the file system is mounted.
Is there something I'm missing? service list
does not list my app and iptables not appended. Even if I test-edit init.rc
and import my .rc directly it still does nothing.
exec
iptables command? – Kirikan May 18 '20 at 21:32init
's.rc
files aren't like shell scripts. You need to use proper formatting. Replaceiptables blah --blah
withexec
command as explained in the official documentation you linked. Also take care of SELinux context as explained in the question marked as duplicate. Also set proper file permissions on file. Btw settingsiptables
rules on boot isn't of much use. They may get reset bynetd
on network events. – Irfan Latif May 18 '20 at 23:16netd
won't delete manually injected rules. But it creates new chains and rules on network events. So the order of rules may keep on changing. Injecting rules on boot would work but it's not reliable. Better use some app like AFWall+ which updates custom providediptables
rules on network events. // Just to clarifyservice list
lists services in Android's Java framework, notinit
's native services. Checkinit
services usinggetprop | grep svc
. – Irfan Latif May 18 '20 at 23:48