#endif 
static int cisco_rx(struct sk_buff *skb){	struct net_device *dev = skb->dev;	hdlc_device *hdlc = dev_to_hdlc(dev);	hdlc_header *data = (hdlc_header*)skb->data;	cisco_packet *cisco_data;	struct in_device *in_dev;	u32 addr, mask;	if (skb->len < sizeof(hdlc_header))		goto rx_error;	if (data->address != CISCO_MULTICAST &&	    data->address != CISCO_UNICAST)		goto rx_error;	switch(ntohs(data->protocol)) {	case CISCO_SYS_INFO:		/* Packet is not needed, drop it. */		dev_kfree_skb_any(skb);		return NET_RX_SUCCESS;	case CISCO_KEEPALIVE:		if (skb->len != sizeof(hdlc_header) + CISCO_PACKET_LEN &&		    skb->len != sizeof(hdlc_header) + CISCO_BIG_PACKET_LEN) {			printk(KERN_INFO "%s: Invalid length of Cisco "			       "control packet (%d bytes)\n",			       dev->name, skb->len);			goto rx_error;		}		cisco_data = (cisco_packet*)(skb->data + sizeof(hdlc_header));		switch(ntohl (cisco_data->type)) {		case CISCO_ADDR_REQ: /* Stolen from syncppp.c :-) */			in_dev = dev->ip_ptr;			addr = 0;			mask = ~0; /* is the mask correct? */			if (in_dev != NULL) {				struct in_ifaddr **ifap = &in_dev->ifa_list;				while (*ifap != NULL) {					if (strcmp(dev->name,						   (*ifap)->ifa_label) == 0) {						addr = (*ifap)->ifa_local;						mask = (*ifap)->ifa_mask;						break;					}					ifap = &(*ifap)->ifa_next;				}				cisco_keepalive_send(dev, CISCO_ADDR_REPLY,						     addr, mask);			}			dev_kfree_skb_any(skb);			return NET_RX_SUCCESS;		case CISCO_ADDR_REPLY:			printk(KERN_INFO "%s: Unexpected Cisco IP address "			       "reply\n", dev->name);			goto rx_error;		case CISCO_KEEPALIVE_REQ:			hdlc->state.cisco.rxseq = ntohl(cisco_data->par1);			if (hdlc->state.cisco.request_sent &&			    ntohl(cisco_data->par2)==hdlc->state.cisco.txseq) {				hdlc->state.cisco.last_poll = jiffies;				if (!hdlc->state.cisco.up) {					u32 sec, min, hrs, days;					sec = ntohl(cisco_data->time) / 1000;					min = sec / 60; sec -= min * 60;					hrs = min / 60; min -= hrs * 60;					days = hrs / 24; hrs -= days * 24;					printk(KERN_INFO "%s: Link up (peer "					       "uptime %ud%uh%um%us)\n",					       dev->name, days, hrs,					       min, sec);					netif_carrier_on(dev);					hdlc->state.cisco.up = 1;				}			}			dev_kfree_skb_any(skb);			return NET_RX_SUCCESS;		} /* switch(keepalive type) */	} /* switch(protocol) */	printk(KERN_INFO "%s: Unsupported protocol %x\n", dev->name,	       data->protocol);	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;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/1f7bad72c0ed8cf29d13bac81ceeba9e1ac05c66/hdlc_cisco.c/clean/drivers/net/wan/hdlc_cisco.c