void sppp_input (struct net_device *dev, struct sk_buff *skb) 
static void sppp_input (struct net_device *dev, struct sk_buff *skb) 
void sppp_input (struct net_device *dev, struct sk_buff *skb){	struct ppp_header *h;	struct sppp *sp = (struct sppp *)sppp_of(dev);	unsigned long flags;	skb->dev=dev;	skb->mac.raw=skb->data;	if (dev->flags & IFF_RUNNING)	{		/* Count received bytes, add FCS and one flag */		sp->ibytes+= skb->len + 3;		sp->ipkts++;	}	if (!pskb_may_pull(skb, PPP_HEADER_LEN)) {		/* Too small packet, drop it. */		if (sp->pp_flags & PP_DEBUG)			printk (KERN_DEBUG "%s: input packet is too small, %d bytes\n",				dev->name, skb->len);		kfree_skb(skb);		return;	}	/* Get PPP header. */	h = (struct ppp_header *)skb->data;	skb_pull(skb,sizeof(struct ppp_header));	spin_lock_irqsave(&sp->lock, flags);		switch (h->address) {	default:        /* Invalid PPP packet. */		goto invalid;	case PPP_ALLSTATIONS:		if (h->control != PPP_UI)			goto invalid;		if (sp->pp_flags & PP_CISCO) {			if (sp->pp_flags & PP_DEBUG)				printk (KERN_WARNING "%s: PPP packet in Cisco mode <0x%x 0x%x 0x%x>\n",					dev->name,					h->address, h->control, ntohs (h->protocol));			goto drop;		}		switch (ntohs (h->protocol)) {		default:			if (sp->lcp.state == LCP_STATE_OPENED)				sppp_cp_send (sp, PPP_LCP, LCP_PROTO_REJ,					++sp->pp_seq, skb->len + 2,					&h->protocol);			if (sp->pp_flags & PP_DEBUG)				printk (KERN_WARNING "%s: invalid input protocol <0x%x 0x%x 0x%x>\n",					dev->name,					h->address, h->control, ntohs (h->protocol));			goto drop;		case PPP_LCP:			sppp_lcp_input (sp, skb);			goto drop;		case PPP_IPCP:			if (sp->lcp.state == LCP_STATE_OPENED)				sppp_ipcp_input (sp, skb);			else				printk(KERN_DEBUG "IPCP when still waiting LCP finish.\n");			goto drop;		case PPP_IP:			if (sp->ipcp.state == IPCP_STATE_OPENED) {				if(sp->pp_flags&PP_DEBUG)					printk(KERN_DEBUG "Yow an IP frame.\n");				skb->protocol=htons(ETH_P_IP);				netif_rx(skb);				dev->last_rx = jiffies;				goto done;			}			break;#ifdef IPX		case PPP_IPX:			/* IPX IPXCP not implemented yet */			if (sp->lcp.state == LCP_STATE_OPENED) {				skb->protocol=htons(ETH_P_IPX);				netif_rx(skb);				dev->last_rx = jiffies;				goto done;			}			break;#endif		}		break;	case CISCO_MULTICAST:	case CISCO_UNICAST:		/* Don't check the control field here (RFC 1547). */		if (! (sp->pp_flags & PP_CISCO)) {			if (sp->pp_flags & PP_DEBUG)				printk (KERN_WARNING "%s: Cisco packet in PPP mode <0x%x 0x%x 0x%x>\n",					dev->name,					h->address, h->control, ntohs (h->protocol));			goto drop;		}		switch (ntohs (h->protocol)) {		default:			goto invalid;		case CISCO_KEEPALIVE:			sppp_cisco_input (sp, skb);			goto drop;#ifdef CONFIG_INET		case ETH_P_IP:			skb->protocol=htons(ETH_P_IP);			netif_rx(skb);			dev->last_rx = jiffies;			goto done;#endif#ifdef CONFIG_IPX		case ETH_P_IPX:			skb->protocol=htons(ETH_P_IPX);			netif_rx(skb);			dev->last_rx = jiffies;			goto done;#endif		}		break;	}	goto drop;invalid:	if (sp->pp_flags & PP_DEBUG)		printk (KERN_WARNING "%s: invalid input packet <0x%x 0x%x 0x%x>\n",			dev->name, h->address, h->control, ntohs (h->protocol));drop:	kfree_skb(skb);done:	spin_unlock_irqrestore(&sp->lock, flags);	sppp_flush_xmit();	return;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/7665a08928f241247afe8c76865cdbe4ef5489bf/syncppp.c/buggy/drivers/net/wan/syncppp.c