Browse Source

move android arp code to tuntap_android.c

pull/306/head
switch_st 4 years ago
parent
commit
7ceaebade5
  1. 20
      src/edge_utils.c

20
src/edge_utils.c

@ -1498,18 +1498,7 @@ void edge_read_from_tap(n2n_edge_t * eee) {
macstr_t mac_buf; macstr_t mac_buf;
ssize_t len; ssize_t len;
#ifdef __ANDROID_NDK__ len = tuntap_read( &(eee->device), eth_pkt, N2N_PKT_BUF_SIZE );
if(uip_arp_len != 0) {
len = uip_arp_len;
memcpy(eth_pkt, uip_arp_buf, MIN(uip_arp_len, N2N_PKT_BUF_SIZE));
traceEvent(TRACE_DEBUG, "ARP reply packet to send");
} else {
#endif /* #ifdef __ANDROID_NDK__ */
len = tuntap_read( &(eee->device), eth_pkt, N2N_PKT_BUF_SIZE );
#ifdef __ANDROID_NDK__
}
#endif /* #ifdef __ANDROID_NDK__ */
if((len <= 0) || (len > N2N_PKT_BUF_SIZE)) if((len <= 0) || (len > N2N_PKT_BUF_SIZE))
{ {
traceEvent(TRACE_WARNING, "read()=%d [%d/%s]", traceEvent(TRACE_WARNING, "read()=%d [%d/%s]",
@ -1909,13 +1898,6 @@ int run_edge_loop(n2n_edge_t * eee, int *keep_running) {
} }
#endif #endif
#ifdef __ANDROID_NDK__
if(uip_arp_len != 0) {
edge_read_from_tap(eee);
uip_arp_len = 0;
}
#endif /* #ifdef __ANDROID_NDK__ */
if(FD_ISSET(eee->udp_mgmt_sock, &socket_mask)) { if(FD_ISSET(eee->udp_mgmt_sock, &socket_mask)) {
/* Read a cooked socket from the internet socket. Writes on the TAP /* Read a cooked socket from the internet socket. Writes on the TAP
* socket. */ * socket. */

Loading…
Cancel
Save