Esempio n. 1
0
/*
 * Clears IPv4 addresses on the specified interface.
 */
void ifc_clear_ipv4_addresses(const char *name) {
    unsigned count, addr;
    ifc_init();
    for (count=0, addr=1;((addr != 0) && (count < 255)); count++) {
        if (ifc_get_addr(name, &addr) < 0)
            break;
        if (addr)
            ifc_set_addr(name, 0);
    }
    ifc_close();
}
Esempio n. 2
0
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;
}