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/include/netutils/ifc.h b/include/netutils/ifc.h
index 2d49a87..9a8b282 100644
--- a/include/netutils/ifc.h
+++ b/include/netutils/ifc.h
@@ -31,6 +31,9 @@
 extern int ifc_up(const char *name);
 extern int ifc_down(const char *name);
 
+extern int ifc_enable(const char *ifname);
+extern int ifc_disable(const char *ifname);
+
 #define RESET_IPV4_ADDRESSES 0x01
 #define RESET_IPV6_ADDRESSES 0x02
 #define RESET_ALL_ADDRESSES  (RESET_IPV4_ADDRESSES | RESET_IPV6_ADDRESSES)
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