new_settings.lmi != LMI_CCITT) || 
new_settings.lmi != LMI_CCITT && new_settings.lmi != LMI_CISCO) || 
int hdlc_fr_ioctl(struct net_device *dev, struct ifreq *ifr){	fr_proto __user *fr_s = ifr->ifr_settings.ifs_ifsu.fr;	const size_t size = sizeof(fr_proto);	fr_proto new_settings;	hdlc_device *hdlc = dev_to_hdlc(dev);	fr_proto_pvc pvc;	int result;	switch (ifr->ifr_settings.type) {	case IF_GET_PROTO:		ifr->ifr_settings.type = IF_PROTO_FR;		if (ifr->ifr_settings.size < size) {			ifr->ifr_settings.size = size; /* data size wanted */			return -ENOBUFS;		}		if (copy_to_user(fr_s, &hdlc->state.fr.settings, size))			return -EFAULT;		return 0;	case IF_PROTO_FR:		if(!capable(CAP_NET_ADMIN))			return -EPERM;		if(dev->flags & IFF_UP)			return -EBUSY;		if (copy_from_user(&new_settings, fr_s, size))			return -EFAULT;		if (new_settings.lmi == LMI_DEFAULT)			new_settings.lmi = LMI_ANSI;		if ((new_settings.lmi != LMI_NONE &&		     new_settings.lmi != LMI_ANSI &&		     new_settings.lmi != LMI_CCITT) ||		    new_settings.t391 < 1 ||		    new_settings.t392 < 2 ||		    new_settings.n391 < 1 ||		    new_settings.n392 < 1 ||		    new_settings.n393 < new_settings.n392 ||		    new_settings.n393 > 32 ||		    (new_settings.dce != 0 &&		     new_settings.dce != 1))			return -EINVAL;		result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT);		if (result)			return result;		if (hdlc->proto.id != IF_PROTO_FR) {			hdlc_proto_detach(hdlc);			hdlc->state.fr.first_pvc = NULL;			hdlc->state.fr.dce_pvc_count = 0;		}		memcpy(&hdlc->state.fr.settings, &new_settings, size);		memset(&hdlc->proto, 0, sizeof(hdlc->proto));		hdlc->proto.close = fr_close;		hdlc->proto.start = fr_start;		hdlc->proto.stop = fr_stop;		hdlc->proto.detach = fr_destroy;		hdlc->proto.netif_rx = fr_rx;		hdlc->proto.id = IF_PROTO_FR;		dev->hard_start_xmit = hdlc->xmit;		dev->hard_header = NULL;		dev->type = ARPHRD_FRAD;		dev->flags = IFF_POINTOPOINT | IFF_NOARP;		dev->addr_len = 0;		return 0;	case IF_PROTO_FR_ADD_PVC:	case IF_PROTO_FR_DEL_PVC:	case IF_PROTO_FR_ADD_ETH_PVC:	case IF_PROTO_FR_DEL_ETH_PVC:		if(!capable(CAP_NET_ADMIN))			return -EPERM;		if (copy_from_user(&pvc, ifr->ifr_settings.ifs_ifsu.fr_pvc,				   sizeof(fr_proto_pvc)))			return -EFAULT;		if (pvc.dlci <= 0 || pvc.dlci >= 1024)			return -EINVAL;	/* Only 10 bits, DLCI 0 reserved */		if (ifr->ifr_settings.type == IF_PROTO_FR_ADD_ETH_PVC ||		    ifr->ifr_settings.type == IF_PROTO_FR_DEL_ETH_PVC)			result = ARPHRD_ETHER; /* bridged Ethernet device */		else			result = ARPHRD_DLCI;		if (ifr->ifr_settings.type == IF_PROTO_FR_ADD_PVC ||		    ifr->ifr_settings.type == IF_PROTO_FR_ADD_ETH_PVC)			return fr_add_pvc(dev, pvc.dlci, result);		else			return fr_del_pvc(hdlc, pvc.dlci, result);	}	return -EINVAL;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b3dd65f958354226275522b5a64157834bdc5415/hdlc_fr.c/clean/drivers/net/wan/hdlc_fr.c