Put back some deleted code.
http://ag/507249 removed a bunch of supposedly dead (unused) code. It turns out
at least ifc_disable() is being used in some protected partner branches. Put
back that as well as ifc_enable() to keep it symmetric.
Bug: 15413389
Change-Id: Ibec83a66e5d9079876ccf36d250b95b7c0294c03
diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c
index 52ce171..2786373 100644
--- a/libnetutils/ifc_utils.c
+++ b/libnetutils/ifc_utils.c
@@ -563,6 +563,37 @@
return ret;
}
+// Needed by code in hidden partner repositories / branches, so don't delete.
+int ifc_enable(const char *ifname)
+{
+ int result;
+
+ ifc_init();
+ result = ifc_up(ifname);
+ ifc_close();
+ return result;
+}
+
+int ifc_disable(const char *ifname)
+{
+ unsigned addr, count;
+ int result;
+
+ ifc_init();
+ result = ifc_down(ifname);
+
+ ifc_set_addr(ifname, 0);
+ for (count=0, addr=1;((addr != 0) && (count < 255)); count++) {
+ if (ifc_get_addr(ifname, &addr) < 0)
+ break;
+ if (addr)
+ ifc_set_addr(ifname, 0);
+ }
+
+ ifc_close();
+ return result;
+}
+
int ifc_reset_connections(const char *ifname, const int reset_mask)
{
#ifdef HAVE_ANDROID_OS