Home | History | Annotate | Download | only in android-clat

Lines Matching full:tunnel

118  * configures the ipv4 and ipv6 addresses on the tunnel interface
119 * tunnel - tun device data
121 void configure_tun_ip(const struct tun_data *tunnel) {
142 status = add_address(tunnel->device4, AF_INET, &Global_Clatd_Config.ipv4_local_subnet,
151 logmsg(ANDROID_LOG_INFO, "Using IPv4 address %s on %s", addrstr, tunnel->device4);
153 if((status = if_up(tunnel->device4, Global_Clatd_Config.ipv4mtu)) < 0) {
197 * tunnel - tun device data
200 void open_sockets(struct tun_data *tunnel, uint32_t mark) {
215 tunnel->write_fd6 = rawsock;
217 tunnel->read_fd6 = ring_create(tunnel);
218 if (tunnel->read_fd6 < 0) {
225 * tunnel - tun device data
229 int update_clat_ipv6_address(const struct tun_data *tunnel, const char *interface) {
259 del_anycast_address(tunnel->write_fd6, &Global_Clatd_Config.ipv6_local_subnet);
264 add_anycast_address(tunnel->write_fd6, &Global_Clatd_Config.ipv6_local_subnet, interface);
268 if (!configure_packet_socket(tunnel->read_fd6)) {
281 * tunnel - tun device data
284 void configure_interface(const char *uplink_interface, const char *plat_prefix, struct tun_data *tunnel, unsigned net_id) {
311 error = tun_alloc(tunnel->device4, tunnel->fd4);
317 error = set_nonblocking(tunnel->fd4);
323 configure_tun_ip(tunnel);
327 * reads a packet from the tunnel fd and translates it
372 * tunnel - tun device data
374 void event_loop(struct tun_data *tunnel) {
377 { tunnel->read_fd6, POLLIN, 0 },
378 { tunnel->fd4, POLLIN, 0 },
396 ring_read(&tunnel->ring, tunnel->fd4, 0 /* to_ipv6 */);
399 read_packet(tunnel->fd4, tunnel->write_fd6, 1 /* to_ipv6 */);
405 update_clat_ipv6_address(tunnel, Global_Clatd_Config.default_pdp_interface);
437 struct tun_data tunnel;
482 len = snprintf(tunnel.device4, sizeof(tunnel.device4), "%s%s", DEVICEPREFIX, uplink_interface);
483 if (len >= sizeof(tunnel.device4)) {
484 tunnel.device4);
494 open_sockets(&tunnel, mark);
500 tunnel.fd4 = tun_open();
501 if(tunnel.fd4 < 0) {
510 configure_interface(uplink_interface, plat_prefix, &tunnel, net_id);
512 update_clat_ipv6_address(&tunnel, uplink_interface);
520 event_loop(&tunnel);
523 del_anycast_address(tunnel.write_fd6, &Global_Clatd_Config.ipv6_local_subnet);