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
This commit is contained in:
Sreeram Ramachandran 2014-07-23 09:30:53 -07:00
parent 759356bbd8
commit eec232603d
2 changed files with 34 additions and 0 deletions

View file

@ -31,6 +31,9 @@ extern int ifc_get_hwaddr(const char *name, void *ptr);
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)

View file

@ -563,6 +563,37 @@ int ifc_create_default_route(const char *name, in_addr_t gw)
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