Exemplo n.º 1
0
/**
 *
 * @retval  0 no errors
 * @retval !0 errors
 */
int
netsnmp_arch_ipaddress_container_load(netsnmp_container *container)
{
    int rc = 0, idx_offset = 0;

    rc = _netsnmp_ioctl_ipaddress_container_load_v4(container, idx_offset);
    if(rc < 0) {
        u_int flags = NETSNMP_ACCESS_IPADDRESS_FREE_KEEP_CONTAINER;
        netsnmp_access_ipaddress_container_free(container, flags);
        return rc;
    }

#if defined (INET6)
    idx_offset = rc;

    /*
     * load ipv6, ignoring errors if file not found
     */
    rc = _load_v6(container, idx_offset);
    if (-2 == rc)
        rc = 0;
    else if(rc < 0) {
        u_int flags = NETSNMP_ACCESS_IPADDRESS_FREE_KEEP_CONTAINER;
        netsnmp_access_ipaddress_container_free(container, flags);
    }
#endif

    /*
     * return no errors (0) if we found any interfaces
     */
    if(rc > 0)
        rc = 0;

    return rc;
}
Exemplo n.º 2
0
int
netsnmp_access_arp_container_arch_load(netsnmp_container *container)
{
    int rc = 0, idx_offset = 0;

    rc = _load_v4(container, idx_offset);
    if(rc < 0) {
        u_int flags = NETSNMP_ACCESS_ARP_FREE_KEEP_CONTAINER;
        netsnmp_access_arp_container_free(container, flags);
        return rc;
    }

#if defined (INET6) && 0 /* xx-rks: arp for v6? */
    idx_offset = rc;

    rc = _load_v6(container, idx_offset);
    if(rc < 0) {
        u_int flags = NETSNMP_ACCESS_ARP_FREE_KEEP_CONTAINER;
        netsnmp_access_arp_container_free(container, flags);
    }
#endif

    /*
     * return no errors (0) if we found any interfaces
     */
    if(rc > 0)
        rc = 0;

    return rc;
}
Exemplo n.º 3
0
/**
 *
 * @retval  0 no errors
 * @retval !0 errors
 */
int netsnmp_arch_ipaddress_container_load (netsnmp_container * container, u_int load_flags)
{
    int rc = 0, idx_offset = 0;

    if (!(load_flags & NETSNMP_ACCESS_IPADDRESS_LOAD_IPV6_ONLY))
    {
        rc = _load_v4 (container, idx_offset);
        if (rc < 0)
        {
            u_int flags = NETSNMP_ACCESS_IPADDRESS_FREE_KEEP_CONTAINER;

            netsnmp_access_ipaddress_container_free (container, flags);
        }
    }

#if defined( NETSNMP_ENABLE_IPV6 )

    if (!(load_flags & NETSNMP_ACCESS_IPADDRESS_LOAD_IPV4_ONLY))
    {
        if (rc < 0)
            rc = 0;

        idx_offset = rc;

        rc = _load_v6 (container, idx_offset);
        if (rc < 0)
        {
            u_int flags = NETSNMP_ACCESS_IPADDRESS_FREE_KEEP_CONTAINER;

            netsnmp_access_ipaddress_container_free (container, flags);
        }
    }
#endif

    /*
     * return no errors (0) if we found any interfaces
     */
    if (rc > 0)
        rc = 0;
    return rc;
}