if (dlci == LMI_DLCI) { if (hdlc->state.fr.settings.lmi == LMI_NONE) goto rx_error; /* LMI packet with no LMI? */  if (data[3] == LMI_PROTO) { if (fr_lmi_recv(ndev, skb)) goto rx_error; else { dev_kfree_skb_any(skb); return NET_RX_SUCCESS; } }  printk(KERN_INFO "%s: Received non-LMI frame with LMI DLCI\n", ndev->name); goto rx_error; 
if ((dlci == LMI_CCITT_ANSI_DLCI && (hdlc->state.fr.settings.lmi == LMI_ANSI || hdlc->state.fr.settings.lmi == LMI_CCITT)) || (dlci == LMI_CISCO_DLCI && hdlc->state.fr.settings.lmi == LMI_CISCO)) { if (fr_lmi_recv(ndev, skb)) goto rx_error; dev_kfree_skb_any(skb); return NET_RX_SUCCESS; 
static int fr_rx(struct sk_buff *skb){	struct net_device *ndev = skb->dev;	hdlc_device *hdlc = dev_to_hdlc(ndev);	fr_hdr *fh = (fr_hdr*)skb->data;	u8 *data = skb->data;	u16 dlci;	pvc_device *pvc;	struct net_device *dev = NULL;	if (skb->len <= 4 || fh->ea1 || data[2] != FR_UI)		goto rx_error;	dlci = q922_to_dlci(skb->data);	if (dlci == LMI_DLCI) {		if (hdlc->state.fr.settings.lmi == LMI_NONE)			goto rx_error; /* LMI packet with no LMI? */		if (data[3] == LMI_PROTO) {			if (fr_lmi_recv(ndev, skb))				goto rx_error;			else {				dev_kfree_skb_any(skb);				return NET_RX_SUCCESS;			}		}		printk(KERN_INFO "%s: Received non-LMI frame with LMI DLCI\n",		       ndev->name);		goto rx_error;	}	pvc = find_pvc(hdlc, dlci);	if (!pvc) {#ifdef DEBUG_PKT		printk(KERN_INFO "%s: No PVC for received frame's DLCI %d\n",		       ndev->name, dlci);#endif		dev_kfree_skb_any(skb);		return NET_RX_DROP;	}	if (pvc->state.fecn != fh->fecn) {#ifdef DEBUG_ECN		printk(KERN_DEBUG "%s: DLCI %d FECN O%s\n", ndev->name,		       dlci, fh->fecn ? "N" : "FF");#endif		pvc->state.fecn ^= 1;	}	if (pvc->state.becn != fh->becn) {#ifdef DEBUG_ECN		printk(KERN_DEBUG "%s: DLCI %d BECN O%s\n", ndev->name,		       dlci, fh->becn ? "N" : "FF");#endif		pvc->state.becn ^= 1;	}	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {		hdlc->stats.rx_dropped++;		return NET_RX_DROP;	}	if (data[3] == NLPID_IP) {		skb_pull(skb, 4); /* Remove 4-byte header (hdr, UI, NLPID) */		dev = pvc->main;		skb->protocol = htons(ETH_P_IP);	} else if (data[3] == NLPID_IPV6) {		skb_pull(skb, 4); /* Remove 4-byte header (hdr, UI, NLPID) */		dev = pvc->main;		skb->protocol = htons(ETH_P_IPV6);	} else if (skb->len > 10 && data[3] == FR_PAD &&		   data[4] == NLPID_SNAP && data[5] == FR_PAD) {		u16 oui = ntohs(*(u16*)(data + 6));		u16 pid = ntohs(*(u16*)(data + 8));		skb_pull(skb, 10);		switch ((((u32)oui) << 16) | pid) {		case ETH_P_ARP: /* routed frame with SNAP */		case ETH_P_IPX:		case ETH_P_IP:	/* a long variant */		case ETH_P_IPV6:			dev = pvc->main;			skb->protocol = htons(pid);			break;		case 0x80C20007: /* bridged Ethernet frame */			if ((dev = pvc->ether) != NULL)				skb->protocol = eth_type_trans(skb, dev);			break;		default:			printk(KERN_INFO "%s: Unsupported protocol, OUI=%x "			       "PID=%x\n", ndev->name, oui, pid);			dev_kfree_skb_any(skb);			return NET_RX_DROP;		}	} else {		printk(KERN_INFO "%s: Unsupported protocol, NLPID=%x "		       "length = %i\n", ndev->name, data[3], skb->len);		dev_kfree_skb_any(skb);		return NET_RX_DROP;	}	if (dev) {		struct net_device_stats *stats = pvc_get_stats(dev);		stats->rx_packets++; /* PVC traffic */		stats->rx_bytes += skb->len;		if (pvc->state.becn)			stats->rx_compressed++;		skb->dev = dev;		netif_rx(skb);		return NET_RX_SUCCESS;	} else {		dev_kfree_skb_any(skb);		return NET_RX_DROP;	} rx_error:	hdlc->stats.rx_errors++; /* Mark error */	dev_kfree_skb_any(skb);	return NET_RX_DROP;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b3dd65f958354226275522b5a64157834bdc5415/hdlc_fr.c/clean/drivers/net/wan/hdlc_fr.c