Lines Matching full:tunnel

69 /* Fallback tunnel: no source, no destination, no key, no options
71 Tunnel hash table:
73 it will match only tunnel with the same key; if it is not present,
74 it will match only keyless tunnel.
77 will match fallback tunnel.
78 Given src, dst and key, find appropriate for input tunnel.
237 struct ip_tunnel *tunnel; in __ip_tunnel_create() local
263 tunnel = netdev_priv(dev); in __ip_tunnel_create()
264 tunnel->parms = *parms; in __ip_tunnel_create()
265 tunnel->net = net; in __ip_tunnel_create()
282 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_bind_dev() local
286 int t_hlen = tunnel->hlen + sizeof(struct iphdr); in ip_tunnel_bind_dev()
288 iph = &tunnel->parms.iph; in ip_tunnel_bind_dev()
296 iph->saddr, tunnel->parms.o_key, in ip_tunnel_bind_dev()
298 tunnel->parms.link, tunnel->fwmark, 0, 0); in ip_tunnel_bind_dev()
299 rt = ip_route_output_key(tunnel->net, &fl4); in ip_tunnel_bind_dev()
308 dst_cache_reset(&tunnel->dst_cache); in ip_tunnel_bind_dev()
311 if (!tdev && tunnel->parms.link) in ip_tunnel_bind_dev()
312 tdev = __dev_get_by_index(tunnel->net, tunnel->parms.link); in ip_tunnel_bind_dev()
376 int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, in ip_tunnel_rcv() argument
385 DEV_STATS_INC(tunnel->dev, multicast); in ip_tunnel_rcv()
390 if (test_bit(IP_TUNNEL_CSUM_BIT, tunnel->parms.i_flags) != in ip_tunnel_rcv()
392 DEV_STATS_INC(tunnel->dev, rx_crc_errors); in ip_tunnel_rcv()
393 DEV_STATS_INC(tunnel->dev, rx_errors); in ip_tunnel_rcv()
397 if (test_bit(IP_TUNNEL_SEQ_BIT, tunnel->parms.i_flags)) { in ip_tunnel_rcv()
399 (tunnel->i_seqno && (s32)(ntohl(tpi->seq) - tunnel->i_seqno) < 0)) { in ip_tunnel_rcv()
400 DEV_STATS_INC(tunnel->dev, rx_fifo_errors); in ip_tunnel_rcv()
401 DEV_STATS_INC(tunnel->dev, rx_errors); in ip_tunnel_rcv()
404 tunnel->i_seqno = ntohl(tpi->seq) + 1; in ip_tunnel_rcv()
413 skb_set_network_header(skb, (tunnel->dev->type == ARPHRD_ETHER) ? ETH_HLEN : 0); in ip_tunnel_rcv()
416 DEV_STATS_INC(tunnel->dev, rx_length_errors); in ip_tunnel_rcv()
417 DEV_STATS_INC(tunnel->dev, rx_errors); in ip_tunnel_rcv()
428 DEV_STATS_INC(tunnel->dev, rx_frame_errors); in ip_tunnel_rcv()
429 DEV_STATS_INC(tunnel->dev, rx_errors); in ip_tunnel_rcv()
434 dev_sw_netstats_rx_add(tunnel->dev, skb->len); in ip_tunnel_rcv()
435 skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(tunnel->dev))); in ip_tunnel_rcv()
437 if (tunnel->dev->type == ARPHRD_ETHER) { in ip_tunnel_rcv()
438 skb->protocol = eth_type_trans(skb, tunnel->dev); in ip_tunnel_rcv()
441 skb->dev = tunnel->dev; in ip_tunnel_rcv()
447 gro_cells_receive(&tunnel->gro_cells, skb); in ip_tunnel_rcv()
516 struct ip_tunnel *tunnel = netdev_priv(dev); in tnl_update_pmtu() local
520 tunnel_hlen = md ? tunnel_hlen : tunnel->hlen; in tnl_update_pmtu()
549 daddr = md ? dst : tunnel->parms.iph.daddr; in tnl_update_pmtu()
587 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_md_tunnel_xmit() local
627 rt = ip_route_output_key(tunnel->net, &fl4); in ip_md_tunnel_xmit()
670 df, !net_eq(tunnel->net, dev_net(dev))); in ip_md_tunnel_xmit()
685 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_xmit() local
700 connected = (tunnel->parms.iph.daddr != 0); in ip_tunnel_xmit()
707 /* NBMA tunnel */ in ip_tunnel_xmit()
776 tunnel->parms.o_key, tos & INET_DSCP_MASK, in ip_tunnel_xmit()
777 dev_net(dev), READ_ONCE(tunnel->parms.link), in ip_tunnel_xmit()
778 tunnel->fwmark, skb_get_hash(skb), 0); in ip_tunnel_xmit()
780 if (ip_tunnel_encap(skb, &tunnel->encap, &protocol, &fl4) < 0) in ip_tunnel_xmit()
789 rt = connected ? dst_cache_get_ip4(&tunnel->dst_cache, in ip_tunnel_xmit()
794 rt = ip_route_output_key(tunnel->net, &fl4); in ip_tunnel_xmit()
804 dst_cache_set_ip4(&tunnel->dst_cache, &rt->dst, in ip_tunnel_xmit()
815 if (payload_protocol == htons(ETH_P_IP) && !tunnel->ignore_df) in ip_tunnel_xmit()
823 if (tunnel->err_count > 0) { in ip_tunnel_xmit()
825 tunnel->err_time + IPTUNNEL_ERR_TIMEO)) { in ip_tunnel_xmit()
826 tunnel->err_count--; in ip_tunnel_xmit()
830 tunnel->err_count = 0; in ip_tunnel_xmit()
847 + rt->dst.header_len + ip_encap_hlen(&tunnel->encap); in ip_tunnel_xmit()
859 df, !net_eq(tunnel->net, dev_net(dev))); in ip_tunnel_xmit()
1069 struct ip_tunnel *tunnel = netdev_priv(dev); in __ip_tunnel_change_mtu() local
1070 int t_hlen = tunnel->hlen + sizeof(struct iphdr); in __ip_tunnel_change_mtu()
1099 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_dev_free() local
1101 gro_cells_destroy(&tunnel->gro_cells); in ip_tunnel_dev_free()
1102 dst_cache_destroy(&tunnel->dst_cache); in ip_tunnel_dev_free()
1107 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_dellink() local
1110 itn = net_generic(tunnel->net, tunnel->ip_tnl_net_id); in ip_tunnel_dellink()
1121 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_get_link_net() local
1123 return READ_ONCE(tunnel->net); in ip_tunnel_get_link_net()
1129 const struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_get_iflink() local
1131 return READ_ONCE(tunnel->parms.link); in ip_tunnel_get_iflink()
1274 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_changelink() local
1275 struct net *net = tunnel->net; in ip_tunnel_changelink()
1276 struct ip_tunnel_net *itn = net_generic(net, tunnel->ip_tnl_net_id); in ip_tunnel_changelink()
1287 t = tunnel; in ip_tunnel_changelink()
1310 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_init() local
1311 struct iphdr *iph = &tunnel->parms.iph; in ip_tunnel_init()
1318 err = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL); in ip_tunnel_init()
1322 err = gro_cells_init(&tunnel->gro_cells, dev); in ip_tunnel_init()
1324 dst_cache_destroy(&tunnel->dst_cache); in ip_tunnel_init()
1328 tunnel->dev = dev; in ip_tunnel_init()
1329 tunnel->net = dev_net(dev); in ip_tunnel_init()
1330 strscpy(tunnel->parms.name, dev->name); in ip_tunnel_init()
1334 if (tunnel->collect_md) in ip_tunnel_init()
1343 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_uninit() local
1344 struct net *net = tunnel->net; in ip_tunnel_uninit()
1347 itn = net_generic(net, tunnel->ip_tnl_net_id); in ip_tunnel_uninit()
1352 dst_cache_reset(&tunnel->dst_cache); in ip_tunnel_uninit()
1359 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_setup() local
1360 tunnel->ip_tnl_net_id = net_id; in ip_tunnel_setup()
1364 MODULE_DESCRIPTION("IPv4 tunnel implementation library");