|
|
@@ -474,81 +474,6 @@ int client_event_loop()
|
|
|
conn_info.prepare();
|
|
|
packet_info_t &send_info=conn_info.raw_info.send_info;
|
|
|
packet_info_t &recv_info=conn_info.raw_info.recv_info;
|
|
|
-
|
|
|
- if(lower_level)
|
|
|
- {
|
|
|
- if(lower_level_manual)
|
|
|
- {
|
|
|
- int index;
|
|
|
- init_ifindex(if_name,index);
|
|
|
- //init_ifindex(if_name);
|
|
|
- memset(&send_info.addr_ll, 0, sizeof(send_info.addr_ll));
|
|
|
- send_info.addr_ll.sll_family = AF_PACKET;
|
|
|
- send_info.addr_ll.sll_ifindex =index;
|
|
|
- send_info.addr_ll.sll_halen = ETHER_ADDR_LEN;
|
|
|
- send_info.addr_ll.sll_protocol = htons(ETH_P_IP);
|
|
|
- memcpy(&send_info.addr_ll.sll_addr, dest_hw_addr, ETHER_ADDR_LEN);
|
|
|
- mylog(log_info,"we are running at lower-level (manual) mode\n");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- u32_t dest_ip;
|
|
|
- string if_name_string;
|
|
|
- string hw_string;
|
|
|
-
|
|
|
- if(retry_on_error==0)
|
|
|
- {
|
|
|
- if(find_lower_level_info(remote_ip_uint32,dest_ip,if_name_string,hw_string)!=0)
|
|
|
- {
|
|
|
- mylog(log_fatal,"auto detect lower-level info failed for %s,specific it manually\n",remote_ip);
|
|
|
- myexit(-1);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- int ok=0;
|
|
|
- while(!ok)
|
|
|
- {
|
|
|
- if(find_lower_level_info(remote_ip_uint32,dest_ip,if_name_string,hw_string)!=0)
|
|
|
- {
|
|
|
- mylog(log_warn,"auto detect lower-level info failed for %s,retry in %d seconds\n",remote_ip,retry_on_error_interval);
|
|
|
- sleep(retry_on_error_interval);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ok=1;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- mylog(log_info,"we are running at lower-level (auto) mode,%s %s %s\n",my_ntoa(dest_ip),if_name_string.c_str(),hw_string.c_str());
|
|
|
-
|
|
|
- u32_t hw[6];
|
|
|
- memset(hw, 0, sizeof(hw));
|
|
|
- sscanf(hw_string.c_str(), "%x:%x:%x:%x:%x:%x",&hw[0], &hw[1], &hw[2],
|
|
|
- &hw[3], &hw[4], &hw[5]);
|
|
|
-
|
|
|
- mylog(log_warn,
|
|
|
- "make sure this is correct: if_name=<%s> dest_mac_adress=<%02x:%02x:%02x:%02x:%02x:%02x> \n",
|
|
|
- if_name_string.c_str(), hw[0], hw[1], hw[2], hw[3], hw[4], hw[5]);
|
|
|
- for (int i = 0; i < 6; i++) {
|
|
|
- dest_hw_addr[i] = uint8_t(hw[i]);
|
|
|
- }
|
|
|
-
|
|
|
- //mylog(log_fatal,"--lower-level auto for client hasnt been implemented\n");
|
|
|
- int index;
|
|
|
- init_ifindex(if_name_string.c_str(),index);
|
|
|
-
|
|
|
- memset(&send_info.addr_ll, 0, sizeof(send_info.addr_ll));
|
|
|
- send_info.addr_ll.sll_family = AF_PACKET;
|
|
|
- send_info.addr_ll.sll_ifindex = index;
|
|
|
- send_info.addr_ll.sll_halen = ETHER_ADDR_LEN;
|
|
|
- send_info.addr_ll.sll_protocol = htons(ETH_P_IP);
|
|
|
- memcpy(&send_info.addr_ll.sll_addr, dest_hw_addr, ETHER_ADDR_LEN);
|
|
|
- //mylog(log_info,"we are running at lower-level (manual) mode\n");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
if(source_ip_uint32==0)
|
|
|
{
|