1 // SPDX-License-Identifier: GPL-2.0-or-later << 2 /* 1 /* 3 * X.25 Packet Layer release 002 2 * X.25 Packet Layer release 002 4 * 3 * 5 * This is ALPHA test software. This code !! 4 * This is ALPHA test software. This code may break your machine, randomly fail to work with new 6 * randomly fail to work with new release !! 5 * releases, misbehave and/or generally screw up. It might even work. 7 * screw up. It might even work. << 8 * 6 * 9 * This code REQUIRES 2.1.15 or higher 7 * This code REQUIRES 2.1.15 or higher 10 * 8 * >> 9 * This module: >> 10 * This module is free software; you can redistribute it and/or >> 11 * modify it under the terms of the GNU General Public License >> 12 * as published by the Free Software Foundation; either version >> 13 * 2 of the License, or (at your option) any later version. >> 14 * 11 * History 15 * History 12 * X.25 001 Jonathan Naylor Star 16 * X.25 001 Jonathan Naylor Started coding. 13 * X.25 002 Jonathan Naylor Cent 17 * X.25 002 Jonathan Naylor Centralised disconnection processing. 14 * mar/20/00 Daniela Squassoni Disa !! 18 * mar/20/00 Daniela Squassoni Disabling/enabling of facilities 15 * nego 19 * negotiation. 16 * jun/24/01 Arnaldo C. Melo use 20 * jun/24/01 Arnaldo C. Melo use skb_queue_purge, cleanups 17 * apr/04/15 Shaun Pereira << 18 * << 19 */ 21 */ 20 22 21 #define pr_fmt(fmt) "X25: " fmt !! 23 #include <linux/errno.h> 22 !! 24 #include <linux/types.h> 23 #include <linux/slab.h> !! 25 #include <linux/socket.h> >> 26 #include <linux/in.h> 24 #include <linux/kernel.h> 27 #include <linux/kernel.h> >> 28 #include <linux/sched.h> >> 29 #include <linux/timer.h> 25 #include <linux/string.h> 30 #include <linux/string.h> >> 31 #include <linux/sockios.h> >> 32 #include <linux/net.h> >> 33 #include <linux/inet.h> >> 34 #include <linux/netdevice.h> 26 #include <linux/skbuff.h> 35 #include <linux/skbuff.h> 27 #include <net/sock.h> 36 #include <net/sock.h> 28 #include <net/tcp_states.h> !! 37 #include <asm/segment.h> >> 38 #include <asm/system.h> >> 39 #include <linux/fcntl.h> >> 40 #include <linux/mm.h> >> 41 #include <linux/interrupt.h> 29 #include <net/x25.h> 42 #include <net/x25.h> 30 43 31 /* 44 /* 32 * This routine purges all of the queues 45 * This routine purges all of the queues of frames. 33 */ 46 */ 34 void x25_clear_queues(struct sock *sk) 47 void x25_clear_queues(struct sock *sk) 35 { 48 { 36 struct x25_sock *x25 = x25_sk(sk); !! 49 skb_queue_purge(&sk->write_queue); 37 !! 50 skb_queue_purge(&sk->protinfo.x25->ack_queue); 38 skb_queue_purge(&sk->sk_write_queue); !! 51 skb_queue_purge(&sk->protinfo.x25->interrupt_in_queue); 39 skb_queue_purge(&x25->ack_queue); !! 52 skb_queue_purge(&sk->protinfo.x25->interrupt_out_queue); 40 skb_queue_purge(&x25->interrupt_in_que !! 53 skb_queue_purge(&sk->protinfo.x25->fragment_queue); 41 skb_queue_purge(&x25->interrupt_out_qu << 42 skb_queue_purge(&x25->fragment_queue); << 43 } 54 } 44 55 45 56 46 /* 57 /* 47 * This routine purges the input queue of thos 58 * This routine purges the input queue of those frames that have been 48 * acknowledged. This replaces the boxes label 59 * acknowledged. This replaces the boxes labelled "V(a) <- N(r)" on the 49 * SDL diagram. 60 * SDL diagram. 50 */ 61 */ 51 void x25_frames_acked(struct sock *sk, unsigne 62 void x25_frames_acked(struct sock *sk, unsigned short nr) 52 { 63 { 53 struct sk_buff *skb; 64 struct sk_buff *skb; 54 struct x25_sock *x25 = x25_sk(sk); !! 65 int modulus = sk->protinfo.x25->neighbour->extended ? X25_EMODULUS : 55 int modulus = x25->neighbour->extended !! 66 X25_SMODULUS; 56 67 57 /* 68 /* 58 * Remove all the ack-ed frames from t 69 * Remove all the ack-ed frames from the ack queue. 59 */ 70 */ 60 if (x25->va != nr) !! 71 if (sk->protinfo.x25->va != nr) 61 while (skb_peek(&x25->ack_queu !! 72 while (skb_peek(&sk->protinfo.x25->ack_queue) != NULL && 62 skb = skb_dequeue(&x25 !! 73 sk->protinfo.x25->va != nr) { >> 74 skb = skb_dequeue(&sk->protinfo.x25->ack_queue); 63 kfree_skb(skb); 75 kfree_skb(skb); 64 x25->va = (x25->va + 1 !! 76 sk->protinfo.x25->va = (sk->protinfo.x25->va + 1) % >> 77 modulus; 65 } 78 } 66 } 79 } 67 80 68 void x25_requeue_frames(struct sock *sk) 81 void x25_requeue_frames(struct sock *sk) 69 { 82 { 70 struct sk_buff *skb, *skb_prev = NULL; 83 struct sk_buff *skb, *skb_prev = NULL; 71 84 72 /* 85 /* 73 * Requeue all the un-ack-ed frames on 86 * Requeue all the un-ack-ed frames on the output queue to be picked 74 * up by x25_kick. This arrangement ha 87 * up by x25_kick. This arrangement handles the possibility of an empty 75 * output queue. 88 * output queue. 76 */ 89 */ 77 while ((skb = skb_dequeue(&x25_sk(sk)- !! 90 while ((skb = skb_dequeue(&sk->protinfo.x25->ack_queue)) != NULL) { 78 if (!skb_prev) !! 91 if (skb_prev == NULL) 79 skb_queue_head(&sk->sk !! 92 skb_queue_head(&sk->write_queue, skb); 80 else 93 else 81 skb_append(skb_prev, s !! 94 skb_append(skb_prev, skb); 82 skb_prev = skb; 95 skb_prev = skb; 83 } 96 } 84 } 97 } 85 98 86 /* 99 /* 87 * Validate that the value of nr is betwe 100 * Validate that the value of nr is between va and vs. Return true or 88 * false for testing. 101 * false for testing. 89 */ 102 */ 90 int x25_validate_nr(struct sock *sk, unsigned 103 int x25_validate_nr(struct sock *sk, unsigned short nr) 91 { 104 { 92 struct x25_sock *x25 = x25_sk(sk); !! 105 unsigned short vc = sk->protinfo.x25->va; 93 unsigned short vc = x25->va; !! 106 int modulus = sk->protinfo.x25->neighbour->extended ? X25_EMODULUS : 94 int modulus = x25->neighbour->extended !! 107 X25_SMODULUS; 95 !! 108 96 while (vc != x25->vs) { !! 109 while (vc != sk->protinfo.x25->vs) { 97 if (nr == vc) !! 110 if (nr == vc) return 1; 98 return 1; << 99 vc = (vc + 1) % modulus; 111 vc = (vc + 1) % modulus; 100 } 112 } 101 113 102 return nr == x25->vs ? 1 : 0; !! 114 return nr == sk->protinfo.x25->vs ? 1 : 0; 103 } 115 } 104 116 105 /* !! 117 /* 106 * This routine is called when the packet lay 118 * This routine is called when the packet layer internally generates a 107 * control frame. 119 * control frame. 108 */ 120 */ 109 void x25_write_internal(struct sock *sk, int f 121 void x25_write_internal(struct sock *sk, int frametype) 110 { 122 { 111 struct x25_sock *x25 = x25_sk(sk); << 112 struct sk_buff *skb; 123 struct sk_buff *skb; 113 unsigned char *dptr; 124 unsigned char *dptr; 114 unsigned char facilities[X25_MAX_FAC_ 125 unsigned char facilities[X25_MAX_FAC_LEN]; 115 unsigned char addresses[1 + X25_ADDR_ 126 unsigned char addresses[1 + X25_ADDR_LEN]; 116 unsigned char lci1, lci2; 127 unsigned char lci1, lci2; >> 128 int len; >> 129 117 /* 130 /* 118 * Default safe frame size. 131 * Default safe frame size. 119 */ 132 */ 120 int len = X25_MAX_L2_LEN + X25_EXT_MIN !! 133 len = X25_MAX_L2_LEN + X25_EXT_MIN_LEN; 121 134 122 /* 135 /* 123 * Adjust frame size. 136 * Adjust frame size. 124 */ 137 */ 125 switch (frametype) { 138 switch (frametype) { 126 case X25_CALL_REQUEST: !! 139 case X25_CALL_REQUEST: 127 len += 1 + X25_ADDR_LEN + X25_ !! 140 len += 1 + X25_ADDR_LEN + X25_MAX_FAC_LEN + 128 break; !! 141 X25_MAX_CUD_LEN; 129 case X25_CALL_ACCEPTED: /* fast sel wi !! 142 break; 130 if (x25->facilities.reverse & !! 143 case X25_CALL_ACCEPTED: 131 len += 1 + X25_MAX_FAC 144 len += 1 + X25_MAX_FAC_LEN + X25_MAX_CUD_LEN; 132 } else { !! 145 break; 133 len += 1 + X25_MAX_FAC !! 146 case X25_CLEAR_REQUEST: 134 } !! 147 case X25_RESET_REQUEST: 135 break; !! 148 len += 2; 136 case X25_CLEAR_REQUEST: !! 149 break; 137 case X25_RESET_REQUEST: !! 150 case X25_RR: 138 len += 2; !! 151 case X25_RNR: 139 break; !! 152 case X25_REJ: 140 case X25_RR: !! 153 case X25_CLEAR_CONFIRMATION: 141 case X25_RNR: !! 154 case X25_INTERRUPT_CONFIRMATION: 142 case X25_REJ: !! 155 case X25_RESET_CONFIRMATION: 143 case X25_CLEAR_CONFIRMATION: !! 156 break; 144 case X25_INTERRUPT_CONFIRMATION: !! 157 default: 145 case X25_RESET_CONFIRMATION: !! 158 printk(KERN_ERR "X.25: invalid frame type %02X\n", 146 break; !! 159 frametype); 147 default: !! 160 return; 148 pr_err("invalid frame type %02 << 149 return; << 150 } 161 } 151 162 152 if ((skb = alloc_skb(len, GFP_ATOMIC)) 163 if ((skb = alloc_skb(len, GFP_ATOMIC)) == NULL) 153 return; 164 return; 154 165 155 /* 166 /* 156 * Space for Ethernet and 802.2 L 167 * Space for Ethernet and 802.2 LLC headers. 157 */ 168 */ 158 skb_reserve(skb, X25_MAX_L2_LEN); 169 skb_reserve(skb, X25_MAX_L2_LEN); 159 170 160 /* 171 /* 161 * Make space for the GFI and LCI 172 * Make space for the GFI and LCI, and fill them in. 162 */ 173 */ 163 dptr = skb_put(skb, 2); 174 dptr = skb_put(skb, 2); 164 175 165 lci1 = (x25->lci >> 8) & 0x0F; !! 176 lci1 = (sk->protinfo.x25->lci >> 8) & 0x0F; 166 lci2 = (x25->lci >> 0) & 0xFF; !! 177 lci2 = (sk->protinfo.x25->lci >> 0) & 0xFF; 167 178 168 if (x25->neighbour->extended) { !! 179 if (sk->protinfo.x25->neighbour->extended) { 169 *dptr++ = lci1 | X25_GFI_EXTSE 180 *dptr++ = lci1 | X25_GFI_EXTSEQ; 170 *dptr++ = lci2; 181 *dptr++ = lci2; 171 } else { 182 } else { 172 *dptr++ = lci1 | X25_GFI_STDSE 183 *dptr++ = lci1 | X25_GFI_STDSEQ; 173 *dptr++ = lci2; 184 *dptr++ = lci2; 174 } 185 } 175 186 176 /* 187 /* 177 * Now fill in the frame type spe 188 * Now fill in the frame type specific information. 178 */ 189 */ 179 switch (frametype) { 190 switch (frametype) { 180 191 181 case X25_CALL_REQUEST: 192 case X25_CALL_REQUEST: 182 dptr = skb_put(skb, 193 dptr = skb_put(skb, 1); 183 *dptr++ = X25_CALL_REQ 194 *dptr++ = X25_CALL_REQUEST; 184 len = x25_addr_ato !! 195 len = x25_addr_aton(addresses, &sk->protinfo.x25->dest_addr, &sk->protinfo.x25->source_addr); 185 !! 196 dptr = skb_put(skb, len); 186 skb_put_data(skb, addr !! 197 memcpy(dptr, addresses, len); 187 len = x25_create_f !! 198 len = x25_create_facilities(facilities, &sk->protinfo.x25->facilities, sk->protinfo.x25->neighbour->global_facil_mask); 188 &x25-> !! 199 dptr = skb_put(skb, len); 189 &x25-> !! 200 memcpy(dptr, facilities, len); 190 x25->n !! 201 dptr = skb_put(skb, sk->protinfo.x25->calluserdata.cudlength); 191 skb_put_data(skb, faci !! 202 memcpy(dptr, sk->protinfo.x25->calluserdata.cuddata, sk->protinfo.x25->calluserdata.cudlength); 192 skb_put_data(skb, x25- !! 203 sk->protinfo.x25->calluserdata.cudlength = 0; 193 x25->call << 194 x25->calluserdata.cudl << 195 break; 204 break; 196 205 197 case X25_CALL_ACCEPTED: 206 case X25_CALL_ACCEPTED: 198 dptr = skb_put(skb, 207 dptr = skb_put(skb, 2); 199 *dptr++ = X25_CALL_ACC 208 *dptr++ = X25_CALL_ACCEPTED; 200 *dptr++ = 0x00; 209 *dptr++ = 0x00; /* Address lengths */ 201 len = x25_create_f !! 210 len = x25_create_facilities(facilities, &sk->protinfo.x25->facilities, sk->protinfo.x25->vc_facil_mask); 202 !! 211 dptr = skb_put(skb, len); 203 !! 212 memcpy(dptr, facilities, len); 204 !! 213 dptr = skb_put(skb, sk->protinfo.x25->calluserdata.cudlength); 205 skb_put_data(skb, faci !! 214 memcpy(dptr, sk->protinfo.x25->calluserdata.cuddata, sk->protinfo.x25->calluserdata.cudlength); 206 !! 215 sk->protinfo.x25->calluserdata.cudlength = 0; 207 /* fast select with no << 208 allows call us << 209 ensure it is o << 210 if(x25->facilities.rev << 211 skb_put_data(s << 212 x << 213 x << 214 } << 215 x25->calluserdata.cudl << 216 break; 216 break; 217 217 218 case X25_CLEAR_REQUEST: 218 case X25_CLEAR_REQUEST: 219 dptr = skb_put(skb, << 220 *dptr++ = frametype; << 221 *dptr++ = x25->causedi << 222 *dptr++ = x25->causedi << 223 break; << 224 << 225 case X25_RESET_REQUEST: 219 case X25_RESET_REQUEST: 226 dptr = skb_put(skb, 220 dptr = skb_put(skb, 3); 227 *dptr++ = frametype; 221 *dptr++ = frametype; 228 *dptr++ = 0x00; 222 *dptr++ = 0x00; /* XXX */ 229 *dptr++ = 0x00; 223 *dptr++ = 0x00; /* XXX */ 230 break; 224 break; 231 225 232 case X25_RR: 226 case X25_RR: 233 case X25_RNR: 227 case X25_RNR: 234 case X25_REJ: 228 case X25_REJ: 235 if (x25->neighbour->ex !! 229 if (sk->protinfo.x25->neighbour->extended) { 236 dptr = skb 230 dptr = skb_put(skb, 2); 237 *dptr++ = fra 231 *dptr++ = frametype; 238 *dptr++ = (x2 !! 232 *dptr++ = (sk->protinfo.x25->vr << 1) & 0xFE; 239 } else { 233 } else { 240 dptr = skb 234 dptr = skb_put(skb, 1); 241 *dptr = fra 235 *dptr = frametype; 242 *dptr++ |= (x2 !! 236 *dptr++ |= (sk->protinfo.x25->vr << 5) & 0xE0; 243 } 237 } 244 break; 238 break; 245 239 246 case X25_CLEAR_CONFIRMATION: 240 case X25_CLEAR_CONFIRMATION: 247 case X25_INTERRUPT_CONFIRMATIO 241 case X25_INTERRUPT_CONFIRMATION: 248 case X25_RESET_CONFIRMATION: 242 case X25_RESET_CONFIRMATION: 249 dptr = skb_put(skb, 1 243 dptr = skb_put(skb, 1); 250 *dptr = frametype; 244 *dptr = frametype; 251 break; 245 break; 252 } 246 } 253 247 254 x25_transmit_link(skb, x25->neighbour) !! 248 x25_transmit_link(skb, sk->protinfo.x25->neighbour); 255 } 249 } 256 250 257 /* 251 /* 258 * Unpick the contents of the passed X.25 252 * Unpick the contents of the passed X.25 Packet Layer frame. 259 */ 253 */ 260 int x25_decode(struct sock *sk, struct sk_buff 254 int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q, 261 int *d, int *m) 255 int *d, int *m) 262 { 256 { 263 struct x25_sock *x25 = x25_sk(sk); !! 257 unsigned char *frame = skb->data; 264 unsigned char *frame; << 265 << 266 if (!pskb_may_pull(skb, X25_STD_MIN_LE << 267 return X25_ILLEGAL; << 268 frame = skb->data; << 269 258 270 *ns = *nr = *q = *d = *m = 0; 259 *ns = *nr = *q = *d = *m = 0; 271 260 272 switch (frame[2]) { 261 switch (frame[2]) { 273 case X25_CALL_REQUEST: !! 262 case X25_CALL_REQUEST: 274 case X25_CALL_ACCEPTED: !! 263 case X25_CALL_ACCEPTED: 275 case X25_CLEAR_REQUEST: !! 264 case X25_CLEAR_REQUEST: 276 case X25_CLEAR_CONFIRMATION: !! 265 case X25_CLEAR_CONFIRMATION: 277 case X25_INTERRUPT: !! 266 case X25_INTERRUPT: 278 case X25_INTERRUPT_CONFIRMATION: !! 267 case X25_INTERRUPT_CONFIRMATION: 279 case X25_RESET_REQUEST: !! 268 case X25_RESET_REQUEST: 280 case X25_RESET_CONFIRMATION: !! 269 case X25_RESET_CONFIRMATION: 281 case X25_RESTART_REQUEST: !! 270 case X25_RESTART_REQUEST: 282 case X25_RESTART_CONFIRMATION: !! 271 case X25_RESTART_CONFIRMATION: 283 case X25_REGISTRATION_REQUEST: !! 272 case X25_REGISTRATION_REQUEST: 284 case X25_REGISTRATION_CONFIRMATION: !! 273 case X25_REGISTRATION_CONFIRMATION: 285 case X25_DIAGNOSTIC: !! 274 case X25_DIAGNOSTIC: 286 return frame[2]; !! 275 return frame[2]; 287 } 276 } 288 277 289 if (x25->neighbour->extended) { !! 278 if (sk->protinfo.x25->neighbour->extended) { 290 if (frame[2] == X25_RR || 279 if (frame[2] == X25_RR || 291 frame[2] == X25_RNR || 280 frame[2] == X25_RNR || 292 frame[2] == X25_REJ) { 281 frame[2] == X25_REJ) { 293 if (!pskb_may_pull(skb << 294 return X25_ILL << 295 frame = skb->data; << 296 << 297 *nr = (frame[3] >> 1) 282 *nr = (frame[3] >> 1) & 0x7F; 298 return frame[2]; 283 return frame[2]; 299 } 284 } 300 } else { 285 } else { 301 if ((frame[2] & 0x1F) == X25_R 286 if ((frame[2] & 0x1F) == X25_RR || 302 (frame[2] & 0x1F) == X25_R 287 (frame[2] & 0x1F) == X25_RNR || 303 (frame[2] & 0x1F) == X25_R 288 (frame[2] & 0x1F) == X25_REJ) { 304 *nr = (frame[2] >> 5) 289 *nr = (frame[2] >> 5) & 0x07; 305 return frame[2] & 0x1F 290 return frame[2] & 0x1F; 306 } 291 } 307 } 292 } 308 293 309 if (x25->neighbour->extended) { !! 294 if (sk->protinfo.x25->neighbour->extended) { 310 if ((frame[2] & 0x01) == X25_D 295 if ((frame[2] & 0x01) == X25_DATA) { 311 if (!pskb_may_pull(skb << 312 return X25_ILL << 313 frame = skb->data; << 314 << 315 *q = (frame[0] & X25_ 296 *q = (frame[0] & X25_Q_BIT) == X25_Q_BIT; 316 *d = (frame[0] & X25_ 297 *d = (frame[0] & X25_D_BIT) == X25_D_BIT; 317 *m = (frame[3] & X25_ 298 *m = (frame[3] & X25_EXT_M_BIT) == X25_EXT_M_BIT; 318 *nr = (frame[3] >> 1) 299 *nr = (frame[3] >> 1) & 0x7F; 319 *ns = (frame[2] >> 1) 300 *ns = (frame[2] >> 1) & 0x7F; 320 return X25_DATA; 301 return X25_DATA; 321 } 302 } 322 } else { 303 } else { 323 if ((frame[2] & 0x01) == X25_D 304 if ((frame[2] & 0x01) == X25_DATA) { 324 *q = (frame[0] & X25_ 305 *q = (frame[0] & X25_Q_BIT) == X25_Q_BIT; 325 *d = (frame[0] & X25_ 306 *d = (frame[0] & X25_D_BIT) == X25_D_BIT; 326 *m = (frame[2] & X25_ 307 *m = (frame[2] & X25_STD_M_BIT) == X25_STD_M_BIT; 327 *nr = (frame[2] >> 5) 308 *nr = (frame[2] >> 5) & 0x07; 328 *ns = (frame[2] >> 1) 309 *ns = (frame[2] >> 1) & 0x07; 329 return X25_DATA; 310 return X25_DATA; 330 } 311 } 331 } 312 } 332 313 333 pr_debug("invalid PLP frame %3ph\n", f !! 314 printk(KERN_DEBUG "X.25: invalid PLP frame %02X %02X %02X\n", >> 315 frame[0], frame[1], frame[2]); 334 316 335 return X25_ILLEGAL; 317 return X25_ILLEGAL; 336 } 318 } 337 319 338 void x25_disconnect(struct sock *sk, int reaso 320 void x25_disconnect(struct sock *sk, int reason, unsigned char cause, 339 unsigned char diagnostic) 321 unsigned char diagnostic) 340 { 322 { 341 struct x25_sock *x25 = x25_sk(sk); << 342 << 343 x25_clear_queues(sk); 323 x25_clear_queues(sk); 344 x25_stop_timer(sk); 324 x25_stop_timer(sk); 345 325 346 x25->lci = 0; !! 326 sk->protinfo.x25->lci = 0; 347 x25->state = X25_STATE_0; !! 327 sk->protinfo.x25->state = X25_STATE_0; 348 328 349 x25->causediag.cause = cause; !! 329 sk->protinfo.x25->causediag.cause = cause; 350 x25->causediag.diagnostic = diagnostic !! 330 sk->protinfo.x25->causediag.diagnostic = diagnostic; 351 331 352 sk->sk_state = TCP_CLOSE; !! 332 sk->state = TCP_CLOSE; 353 sk->sk_err = reason; !! 333 sk->err = reason; 354 sk->sk_shutdown |= SEND_SHUTDOWN; !! 334 sk->shutdown |= SEND_SHUTDOWN; 355 !! 335 356 if (!sock_flag(sk, SOCK_DEAD)) { !! 336 if (!sk->dead) 357 sk->sk_state_change(sk); !! 337 sk->state_change(sk); 358 sock_set_flag(sk, SOCK_DEAD); !! 338 359 } !! 339 sk->dead = 1; 360 if (x25->neighbour) { << 361 read_lock_bh(&x25_list_lock); << 362 x25_neigh_put(x25->neighbour); << 363 x25->neighbour = NULL; << 364 read_unlock_bh(&x25_list_lock) << 365 } << 366 } 340 } 367 341 368 /* 342 /* 369 * Clear an own-rx-busy condition and tell the 343 * Clear an own-rx-busy condition and tell the peer about this, provided 370 * that there is a significant amount of free 344 * that there is a significant amount of free receive buffer space available. 371 */ 345 */ 372 void x25_check_rbuf(struct sock *sk) 346 void x25_check_rbuf(struct sock *sk) 373 { 347 { 374 struct x25_sock *x25 = x25_sk(sk); !! 348 if (atomic_read(&sk->rmem_alloc) < (sk->rcvbuf / 2) && 375 !! 349 (sk->protinfo.x25->condition & X25_COND_OWN_RX_BUSY)) { 376 if (atomic_read(&sk->sk_rmem_alloc) < !! 350 sk->protinfo.x25->condition &= ~X25_COND_OWN_RX_BUSY; 377 (x25->condition & X25_COND_OWN_RX_ !! 351 sk->protinfo.x25->condition &= ~X25_COND_ACK_PENDING; 378 x25->condition &= ~X25_COND_OW !! 352 sk->protinfo.x25->vl = sk->protinfo.x25->vr; 379 x25->condition &= ~X25_COND_AC << 380 x25->vl = x25->vr; << 381 x25_write_internal(sk, X25_RR) 353 x25_write_internal(sk, X25_RR); 382 x25_stop_timer(sk); 354 x25_stop_timer(sk); 383 } 355 } 384 } 356 } 385 357
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.