简体   繁体   中英

How to add and manage a new network interface into android stack

I have developed a network driver for the mobile linux kernel. My network device (pif0) run well with

ifconfig pif0 10.22.2.15
ping -I pif0 8.8.8.8

Now i want that android stack be able to track this device and to set it as the default gateway to internet.

I think that i should develop a number of java classes to track my new interface and manage it, but i don't know how to make them in the good order.

any one who have made this exercise can advice please?

Treat the network as an ethernet interface.

You can either use the default name of "ethx" for you interface. In your case, rename pif0 to eth0 . This will cause it to match as an ethernet interface which will cause it to be tracked by the android stack. This should almost assuredly work for your use case.

The other option would be to update the android resource overlay config_ethernet_iface_regex to match your naming scheme of pifx .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM