- 论坛徽章:
- 0
|
linux-2.6.20.7
- static int wanpipe_rcv(struct sk_buff *skb, struct net_device *dev,
- struct sock *sk)
- {
- struct wan_sockaddr_ll * sll = (struct wan_sockaddr_ll *)skb->cb;
- wanpipe_common_t * chan = dev->priv;
- /*
- * When we registered the protocol,
- * we saved the socket in the data field for just this event.
- */
- skb->dev = dev;
- sll->sll_family = AF_WANPIPE;
- sll->sll_hatype = dev->type;
- sll->sll_protocol = skb->protocol;
- sll->sll_pkttype = skb->pkt_type;
- sll->sll_ifindex = dev->ifindex;
-
- sll->sll_halen = 0;
- if (dev->hard_header_parse)
- sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr);
- /*
- * WAN_PACKET_DATA : Data which should be passed up the receive queue.
- * WAN_PACKET_ASYC : Asynchronous data like place call, which should
- * be passed up the listening sock.
- * WAN_PACKET_ERR : Asynchronous data like clear call or restart
- * which should go into an error queue.
- */
- switch (skb->pkt_type) {
- case WAN_PACKET_DATA:
- if (sock_queue_rcv_skb(sk, skb) < 0) {
- return -ENOMEM;
- }
- break;
-
- case WAN_PACKET_CMD:
- sk->sk_state = chan->state;
- /* Bug fix: update Mar6.
- * Do not set the sock lcn number here, since
- * cmd is not guaranteed to be executed on the
- * board, thus Lcn could be wrong
- */
- sk->sk_data_ready(sk, skb->len);
- kfree_skb(skb);
- break;
-
- case WAN_PACKET_ERR:
- sk->sk_state = chan->state;
- if (sock_queue_err_skb(sk,skb)<0){
- return -ENOMEM;
- }
- break;
-
- default:
- //at this case 就在这儿,呵呵
- printk(KERN_INFO "wansock: BH Illegal Packet Type Dropping\n");
- kfree_skb(skb);
- break;
- }
- return 0;
- }
复制代码
[ 本帖最后由 sisi8408 于 2007-8-10 23:00 编辑 ] |
|