Revert "Replace ip_link_add with setup_network."
This reverts commit 3836eb33f8cdd2057aa1ccdb8ab16655ff37517e.
BUG: 117518489
Test: Local build and boot
Change-Id: Ib957b73f28bc2827262c7f370be5a8f3dc53bb3e
diff --git a/shared/config/init.vsoc.rc b/shared/config/init.vsoc.rc
index d2aeb37..b6294d6 100644
--- a/shared/config/init.vsoc.rc
+++ b/shared/config/init.vsoc.rc
@@ -31,7 +31,13 @@
mount_all /vendor/etc/fstab.${ro.hardware}
restorecon_recursive /vendor
- start setup_network
+ start rename_eth0
+ # works around framework netiface enumeration issue
+ start rename_eth1
+
+ # wait until rename_eth0 is done before attempting to stack wifi
+ wait /proc/self/net/xt_qtaguid/iface_stat/buried_eth0
+ start create_wifi
# TODO(ender): Find better way to talk to serial port.
chmod 622 /dev/kmsg
@@ -70,7 +76,15 @@
start socket_forward_proxy
-service setup_network /vendor/bin/setup_network ${ro.boot.cuttlefish_network}
+service rename_eth0 /vendor/bin/rename_netiface eth0 buried_eth0
+ oneshot
+
+
+service rename_eth1 /vendor/bin/rename_netiface eth1 rmnet0
+ oneshot
+
+
+service create_wifi /vendor/bin/ip_link_add virt_wifi buried_eth0 wlan0
oneshot
diff --git a/shared/device.mk b/shared/device.mk
index d8fbf44..2bc462f 100644
--- a/shared/device.mk
+++ b/shared/device.mk
@@ -72,7 +72,7 @@
vsoc_input_service \
vport_trigger \
rename_netiface \
- setup_network \
+ ip_link_add \
#
# Packages for AOSP-available stuff we use from the framework
diff --git a/shared/sepolicy/file_contexts b/shared/sepolicy/file_contexts
index 1a1ffb9..d295828 100644
--- a/shared/sepolicy/file_contexts
+++ b/shared/sepolicy/file_contexts
@@ -30,4 +30,4 @@
/vendor/bin/hw/android\.hardware\.bluetooth@1\.0-service\.sim u:object_r:hal_bluetooth_sim_exec:s0
/vendor/bin/hw/android\.hardware\.dumpstate@1\.0-service\.cuttlefish u:object_r:hal_dumpstate_impl_exec:s0
/vendor/bin/hw/android\.hardware\.health@2\.0-service.cuttlefish u:object_r:hal_health_default_exec:s0
-/vendor/bin/setup_network u:object_r:setup_network_exec:s0
+/vendor/bin/ip_link_add u:object_r:ip_link_add_exec:s0
diff --git a/shared/sepolicy/ip_link_add.te b/shared/sepolicy/ip_link_add.te
new file mode 100644
index 0000000..a1c13e2
--- /dev/null
+++ b/shared/sepolicy/ip_link_add.te
@@ -0,0 +1,10 @@
+type ip_link_add, domain;
+type ip_link_add_exec, exec_type, vendor_file_type, file_type;
+
+init_daemon_domain(ip_link_add)
+
+allow ip_link_add self:capability { net_admin net_raw sys_module };
+allow ip_link_add self:udp_socket { create ioctl };
+allow ip_link_add self:netlink_route_socket { bind create nlmsg_write read write };
+
+allow ip_link_add kernel:system module_request;
diff --git a/shared/sepolicy/setup_network.te b/shared/sepolicy/setup_network.te
deleted file mode 100644
index a1568a3..0000000
--- a/shared/sepolicy/setup_network.te
+++ /dev/null
@@ -1,10 +0,0 @@
-type setup_network, domain;
-type setup_network_exec, exec_type, vendor_file_type, file_type;
-
-init_daemon_domain(setup_network)
-
-allow setup_network self:capability { net_admin net_raw sys_module };
-allow setup_network self:udp_socket { create ioctl };
-allow setup_network self:netlink_route_socket { bind create nlmsg_write read write };
-
-allow setup_network kernel:system module_request;