Example #1
0
/**
 * Initialize this network driver.
 * - The core application configuration must be completed prior calling
 * - The driver should not be already initialized (if its the case, a no-op will occur)
 * - The pConfig parameter must not be NULL
 *
 * @param pConfig [in] a pointer to eucanetd system-wide configuration
 * @param pGni [in] a pointer to the Global Network Information structure
 * @return 0 on success. Integer number on failure.
 */
static int network_driver_init(eucanetdConfig *pConfig, globalNetworkInfo *pGni) {
    int rc = 0;

    LOGDEBUG("Initializing '%s' network driver.\n", DRIVER_NAME());

    // Make sure our given pointer is valid
    if (!pConfig) {
        LOGERROR("Failure to initialize '%s' networking mode. Invalid configuration parameter provided.\n", DRIVER_NAME());
        return (1);
    }
    // Are we already initialized?
    if (IS_INITIALIZED()) {
        LOGERROR("Networking '%s' mode already initialized. Skipping!\n", DRIVER_NAME());
        return (0);
    }

    if (!pMidoConfig) {
        pMidoConfig = EUCA_ZALLOC_C(1, sizeof (mido_config));
    }
    pMidoConfig->config = pConfig;
    rc = initialize_mido(pMidoConfig, pConfig, pGni);
    if (rc) {
        LOGERROR("could not initialize mido: please ensure that all required config options for VPCMIDO mode are set\n");
        free_mido_config(pMidoConfig);
        EUCA_FREE(pMidoConfig);
        return (1);
    }
    
    // We are now initialized
    gInitialized = TRUE;

    return (0);
}
Example #2
0
//!
//! Initialize the network driver.
//!
//! @param[in] pConfig a pointer to our application configuration
//!
//! @return 0 on success or 1 if any failure occurred.
//!
//! @see
//!
//! @pre
//!     - The core application configuration must be completed prior calling
//!     - The driver should not be already initialized (if its the case, a no-op will occur)
//!     - The pConfig parameter must not be NULL
//!
//! @post
//!     On success the driver is properly configured. On failure, the state of
//!     the driver is non-deterministic. If the driver was previously initialized,
//!     this will result into a no-op.
//!
//! @note
//!
static int network_driver_init(eucanetdConfig * pConfig)
{
    int rc = 0;

    LOGINFO("Initializing '%s' network driver.\n", DRIVER_NAME());

    // Make sure our given pointer is valid
    if (!pConfig) {
        LOGERROR("Failure to initialize '%s' networking mode. Invalid configuration parameter provided.\n", DRIVER_NAME());
        return (1);
    }
    // Are we already initialized?
    if (IS_INITIALIZED()) {
        LOGERROR("Networking '%s' mode already initialized. Skipping!\n", DRIVER_NAME());
        return (0);
    }

    pMidoConfig = EUCA_ZALLOC_C(1, sizeof (mido_config));
    pMidoConfig->config = pConfig;
    //rc = initialize_mido(pMidoConfig, pConfig->eucahome, pConfig->flushmode, pConfig->disable_l2_isolation, pConfig->midoeucanetdhost, pConfig->midogwhosts,
    //        pConfig->midopubnw, pConfig->midopubgwip, "169.254.0.0", "17");
    rc = initialize_mido(pMidoConfig, pConfig, "169.254.0.0", "17");
    if (rc) {
        LOGERROR("could not initialize mido: please ensure that all required config options for VPCMIDO mode are set\n");
        EUCA_FREE(pMidoConfig);
        return (1);
    }
    
    // We are now initialized
    gInitialized = TRUE;

    return (0);
}
Example #3
0
//!
//! Initialize the network driver.
//!
//! @param[in] pConfig a pointer to our application configuration
//!
//! @return 0 on success or 1 if any failure occurred.
//!
//! @see
//!
//! @pre
//!     - The core application configuration must be completed prior calling
//!     - The driver should not be already initialized (if its the case, a no-op will occur)
//!     - The pConfig parameter must not be NULL
//!
//! @post
//!     On success the driver is properly configured. On failure, the state of
//!     the driver is non-deterministic. If the driver was previously initialized,
//!     this will result into a no-op.
//!
//! @note
//!
static int network_driver_init(eucanetdConfig * pConfig)
{
    int rc = 0;

    LOGINFO("Initializing '%s' network driver.\n", DRIVER_NAME());

    // Make sure our given pointer is valid
    if (!pConfig) {
        LOGERROR("Failure to initialize '%s' networking mode. Invalid configuration parameter provided.\n", DRIVER_NAME());
        return (1);
    }
    // Are we already initialized?
    if (IS_INITIALIZED()) {
        LOGERROR("Networking '%s' mode already initialized. Skipping!\n", DRIVER_NAME());
        return (0);
    }

/*
    if ((pMidoConfig = EUCA_ZALLOC(1, sizeof (mido_config))) == NULL) {
        LOGERROR("Failed to initialize '%s' networking mode. Out of memory!\n", DRIVER_NAME());
        return (1);
    }

    rc = initialize_mido(pMidoConfig, pConfig->eucahome, pConfig->flushmode, pConfig->disable_l2_isolation, pConfig->midoeucanetdhost, pConfig->midogwhosts,
            pConfig->midopubnw, pConfig->midopubgwip, "169.254.0.0", "17");
    if (rc) {
        LOGERROR("could not initialize mido: please ensure that all required config options for VPCMIDO mode are set in eucalyptus.conf\n");
        EUCA_FREE(pMidoConfig);
        return (1);
    }
*/

    pMidoConfig = EUCA_ZALLOC_C(1, sizeof (mido_config));
    rc = initialize_mido(pMidoConfig, pConfig->eucahome, pConfig->flushmode, pConfig->disable_l2_isolation, pConfig->midoeucanetdhost, pConfig->midogwhosts,
            pConfig->midopubnw, pConfig->midopubgwip, "169.254.0.0", "17");
    if (rc) {
        LOGERROR("could not initialize mido: please ensure that all required config options for VPCMIDO mode are set\n");
        EUCA_FREE(pMidoConfig);
        return (1);
    }
    //pMidoConfig = pMidoConfig_c;
    
    // Release unnecessary handlers
    if (pConfig->ipt) {
        ipt_handler_close(pConfig->ipt);
    }
    if (pConfig->ips) {
        ips_handler_close(pConfig->ips);
    }
    if (pConfig->ebt) {
        ebt_handler_close(pConfig->ebt);
    }

    // We are now initialized
    gInitialized = TRUE;

    return (0);
}