Android bug? Create virtual network interface on android with ip link

648 views
Skip to first unread message

进无止境

unread,
Jan 3, 2017, 3:52:15 PM1/3/17
to Android Linux Kernel Development
I create a virtual network interface on AndroidM: 
      #ip link add link eth0 name uzb addr 00:1e:32:15:60:cf type macvlan
it also prompt "ip: RTNETLINK answers: Operation not supported" until i open the kernel config ——CONFIG_MACVLAN   

but i add ip address for uzb(eg: 192.168.1.169)
       #ip addr add 192.168.10.169/24 dev uzb

I ping the IP 192.168.10.169 on other PC, i found that there have two ARP ack for 192.168.10.169 , one is from eth0 , another is from uzb
i don't know why?  i do same operation on ubuntu, it is ok, very normal
It is bug on Android ?


who can give me any idea???

The details are as follows: -------------------------------------------------------------------------------------------------------------------------------------------------------------------
root@rk3368:/ # ip link add link eth0 name uzb addr 00:1e:32:15:60:cf type macvlan
root@rk3368:/ # 
root@rk3368:/ # 
root@rk3368:/ # ip addr add 192.168.10.169/24 dev uzb
root@rk3368:/ # ip link set uzb up
root@rk3368:/ # 
root@rk3368:/ # 
root@rk3368:/ # 
root@rk3368:/ # 
root@rk3368:/ # 
root@rk3368:/ # ifconfig -a                                                    
eth0      Link encap:Ethernet  HWaddr 1A:36:01:CC:D6:9D
          inet addr:192.168.10.100  Bcast:192.168.10.255  Mask:255.255.255.0 
          inet6 addr: fd00:aaaa::1836:1ff:fecc:d69d/64 Scope: Global
          inet6 addr: fe80::1836:1ff:fecc:d69d/64 Scope: Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1646 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:239587 TX bytes:2562 
          Interrupt:59 

wlan0     Link encap:Ethernet  HWaddr 04:E6:76:C3:94:17
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:1000 
          RX bytes:0 TX bytes:0 

uzb       Link encap:Ethernet  HWaddr 00:1E:32:15:60:CF
          inet addr:192.168.10.169  Bcast:0.0.0.0  Mask:255.255.255.0 
          inet6 addr: fe80::21e:32ff:fe15:60cf/64 Scope: Link
          inet6 addr: fd00:aaaa::21e:32ff:fe15:60cf/64 Scope: Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:0 
          RX bytes:1327 TX bytes:484 

sit0      Link encap:IPv6-in-IPv4  
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:0 
          RX bytes:0 TX bytes:0 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0 
          inet6 addr: ::1/128 Scope: Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0 
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 
          collisions:0 txqueuelen:0 
          RX bytes:0 TX bytes:0 

Jiwon Kim

unread,
Jan 11, 2017, 6:23:50 AM1/11/17
to android...@googlegroups.com
Hello.
I suggest that you need to learn about android network and security model.
Android adopted advanced routing for multinetwork and firewall policy. All network is managed in netd and controlled by connectivity service. Android framework network concept is tightly coupled in native area.

See the AOSP code focusing on netid, 
System/netd
   Fwmark
   Networkcontroller
   Routecontroller
Framework/base
   Connectivitymanager
   connectivityservice
   networkmanagementservice
   Vpn

This command will help you to understand what's going on

# ip rules
# ip route show table all  or each tables i rule description
# cat /data/misc/net/rt_tables
# iptables -L -t mangle
# iptables -L -t raw
# iptables -L -t filter



2017. 1. 4. 오전 5:52에 "进无止境" <2526...@qq.com>님이 작성:

--
--
unsubscribe: android-kernel+unsubscribe@googlegroups.com
website: http://groups.google.com/group/android-kernel
---
You received this message because you are subscribed to the Google Groups "Android Linux Kernel Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-kernel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages