void pfring_hw_ft_init(pfring *ring) { int rc; socklen_t len = sizeof(pfring_device_type); rc = getsockopt(ring->fd, 0, SO_GET_DEVICE_TYPE, &ring->ft_device_type, &len); if(rc < 0) ring->ft_device_type = standard_nic_family; #ifdef HAVE_REDIRECTOR init_redirector(ring); #endif }
static sliceable_switch * create_sliceable_switch( const char *topology_service, const switch_options *options ) { assert( topology_service != NULL ); assert( options != NULL ); // Allocate sliceable_switch object sliceable_switch *instance = xmalloc( sizeof( sliceable_switch ) ); instance->idle_timeout = options->idle_timeout; instance->handle_arp_with_packetout = options->handle_arp_with_packetout; instance->setup_reverse_flow = options->setup_reverse_flow; instance->switches = NULL; instance->fdb = NULL; instance->pathresolver = NULL; instance->second_stage_down = false; instance->last_stage_down = false; info( "idle_timeout is set to %u [sec].", instance->idle_timeout ); if ( instance->handle_arp_with_packetout ) { info( "Handle ARP with packetout" ); } // Create pathresolver table instance->pathresolver = create_pathresolver(); // Create forwarding database instance->fdb = create_fdb(); // Initialize port database instance->switches = create_ports( &instance->switches ); // Initialize libraries init_libtopology( topology_service ); // Ask topology manager to notify any topology change events. // after_subscribed() will be called subscribe_topology( after_subscribed, instance ); // Initialize filter init_filter( options->filter_db_file ); // Initialize multiple slices support init_slice( options->slice_db_file, options->mode, instance ); // Initialize redirector init_redirector(); return instance; }
static routing_switch * create_routing_switch( const char *topology_service, const routing_switch_options *options ) { assert( topology_service != NULL ); assert( options != NULL ); // Allocate routing_switch object routing_switch *routing_switch = xmalloc( sizeof( struct routing_switch ) ); routing_switch->idle_timeout = options->idle_timeout; routing_switch->switches = NULL; routing_switch->fdb = NULL; routing_switch->second_stage_down = false; routing_switch->last_stage_down = false; info( "idle_timeout is set to %u [sec].", routing_switch->idle_timeout ); // Create pathresolver table routing_switch->pathresolver = create_pathresolver(); // Create forwarding database routing_switch->fdb = create_fdb(); // Initialize port database routing_switch->switches = create_ports( &routing_switch->switches ); // Initialize libraries init_libtopology( topology_service ); // Ask topology manager to notify any topology change events. // after_subscribed() will be called subscribe_topology( after_subscribed, routing_switch ); // Initialize authenticator init_authenticator( options->authorized_host_db ); // Initialize redirector init_redirector(); return routing_switch; }