Lines Matching full:tunnel
72 /* Fallback tunnel: no source, no destination, no key, no options
74 Tunnel hash table:
76 it will match only tunnel with the same key; if it is not present,
77 it will match only keyless tunnel.
80 will match fallback tunnel.
81 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()
297 RT_TOS(iph->tos), tunnel->parms.link, in ip_tunnel_bind_dev()
298 tunnel->fwmark, 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()
362 int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, in ip_tunnel_rcv() argument
371 tunnel->dev->stats.multicast++; in ip_tunnel_rcv()
376 if ((!(tpi->flags&TUNNEL_CSUM) && (tunnel->parms.i_flags&TUNNEL_CSUM)) || in ip_tunnel_rcv()
377 ((tpi->flags&TUNNEL_CSUM) && !(tunnel->parms.i_flags&TUNNEL_CSUM))) { in ip_tunnel_rcv()
378 tunnel->dev->stats.rx_crc_errors++; in ip_tunnel_rcv()
379 tunnel->dev->stats.rx_errors++; in ip_tunnel_rcv()
383 if (tunnel->parms.i_flags&TUNNEL_SEQ) { in ip_tunnel_rcv()
385 (tunnel->i_seqno && (s32)(ntohl(tpi->seq) - tunnel->i_seqno) < 0)) { in ip_tunnel_rcv()
386 tunnel->dev->stats.rx_fifo_errors++; in ip_tunnel_rcv()
387 tunnel->dev->stats.rx_errors++; in ip_tunnel_rcv()
390 tunnel->i_seqno = ntohl(tpi->seq) + 1; in ip_tunnel_rcv()
399 skb_set_network_header(skb, (tunnel->dev->type == ARPHRD_ETHER) ? ETH_HLEN : 0); in ip_tunnel_rcv()
402 DEV_STATS_INC(tunnel->dev, rx_length_errors); in ip_tunnel_rcv()
403 DEV_STATS_INC(tunnel->dev, rx_errors); in ip_tunnel_rcv()
414 ++tunnel->dev->stats.rx_frame_errors; in ip_tunnel_rcv()
415 ++tunnel->dev->stats.rx_errors; in ip_tunnel_rcv()
420 dev_sw_netstats_rx_add(tunnel->dev, skb->len); in ip_tunnel_rcv()
421 skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(tunnel->dev))); in ip_tunnel_rcv()
423 if (tunnel->dev->type == ARPHRD_ETHER) { in ip_tunnel_rcv()
424 skb->protocol = eth_type_trans(skb, tunnel->dev); in ip_tunnel_rcv()
427 skb->dev = tunnel->dev; in ip_tunnel_rcv()
433 gro_cells_receive(&tunnel->gro_cells, skb); in ip_tunnel_rcv()
502 struct ip_tunnel *tunnel = netdev_priv(dev); in tnl_update_pmtu() local
506 tunnel_hlen = md ? tunnel_hlen : tunnel->hlen; in tnl_update_pmtu()
535 daddr = md ? dst : tunnel->parms.iph.daddr; in tnl_update_pmtu()
573 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_md_tunnel_xmit() local
601 if (tunnel->encap.type != TUNNEL_ENCAP_NONE) in ip_md_tunnel_xmit()
608 rt = ip_route_output_key(tunnel->net, &fl4); in ip_md_tunnel_xmit()
651 df, !net_eq(tunnel->net, dev_net(dev))); in ip_md_tunnel_xmit()
666 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_xmit() local
680 connected = (tunnel->parms.iph.daddr != 0); in ip_tunnel_xmit()
686 /* NBMA tunnel */ in ip_tunnel_xmit()
756 tunnel->parms.o_key, RT_TOS(tos), tunnel->parms.link, in ip_tunnel_xmit()
757 tunnel->fwmark, skb_get_hash(skb)); in ip_tunnel_xmit()
759 if (ip_tunnel_encap(skb, tunnel, &protocol, &fl4) < 0) in ip_tunnel_xmit()
768 rt = connected ? dst_cache_get_ip4(&tunnel->dst_cache, in ip_tunnel_xmit()
773 rt = ip_route_output_key(tunnel->net, &fl4); in ip_tunnel_xmit()
783 dst_cache_set_ip4(&tunnel->dst_cache, &rt->dst, in ip_tunnel_xmit()
794 if (skb->protocol == htons(ETH_P_IP) && !tunnel->ignore_df) in ip_tunnel_xmit()
802 if (tunnel->err_count > 0) { in ip_tunnel_xmit()
804 tunnel->err_time + IPTUNNEL_ERR_TIMEO)) { in ip_tunnel_xmit()
805 tunnel->err_count--; in ip_tunnel_xmit()
809 tunnel->err_count = 0; in ip_tunnel_xmit()
826 + rt->dst.header_len + ip_encap_hlen(&tunnel->encap); in ip_tunnel_xmit()
838 df, !net_eq(tunnel->net, dev_net(dev))); in ip_tunnel_xmit()
1004 struct ip_tunnel *tunnel = netdev_priv(dev); in __ip_tunnel_change_mtu() local
1005 int t_hlen = tunnel->hlen + sizeof(struct iphdr); in __ip_tunnel_change_mtu()
1034 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_dev_free() local
1036 gro_cells_destroy(&tunnel->gro_cells); in ip_tunnel_dev_free()
1037 dst_cache_destroy(&tunnel->dst_cache); in ip_tunnel_dev_free()
1043 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_dellink() local
1046 itn = net_generic(tunnel->net, tunnel->ip_tnl_net_id); in ip_tunnel_dellink()
1057 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_get_link_net() local
1059 return tunnel->net; in ip_tunnel_get_link_net()
1065 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_get_iflink() local
1067 return tunnel->parms.link; in ip_tunnel_get_iflink()
1212 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_changelink() local
1213 struct net *net = tunnel->net; in ip_tunnel_changelink()
1214 struct ip_tunnel_net *itn = net_generic(net, tunnel->ip_tnl_net_id); in ip_tunnel_changelink()
1225 t = tunnel; in ip_tunnel_changelink()
1248 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_init() local
1249 struct iphdr *iph = &tunnel->parms.iph; in ip_tunnel_init()
1258 err = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL); in ip_tunnel_init()
1264 err = gro_cells_init(&tunnel->gro_cells, dev); in ip_tunnel_init()
1266 dst_cache_destroy(&tunnel->dst_cache); in ip_tunnel_init()
1271 tunnel->dev = dev; in ip_tunnel_init()
1272 tunnel->net = dev_net(dev); in ip_tunnel_init()
1273 strcpy(tunnel->parms.name, dev->name); in ip_tunnel_init()
1277 if (tunnel->collect_md) in ip_tunnel_init()
1285 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_uninit() local
1286 struct net *net = tunnel->net; in ip_tunnel_uninit()
1289 itn = net_generic(net, tunnel->ip_tnl_net_id); in ip_tunnel_uninit()
1294 dst_cache_reset(&tunnel->dst_cache); in ip_tunnel_uninit()
1301 struct ip_tunnel *tunnel = netdev_priv(dev); in ip_tunnel_setup() local
1302 tunnel->ip_tnl_net_id = net_id; in ip_tunnel_setup()