}
METHOD(charonservice_t, bypass_socket, bool,
- private_charonservice_t *this, int fd, int family)
+ private_charonservice_t *this, int fd, bool track_fd)
{
if (fd >= 0)
{
- this->sockets->insert_last(this->sockets, (void*)(intptr_t)fd);
+ if (track_fd)
+ {
+ this->sockets->insert_last(this->sockets, (void*)(intptr_t)fd);
+ }
return bypass_single_socket(this, fd);
}
this->sockets->invoke_function(this->sockets, bypass_single_socket_cb, this);
* Install a bypass policy for the given socket using the protect() Method
* of the Android VpnService interface.
*
- * Use -1 as fd to re-bypass previously bypassed sockets.
+ * If track_fd is TRUE, the fd is kept track of. Use -1 as fd to re-bypass
+ * all of those sockets.
*
* @param fd socket file descriptor
- * @param family socket protocol family
+ * @param track_fd TRUE to keep track of fd
* @return TRUE if operation successful
*/
- bool (*bypass_socket)(charonservice_t *this, int fd, int family);
+ bool (*bypass_socket)(charonservice_t *this, int fd, bool track_fd);
/**
* Get a list of trusted certificates via JNI
METHOD(kernel_ipsec_t, bypass_socket, bool,
private_kernel_android_ipsec_t *this, int fd, int family)
{
- return charonservice->bypass_socket(charonservice, fd, family);
+ return charonservice->bypass_socket(charonservice, fd, TRUE);
}
METHOD(kernel_ipsec_t, enable_udp_decap, bool,
static job_requeue_t roam_event()
{
/* this will fail if no connection is up */
- charonservice->bypass_socket(charonservice, -1, 0);
+ charonservice->bypass_socket(charonservice, -1, FALSE);
charon->kernel->roam(charon->kernel, TRUE);
return JOB_REQUEUE_NONE;
}
strerror(errno));
return NULL;
}
- charonservice->bypass_socket(charonservice, skt, dst->get_family(dst));
+ charonservice->bypass_socket(charonservice, skt, FALSE);
if (connect(skt, dst->get_sockaddr(dst), addrlen) < 0)
{