Android9.0 iptables uses INetd to realize the realization of shielding ip blacklist

1 Introduction

In the 9.0 system rom customization development, in the product requirements of the netd network in the system, it will be required to set the function of shielding the ip address. The iptables command in liunx is also more important, and then I will come to the INetd Realize the relevant functions of blocking the ip blacklist, that is, only a certain URL can be blocked in the app, that is, except this URL, others can access the Internet, and finally realize the interface call in the framework custom service

2. The core class that iptables uses INetd to realize the function of shielding the ip blacklist

system/netd/server/binder/android/net/INetd.aidl
system/netd/server/NetdNativeService.h
system/netd/server/NetdNativeService.cpp
system/netd/server/FirewallController.h
system/netd/server/FirewallController.cpp

3. Core function analysis and implementation of iptables using INetd to realize the function of shielding ip blacklist


In the android native system, iptables is very important in the network filtering packet module. Iptabels is a packet filtering firewall system integrated with the Linux kernel. Both linux and android include the function of Iptables.
Iptables facilitate better control of IP packet filtering and firewall configuration on a Linux system if the Linux system is connected to the Internet or a LAN, a server, or a proxy server that connects the LAN to the Internet.
Another important advantage of netfilter/iptables is that it gives the user complete control over firewall configuration and packet filtering. You can customize your own rules to meet your specific needs

The commonly used commands of iptables are as follows:
Command Description

-L  --list          &

Guess you like

Origin blog.csdn.net/baidu_41666295/article/details/130661604