void tun_init() { setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */ slip_init(); if(use_raw_ethernet) { tunfd = eth_alloc(slip_config_tundev); } else { tunfd = tun_alloc(slip_config_tundev); } if(tunfd == -1) err(1, "main: open"); select_set_callback(tunfd, &tun_select_callback); printf("opened device ``/dev/%s''\n", slip_config_tundev); atexit(cleanup); signal(SIGHUP, sigcleanup); signal(SIGTERM, sigcleanup); signal(SIGINT, sigcleanup); ifconf(slip_config_tundev); if(use_raw_ethernet) { fetch_mac(tunfd, slip_config_tundev, ð_mac_addr); PRINTF("Eth MAC address : "); PRINTETHADDR(ð_mac_addr); PRINTF("\n"); eth_mac_addr_ready = 1; } }
/*---------------------------------------------------------------------------*/ void eth_dev_init() { if(sixlbr_config_use_raw_ethernet) { eth_fd = eth_alloc(sixlbr_config_eth_device); } else { eth_fd = tap_alloc(sixlbr_config_eth_device); } if(eth_fd == -1) { LOG6LBR_FATAL("eth_dev_init() : %s\n", strerror(errno)); exit(1); } select_set_callback(eth_fd, ð_select_callback); LOG6LBR_INFO("opened device /dev/%s\n", sixlbr_config_eth_device); atexit(cleanup); signal(SIGHUP, sigcleanup); signal(SIGTERM, sigcleanup); signal(SIGINT, sigcleanup); ifconf(sixlbr_config_eth_device); #if !CETIC_6LBR_ONE_ITF if(sixlbr_config_use_raw_ethernet) { #endif fetch_mac(eth_fd, sixlbr_config_eth_device, ð_mac_addr); LOG6LBR_ETHADDR(INFO, ð_mac_addr, "Eth MAC address : "); eth_mac_addr_ready = 1; #if !CETIC_6LBR_ONE_ITF } #endif }
void tun_init() { setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */ if(use_raw_ethernet) { tunfd = eth_alloc(slip_config_tundev); } else { tunfd = tun_alloc(slip_config_tundev); } if(tunfd == -1) { LOG6LBR_FATAL("tun_alloc() : %s\n", strerror(errno)); exit(1); } select_set_callback(tunfd, &tun_select_callback); LOG6LBR_INFO("opened device /dev/%s\n", slip_config_tundev); atexit(cleanup); signal(SIGHUP, sigcleanup); signal(SIGTERM, sigcleanup); signal(SIGINT, sigcleanup); ifconf(slip_config_tundev); #if !CETIC_6LBR_ONE_ITF if(use_raw_ethernet) { #endif fetch_mac(tunfd, slip_config_tundev, ð_mac_addr); LOG6LBR_ETHADDR(INFO, ð_mac_addr, "Eth MAC address : "); eth_mac_addr_ready = 1; #if !CETIC_6LBR_ONE_ITF } #endif }