Lines Matching refs:skb
38 static int ax25_rx_fragment(ax25_cb *ax25, struct sk_buff *skb) in ax25_rx_fragment() argument
43 if (!(*skb->data & AX25_SEG_FIRST)) { in ax25_rx_fragment()
44 if ((ax25->fragno - 1) == (*skb->data & AX25_SEG_REM)) { in ax25_rx_fragment()
46 ax25->fragno = *skb->data & AX25_SEG_REM; in ax25_rx_fragment()
47 skb_pull(skb, 1); /* skip fragno */ in ax25_rx_fragment()
48 ax25->fraglen += skb->len; in ax25_rx_fragment()
49 skb_queue_tail(&ax25->frag_queue, skb); in ax25_rx_fragment()
86 if (*skb->data & AX25_SEG_FIRST) { in ax25_rx_fragment()
88 ax25->fragno = *skb->data & AX25_SEG_REM; in ax25_rx_fragment()
89 skb_pull(skb, 1); /* skip fragno */ in ax25_rx_fragment()
90 ax25->fraglen = skb->len; in ax25_rx_fragment()
91 skb_queue_tail(&ax25->frag_queue, skb); in ax25_rx_fragment()
103 int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb) in ax25_rx_iframe() argument
109 if (skb == NULL) return 0; in ax25_rx_iframe()
113 pid = *skb->data; in ax25_rx_iframe()
120 struct sk_buff *skbn = skb_copy(skb, GFP_ATOMIC); in ax25_rx_iframe()
122 kfree_skb(skb); in ax25_rx_iframe()
123 skb = skbn; in ax25_rx_iframe()
126 skb_pull(skb, 1); /* Remove PID */ in ax25_rx_iframe()
127 skb->mac_header = skb->network_header; in ax25_rx_iframe()
128 skb_reset_network_header(skb); in ax25_rx_iframe()
129 skb->dev = ax25->ax25_dev->dev; in ax25_rx_iframe()
130 skb->pkt_type = PACKET_HOST; in ax25_rx_iframe()
131 skb->protocol = htons(ETH_P_IP); in ax25_rx_iframe()
132 netif_rx(skb); in ax25_rx_iframe()
136 skb_pull(skb, 1); /* Remove PID */ in ax25_rx_iframe()
137 return ax25_rx_fragment(ax25, skb); in ax25_rx_iframe()
141 skb_pull(skb, 1); /* Remove PID */ in ax25_rx_iframe()
142 return (*func)(skb, ax25); in ax25_rx_iframe()
148 if (sock_queue_rcv_skb(ax25->sk, skb) == 0) in ax25_rx_iframe()
161 static int ax25_process_rx_frame(ax25_cb *ax25, struct sk_buff *skb, int type, int dama) in ax25_process_rx_frame() argument
171 queued = ax25_std_frame_in(ax25, skb, type); in ax25_process_rx_frame()
177 queued = ax25_ds_frame_in(ax25, skb, type); in ax25_process_rx_frame()
179 queued = ax25_std_frame_in(ax25, skb, type); in ax25_process_rx_frame()
187 static int ax25_rcv(struct sk_buff *skb, struct net_device *dev, in ax25_rcv() argument
201 skb_reset_transport_header(skb); in ax25_rcv()
210 if (ax25_addr_parse(skb->data, skb->len, &src, &dest, &dp, &type, &dama) == NULL) in ax25_rcv()
222 skb_pull(skb, ax25_addr_size(&dp)); in ax25_rcv()
233 if ((*skb->data & ~0x10) == AX25_UI && dp.lastrepeat + 1 == dp.ndigi) { in ax25_rcv()
234 skb_set_transport_header(skb, 2); /* skip control and pid */ in ax25_rcv()
236 ax25_send_to_raw(&dest, skb, skb->data[1]); in ax25_rcv()
242 switch (skb->data[1]) { in ax25_rcv()
244 skb_pull(skb,2); /* drop PID/CTRL */ in ax25_rcv()
245 skb_reset_transport_header(skb); in ax25_rcv()
246 skb_reset_network_header(skb); in ax25_rcv()
247 skb->dev = dev; in ax25_rcv()
248 skb->pkt_type = PACKET_HOST; in ax25_rcv()
249 skb->protocol = htons(ETH_P_IP); in ax25_rcv()
250 netif_rx(skb); in ax25_rcv()
254 skb_pull(skb,2); in ax25_rcv()
255 skb_reset_transport_header(skb); in ax25_rcv()
256 skb_reset_network_header(skb); in ax25_rcv()
257 skb->dev = dev; in ax25_rcv()
258 skb->pkt_type = PACKET_HOST; in ax25_rcv()
259 skb->protocol = htons(ETH_P_ARP); in ax25_rcv()
260 netif_rx(skb); in ax25_rcv()
269 kfree_skb(skb); in ax25_rcv()
274 skb_pull(skb, 2); in ax25_rcv()
275 if (sock_queue_rcv_skb(sk, skb) != 0) in ax25_rcv()
276 kfree_skb(skb); in ax25_rcv()
281 kfree_skb(skb); in ax25_rcv()
286 kfree_skb(skb); /* Will scan SOCK_AX25 RAW sockets */ in ax25_rcv()
314 if (ax25_process_rx_frame(ax25, skb, type, dama) == 0) in ax25_rcv()
315 kfree_skb(skb); in ax25_rcv()
325 if ((*skb->data & ~AX25_PF) != AX25_SABM && in ax25_rcv()
326 (*skb->data & ~AX25_PF) != AX25_SABME) { in ax25_rcv()
331 if ((*skb->data & ~AX25_PF) != AX25_DM && mine) in ax25_rcv()
350 kfree_skb(skb); in ax25_rcv()
358 skb_set_owner_r(skb, make); in ax25_rcv()
359 skb_queue_head(&sk->sk_receive_queue, skb); in ax25_rcv()
385 kfree_skb(skb); in ax25_rcv()
400 if ((*skb->data & ~AX25_PF) == AX25_SABME) { in ax25_rcv()
425 sk->sk_data_ready(sk, skb->len); in ax25_rcv()
429 kfree_skb(skb); in ax25_rcv()
437 int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev, in ax25_kiss_rcv() argument
440 skb->sk = NULL; /* Initially we don't know who it's for */ in ax25_kiss_rcv()
441 skb->destructor = NULL; /* Who initializes this, dammit?! */ in ax25_kiss_rcv()
444 kfree_skb(skb); in ax25_kiss_rcv()
448 if ((*skb->data & 0x0F) != 0) { in ax25_kiss_rcv()
449 kfree_skb(skb); /* Not a KISS data frame */ in ax25_kiss_rcv()
453 skb_pull(skb, AX25_KISS_HEADER_LEN); /* Remove the KISS byte */ in ax25_kiss_rcv()
455 return ax25_rcv(skb, dev, (ax25_address *)dev->dev_addr, ptype); in ax25_kiss_rcv()