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