From e308faf24f68e262d92d294a01ddca7a17e76762 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Sun, 20 Jul 1997 14:56:40 +0000 Subject: Sync with Linux 2.1.46. --- net/rose/rose_subr.c | 56 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 21 deletions(-) (limited to 'net/rose/rose_subr.c') diff --git a/net/rose/rose_subr.c b/net/rose/rose_subr.c index 4e0530cb4..ee710bd6e 100644 --- a/net/rose/rose_subr.c +++ b/net/rose/rose_subr.c @@ -1,5 +1,5 @@ /* - * ROSE release 002 + * ROSE release 003 * * This code REQUIRES 2.1.15 or higher/ NET3.038 * @@ -11,6 +11,8 @@ * * History * ROSE 001 Jonathan(G4KLX) Cloned from nr_subr.c + * ROSE 002 Jonathan(G4KLX) Centralised disconnect processing. + * ROSE 003 Jonathan(G4KLX) Added use count to neighbours. */ #include @@ -92,12 +94,8 @@ void rose_write_internal(struct sock *sk, int frametype) case ROSE_CALL_ACCEPTED: case ROSE_CLEAR_REQUEST: case ROSE_RESET_REQUEST: - case ROSE_DIAGNOSTIC: len += 2; break; - case ROSE_INTERRUPT: - len += 1; - break; } if ((skb = alloc_skb(len, GFP_ATOMIC)) == NULL) @@ -137,24 +135,23 @@ void rose_write_internal(struct sock *sk, int frametype) break; case ROSE_CLEAR_REQUEST: - case ROSE_RESET_REQUEST: *dptr++ = ROSE_GFI | lci1; *dptr++ = lci2; *dptr++ = frametype; - *dptr++ = 0x00; /* XXX */ - *dptr++ = 0x00; /* XXX */ + *dptr++ = sk->protinfo.rose->cause; + *dptr++ = sk->protinfo.rose->diagnostic; break; - case ROSE_INTERRUPT: + case ROSE_RESET_REQUEST: *dptr++ = ROSE_GFI | lci1; *dptr++ = lci2; *dptr++ = frametype; - *dptr++ = 0x00; /* XXX */ + *dptr++ = ROSE_DTE_ORIGINATED; + *dptr++ = 0; break; case ROSE_RR: case ROSE_RNR: - case ROSE_REJ: *dptr++ = ROSE_GFI | lci1; *dptr++ = lci2; *dptr = frametype; @@ -162,7 +159,6 @@ void rose_write_internal(struct sock *sk, int frametype) break; case ROSE_CLEAR_CONFIRMATION: - case ROSE_INTERRUPT_CONFIRMATION: case ROSE_RESET_CONFIRMATION: *dptr++ = ROSE_GFI | lci1; *dptr++ = lci2; @@ -191,23 +187,15 @@ int rose_decode(struct sk_buff *skb, int *ns, int *nr, int *q, int *d, int *m) case ROSE_CALL_ACCEPTED: case ROSE_CLEAR_REQUEST: case ROSE_CLEAR_CONFIRMATION: - case ROSE_INTERRUPT: - case ROSE_INTERRUPT_CONFIRMATION: case ROSE_RESET_REQUEST: case ROSE_RESET_CONFIRMATION: - case ROSE_RESTART_REQUEST: - case ROSE_RESTART_CONFIRMATION: - case ROSE_REGISTRATION_REQUEST: - case ROSE_REGISTRATION_CONFIRMATION: - case ROSE_DIAGNOSTIC: return frame[2]; default: break; } if ((frame[2] & 0x1F) == ROSE_RR || - (frame[2] & 0x1F) == ROSE_RNR || - (frame[2] & 0x1F) == ROSE_REJ) { + (frame[2] & 0x1F) == ROSE_RNR) { *nr = (frame[2] >> 5) & 0x07; return frame[2] & 0x1F; } @@ -437,4 +425,30 @@ int rose_create_facilities(unsigned char *buffer, rose_cb *rose) return len; } +void rose_disconnect(struct sock *sk, int reason, int cause, int diagnostic) +{ + rose_stop_timer(sk); + rose_stop_idletimer(sk); + + rose_clear_queues(sk); + + sk->protinfo.rose->lci = 0; + sk->protinfo.rose->state = ROSE_STATE_0; + + if (cause != -1) + sk->protinfo.rose->cause = cause; + + if (diagnostic != -1) + sk->protinfo.rose->diagnostic = diagnostic; + + sk->state = TCP_CLOSE; + sk->err = reason; + sk->shutdown |= SEND_SHUTDOWN; + + if (!sk->dead) + sk->state_change(sk); + + sk->dead = 1; +} + #endif -- cgit v1.2.3