Lines Matching refs:tunnel
72 /* Fallback tunnel: no source, no destination, no key, no options
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;
263 tunnel = netdev_priv(dev);
264 tunnel->parms = *parms;
265 tunnel->net = net;
282 struct ip_tunnel *tunnel = netdev_priv(dev);
286 int t_hlen = tunnel->hlen + sizeof(struct iphdr);
288 iph = &tunnel->parms.iph;
296 iph->saddr, tunnel->parms.o_key,
298 tunnel->parms.link, tunnel->fwmark, 0, 0);
299 rt = ip_route_output_key(tunnel->net, &fl4);
308 dst_cache_reset(&tunnel->dst_cache);
311 if (!tdev && tunnel->parms.link)
312 tdev = __dev_get_by_index(tunnel->net, tunnel->parms.link);
376 int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb,
385 DEV_STATS_INC(tunnel->dev, multicast);
390 if ((!(tpi->flags&TUNNEL_CSUM) && (tunnel->parms.i_flags&TUNNEL_CSUM)) ||
391 ((tpi->flags&TUNNEL_CSUM) && !(tunnel->parms.i_flags&TUNNEL_CSUM))) {
392 DEV_STATS_INC(tunnel->dev, rx_crc_errors);
393 DEV_STATS_INC(tunnel->dev, rx_errors);
397 if (tunnel->parms.i_flags&TUNNEL_SEQ) {
399 (tunnel->i_seqno && (s32)(ntohl(tpi->seq) - tunnel->i_seqno) < 0)) {
400 DEV_STATS_INC(tunnel->dev, rx_fifo_errors);
401 DEV_STATS_INC(tunnel->dev, rx_errors);
404 tunnel->i_seqno = ntohl(tpi->seq) + 1;
413 skb_set_network_header(skb, (tunnel->dev->type == ARPHRD_ETHER) ? ETH_HLEN : 0);
416 DEV_STATS_INC(tunnel->dev, rx_length_errors);
417 DEV_STATS_INC(tunnel->dev, rx_errors);
428 DEV_STATS_INC(tunnel->dev, rx_frame_errors);
429 DEV_STATS_INC(tunnel->dev, rx_errors);
434 dev_sw_netstats_rx_add(tunnel->dev, skb->len);
435 skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(tunnel->dev)));
437 if (tunnel->dev->type == ARPHRD_ETHER) {
438 skb->protocol = eth_type_trans(skb, tunnel->dev);
441 skb->dev = tunnel->dev;
447 gro_cells_receive(&tunnel->gro_cells, skb);
516 struct ip_tunnel *tunnel = netdev_priv(dev);
520 tunnel_hlen = md ? tunnel_hlen : tunnel->hlen;
549 daddr = md ? dst : tunnel->parms.iph.daddr;
587 struct ip_tunnel *tunnel = netdev_priv(dev);
627 rt = ip_route_output_key(tunnel->net, &fl4);
670 df, !net_eq(tunnel->net, dev_net(dev)));
685 struct ip_tunnel *tunnel = netdev_priv(dev);
700 connected = (tunnel->parms.iph.daddr != 0);
707 /* NBMA tunnel */
776 tunnel->parms.o_key, RT_TOS(tos),
777 dev_net(dev), tunnel->parms.link,
778 tunnel->fwmark, skb_get_hash(skb), 0);
780 if (ip_tunnel_encap(skb, &tunnel->encap, &protocol, &fl4) < 0)
789 rt = connected ? dst_cache_get_ip4(&tunnel->dst_cache,
794 rt = ip_route_output_key(tunnel->net, &fl4);
804 dst_cache_set_ip4(&tunnel->dst_cache, &rt->dst,
815 if (payload_protocol == htons(ETH_P_IP) && !tunnel->ignore_df)
823 if (tunnel->err_count > 0) {
825 tunnel->err_time + IPTUNNEL_ERR_TIMEO)) {
826 tunnel->err_count--;
830 tunnel->err_count = 0;
847 + rt->dst.header_len + ip_encap_hlen(&tunnel->encap);
859 df, !net_eq(tunnel->net, dev_net(dev)));
1026 struct ip_tunnel *tunnel = netdev_priv(dev);
1027 int t_hlen = tunnel->hlen + sizeof(struct iphdr);
1056 struct ip_tunnel *tunnel = netdev_priv(dev);
1058 gro_cells_destroy(&tunnel->gro_cells);
1059 dst_cache_destroy(&tunnel->dst_cache);
1065 struct ip_tunnel *tunnel = netdev_priv(dev);
1068 itn = net_generic(tunnel->net, tunnel->ip_tnl_net_id);
1079 struct ip_tunnel *tunnel = netdev_priv(dev);
1081 return tunnel->net;
1087 struct ip_tunnel *tunnel = netdev_priv(dev);
1089 return tunnel->parms.link;
1234 struct ip_tunnel *tunnel = netdev_priv(dev);
1235 struct net *net = tunnel->net;
1236 struct ip_tunnel_net *itn = net_generic(net, tunnel->ip_tnl_net_id);
1247 t = tunnel;
1270 struct ip_tunnel *tunnel = netdev_priv(dev);
1271 struct iphdr *iph = &tunnel->parms.iph;
1280 err = dst_cache_init(&tunnel->dst_cache, GFP_KERNEL);
1286 err = gro_cells_init(&tunnel->gro_cells, dev);
1288 dst_cache_destroy(&tunnel->dst_cache);
1293 tunnel->dev = dev;
1294 tunnel->net = dev_net(dev);
1295 strcpy(tunnel->parms.name, dev->name);
1299 if (tunnel->collect_md)
1307 struct ip_tunnel *tunnel = netdev_priv(dev);
1308 struct net *net = tunnel->net;
1311 itn = net_generic(net, tunnel->ip_tnl_net_id);
1316 dst_cache_reset(&tunnel->dst_cache);
1323 struct ip_tunnel *tunnel = netdev_priv(dev);
1324 tunnel->ip_tnl_net_id = net_id;