if (opt) kfree(opt); 
kfree(opt); 
ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev){	struct ip6_tnl *t = (struct ip6_tnl *) dev->priv;	struct net_device_stats *stats = &t->stat;	struct ipv6hdr *ipv6h = skb->nh.ipv6h;	struct ipv6_txoptions *opt = NULL;	int encap_limit = -1;	__u16 offset;	struct flowi fl;	struct dst_entry *dst;	struct net_device *tdev;	int mtu;	int max_headroom = sizeof(struct ipv6hdr);	u8 proto;	int err;	int pkt_len;	int dsfield;	if (t->recursion++) {		stats->collisions++;		goto tx_err;	}	if (skb->protocol != htons(ETH_P_IPV6) ||	    !(t->parms.flags & IP6_TNL_F_CAP_XMIT) ||	    ip6ip6_tnl_addr_conflict(t, ipv6h)) {		goto tx_err;	}	if ((offset = parse_tlv_tnl_enc_lim(skb, skb->nh.raw)) > 0) {		struct ipv6_tlv_tnl_enc_lim *tel;		tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->nh.raw[offset];		if (tel->encap_limit == 0) {			icmpv6_send(skb, ICMPV6_PARAMPROB,				    ICMPV6_HDR_FIELD, offset + 2, skb->dev);			goto tx_err;		}		encap_limit = tel->encap_limit - 1;	} else if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) {		encap_limit = t->parms.encap_limit;	}	memcpy(&fl, &t->fl, sizeof (fl));	proto = fl.proto;	dsfield = ipv6_get_dsfield(ipv6h);	if ((t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS))		fl.fl6_flowlabel |= (*(__u32 *) ipv6h & IPV6_TCLASS_MASK);	if ((t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL))		fl.fl6_flowlabel |= (*(__u32 *) ipv6h & IPV6_FLOWLABEL_MASK);	if (encap_limit >= 0 && (opt = create_tel(encap_limit)) == NULL)		goto tx_err;	if ((dst = ip6_tnl_dst_check(t)) != NULL)		dst_hold(dst);	else {		dst = ip6_route_output(NULL, &fl);		if (dst->error || xfrm_lookup(&dst, &fl, NULL, 0) < 0)			goto tx_err_link_failure;	}	tdev = dst->dev;	if (tdev == dev) {		stats->collisions++;		if (net_ratelimit())			printk(KERN_WARNING 			       "%s: Local routing loop detected!\n",			       t->parms.name);		goto tx_err_dst_release;	}	mtu = dst_mtu(dst) - sizeof (*ipv6h);	if (opt) {		max_headroom += 8;		mtu -= 8;	}	if (mtu < IPV6_MIN_MTU)		mtu = IPV6_MIN_MTU;	if (skb->dst && mtu < dst_mtu(skb->dst)) {		struct rt6_info *rt = (struct rt6_info *) skb->dst;		rt->rt6i_flags |= RTF_MODIFIED;		rt->u.dst.metrics[RTAX_MTU-1] = mtu;	}	if (skb->len > mtu) {		icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, dev);		goto tx_err_dst_release;	}	/*	 * Okay, now see if we can stuff it in the buffer as-is.	 */	max_headroom += LL_RESERVED_SPACE(tdev);		if (skb_headroom(skb) < max_headroom || 	    skb_cloned(skb) || skb_shared(skb)) {		struct sk_buff *new_skb;				if (!(new_skb = skb_realloc_headroom(skb, max_headroom)))			goto tx_err_dst_release;		if (skb->sk)			skb_set_owner_w(new_skb, skb->sk);		kfree_skb(skb);		skb = new_skb;	}	dst_release(skb->dst);	skb->dst = dst_clone(dst);	skb->h.raw = skb->nh.raw;	if (opt)		ipv6_push_nfrag_opts(skb, opt, &proto, NULL);	skb->nh.raw = skb_push(skb, sizeof(struct ipv6hdr));	ipv6h = skb->nh.ipv6h;	*(u32*)ipv6h = fl.fl6_flowlabel | htonl(0x60000000);	dsfield = INET_ECN_encapsulate(0, dsfield);	ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield);	ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));	ipv6h->hop_limit = t->parms.hop_limit;	ipv6h->nexthdr = proto;	ipv6_addr_copy(&ipv6h->saddr, &fl.fl6_src);	ipv6_addr_copy(&ipv6h->daddr, &fl.fl6_dst);	nf_reset(skb);	pkt_len = skb->len;	err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, 		      skb->dst->dev, dst_output);	if (err == NET_XMIT_SUCCESS || err == NET_XMIT_CN) {		stats->tx_bytes += pkt_len;		stats->tx_packets++;	} else {		stats->tx_errors++;		stats->tx_aborted_errors++;	}	ip6_tnl_dst_store(t, dst);	if (opt)		kfree(opt);	t->recursion--;	return 0;tx_err_link_failure:	stats->tx_carrier_errors++;	dst_link_failure(skb);tx_err_dst_release:	dst_release(dst);	if (opt)		kfree(opt);tx_err:	stats->tx_errors++;	stats->tx_dropped++;	kfree_skb(skb);	t->recursion--;	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/a51482bde22f99c63fbbb57d5d46cc666384e379/ip6_tunnel.c/clean/net/ipv6/ip6_tunnel.c