case IPV6_TCLASS: val = np->tclass; break;  case IPV6_RECVTCLASS: val = np->rxopt.bits.rxtclass; break;  
int ipv6_getsockopt(struct sock *sk, int level, int optname,		    char __user *optval, int __user *optlen){	struct ipv6_pinfo *np = inet6_sk(sk);	int len;	int val;	if (level == SOL_IP && sk->sk_type != SOCK_RAW)		return udp_prot.getsockopt(sk, level, optname, optval, optlen);	if(level!=SOL_IPV6)		return -ENOPROTOOPT;	if (get_user(len, optlen))		return -EFAULT;	switch (optname) {	case IPV6_ADDRFORM:		if (sk->sk_protocol != IPPROTO_UDP &&		    sk->sk_protocol != IPPROTO_TCP)			return -EINVAL;		if (sk->sk_state != TCP_ESTABLISHED)			return -ENOTCONN;		val = sk->sk_family;		break;	case MCAST_MSFILTER:	{		struct group_filter gsf;		int err;		if (len < GROUP_FILTER_SIZE(0))			return -EINVAL;		if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0)))			return -EFAULT;		lock_sock(sk);		err = ip6_mc_msfget(sk, &gsf,			(struct group_filter __user *)optval, optlen);		release_sock(sk);		return err;	}	case IPV6_2292PKTOPTIONS:	{		struct msghdr msg;		struct sk_buff *skb;		if (sk->sk_type != SOCK_STREAM)			return -ENOPROTOOPT;		msg.msg_control = optval;		msg.msg_controllen = len;		msg.msg_flags = 0;		lock_sock(sk);		skb = np->pktoptions;		if (skb)			atomic_inc(&skb->users);		release_sock(sk);		if (skb) {			int err = datagram_recv_ctl(sk, &msg, skb);			kfree_skb(skb);			if (err)				return err;		} else {			if (np->rxopt.bits.rxinfo) {				struct in6_pktinfo src_info;				src_info.ipi6_ifindex = np->mcast_oif;				ipv6_addr_copy(&src_info.ipi6_addr, &np->daddr);				put_cmsg(&msg, SOL_IPV6, IPV6_PKTINFO, sizeof(src_info), &src_info);			}			if (np->rxopt.bits.rxhlim) {				int hlim = np->mcast_hops;				put_cmsg(&msg, SOL_IPV6, IPV6_HOPLIMIT, sizeof(hlim), &hlim);			}			if (np->rxopt.bits.rxoinfo) {				struct in6_pktinfo src_info;				src_info.ipi6_ifindex = np->mcast_oif;				ipv6_addr_copy(&src_info.ipi6_addr, &np->daddr);				put_cmsg(&msg, SOL_IPV6, IPV6_2292PKTINFO, sizeof(src_info), &src_info);			}			if (np->rxopt.bits.rxohlim) {				int hlim = np->mcast_hops;				put_cmsg(&msg, SOL_IPV6, IPV6_2292HOPLIMIT, sizeof(hlim), &hlim);			}		}		len -= msg.msg_controllen;		return put_user(len, optlen);	}	case IPV6_MTU:	{		struct dst_entry *dst;		val = 0;			lock_sock(sk);		dst = sk_dst_get(sk);		if (dst) {			val = dst_mtu(dst);			dst_release(dst);		}		release_sock(sk);		if (!val)			return -ENOTCONN;		break;	}	case IPV6_V6ONLY:		val = np->ipv6only;		break;	case IPV6_RECVPKTINFO:		val = np->rxopt.bits.rxinfo;		break;	case IPV6_2292PKTINFO:		val = np->rxopt.bits.rxoinfo;		break;	case IPV6_RECVHOPLIMIT:		val = np->rxopt.bits.rxhlim;		break;	case IPV6_2292HOPLIMIT:		val = np->rxopt.bits.rxohlim;		break;	case IPV6_RECVRTHDR:		val = np->rxopt.bits.srcrt;		break;	case IPV6_2292RTHDR:		val = np->rxopt.bits.osrcrt;		break;	case IPV6_HOPOPTS:	case IPV6_RTHDRDSTOPTS:	case IPV6_RTHDR:	case IPV6_DSTOPTS:	{		lock_sock(sk);		len = ipv6_getsockopt_sticky(sk, np->opt->hopopt,					     optval, len);		release_sock(sk);		return put_user(len, optlen);	}	case IPV6_RECVHOPOPTS:		val = np->rxopt.bits.hopopts;		break;	case IPV6_2292HOPOPTS:		val = np->rxopt.bits.ohopopts;		break;	case IPV6_RECVDSTOPTS:		val = np->rxopt.bits.dstopts;		break;	case IPV6_2292DSTOPTS:		val = np->rxopt.bits.odstopts;		break;	case IPV6_FLOWINFO:		val = np->rxopt.bits.rxflow;		break;	case IPV6_UNICAST_HOPS:		val = np->hop_limit;		break;	case IPV6_MULTICAST_HOPS:		val = np->mcast_hops;		break;	case IPV6_MULTICAST_LOOP:		val = np->mc_loop;		break;	case IPV6_MULTICAST_IF:		val = np->mcast_oif;		break;	case IPV6_MTU_DISCOVER:		val = np->pmtudisc;		break;	case IPV6_RECVERR:		val = np->recverr;		break;	case IPV6_FLOWINFO_SEND:		val = np->sndflow;		break;	default:#ifdef CONFIG_NETFILTER		lock_sock(sk);		val = nf_getsockopt(sk, PF_INET6, optname, optval, 				    &len);		release_sock(sk);		if (val >= 0)			val = put_user(len, optlen);		return val;#else		return -EINVAL;#endif	}	len = min_t(unsigned int, sizeof(int), len);	if(put_user(len, optlen))		return -EFAULT;	if(copy_to_user(optval,&val,len))		return -EFAULT;	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/41a1f8ea4fbfcdc4232f023732584aae2220de31/ipv6_sockglue.c/clean/net/ipv6/ipv6_sockglue.c