Пример #1
0
/** arch specific load
 * @internal
 *
 * @retval  0 success
 * @retval -1 no container specified
 * @retval -2 could not open data file
 */
int
netsnmp_access_route_container_arch_load(netsnmp_container* container,
                                         u_int load_flags)
{
    u_long          count = 0;
    int             rc;

    DEBUGMSGTL(("access:route:container",
                "route_container_arch_load (flags %x)\n", load_flags));

    if (NULL == container) {
        snmp_log(LOG_ERR, "no container specified/found for access_route\n");
        return -1;
    }

    rc = _load_ipv4(container, &count);
    
#ifdef NETSNMP_ENABLE_IPV6
    if((0 != rc) || (load_flags & NETSNMP_ACCESS_ROUTE_LOAD_IPV4_ONLY))
        return rc;

    /*
     * load ipv6. ipv6 module might not be loaded,
     * so ignore -2 err (file not found)
     */
    rc = _load_ipv6(container, &count);
    if (-2 == rc)
        rc = 0;
#endif

    return rc;
}
Пример #2
0
/** arch specific load
 * @internal
 *
 * @retval  0 success
 * @retval -1 no container specified
 * @retval -2 could not access data source
 */
int
netsnmp_access_route_container_arch_load(netsnmp_container* container,
					 u_int load_flags)
{
    int count, err;

    err = 0;

    DEBUGMSGTL(("access:route:container", "route_container_arch_load\n"));

    if (container == NULL) {
        snmp_log(LOG_ERR, "no container specified/found for access_route\n");
        return -1;
    }

    err = _load_ipv4(container, &count);
    if (err != 0) {
        NETSNMP_LOGONCE((LOG_ERR, "_load_ipv4 failed %d\n", err));
        goto out;
    }

    if (err != 0 || load_flags & NETSNMP_ACCESS_ROUTE_LOAD_IPV4_ONLY)
	return err;

    err = _load_ipv6(container, &count);
    if (err != 0) {
        NETSNMP_LOGONCE((LOG_ERR, "_load_ipv6 failed %d\n", err));
        goto out;
    }

out:
    return (err == 0 ? 0 : -3);
}