net/x25: fix called/calling length calculation in x25_parse_address_block
Subsystems (3)
Martin Schiller
maintainerPATCH 1/3 net/x25: fix called/calling length calculation in x25_parse_address_block
The length of the called and calling address was not calculated correctly (BCD encoding).
--- net/x25/af_x25.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/x25/af_x25.c +1 -1
@@ -100,7 +100,7 @@ int x25_parse_address_block(struct sk_buff *skb, } len = *skb->data; - needed =1 + (len >>4 ) + (len &0x0f ); + needed =1 + ((len >>4 ) + (len &0x0f ) +1 ) /2 ;if (!pskb_may_pull (skb, needed)) {/* packet is too short to hold the addresses it claims
Signature · 1 line
2.11.0
Martin Schiller
maintainerPATCH 2/3 net/x25: fix null_x25_address handling
o x25_find_listener(): the compare for the null_x25_address was wrong. We have to check the x25_addr of the listener socket instead of the x25_addr of the incomming call.
o x25_bind(): it was not possible to bind a socket to null_x25_address
--- net/x25/af_x25.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
net/x25/af_x25.c +10 -6
@@ -288,7 +288,7 @@ static struct sock *x25_find_listener(struct x25_address *addr,sk_for_each (s, &x25_list)if ((!strcmp (addr->x25_addr,x25_sk (s)->source_addr.x25_addr) || - !strcmp (addr->x25_addr, + !strcmp (x25_sk (s)->source_addr.x25_addr, null_x25_address.x25_addr)) && s->sk_state ==TCP_LISTEN ) {/*
@@ -688,11 +688,15 @@ static int x25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) goto out; } - len =strlen (addr->sx25_addr.x25_addr); -for (i =0 ; i < len; i++) { -if (!isdigit (addr->sx25_addr.x25_addr[i])) { - rc = -EINVAL ; - goto out; +/* check for the null_x25_address */ +if (strcmp (addr->sx25_addr.x25_addr, null_x25_address.x25_addr)) { + + len =strlen (addr->sx25_addr.x25_addr); +for (i =0 ; i < len; i++) { +if (!isdigit (addr->sx25_addr.x25_addr[i])) { + rc = -EINVAL ; + goto out; + } } }
Signature · 1 line
2.11.0
Re: [PATCH 2/3] net/x25: fix null_x25_address handling
From: Martin Schiller <[email protected]>
Date: Tue, 27 Nov 2018 09:50:28 +0100
Quoted 7 lines
o
x25_find_listener(): the compare for thenull_x25_addresswas wrong. We have to check thex25_addrof the listener socket instead of thex25_addrof the incomming call.o
x25_bind(): it was not possible to bind a socket tonull_x25_addressSigned-off-by Martin Schiller <[email protected]>
Applied.
Martin Schiller
maintainerPATCH 3/3 net/x25: handle call collisions
In reply to Martin SchillerIf a session in X25_STATE_1 (Awaiting Call Accept) receives a call request, the session will be closed (x25_disconnect), cause=0x01 (Number Busy) and diag=0x48 (Call Collision) will be set and a clear request will be send.
--- net/x25/x25_in.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/x25/x25_in.c +9 -0
@@ -142,6 +142,15 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp sk->sk_state_change (sk);break ; } +case X25_CALL_REQUEST : +/* call collision */ + x25->causediag.cause =0x01 ; + x25->causediag.diagnostic =0x48 ; + +x25_write_internal (sk,X25_CLEAR_REQUEST ); +x25_disconnect (sk,EISCONN ,0x01 ,0x48 ); +break ; +case X25_CLEAR_REQUEST :if (!pskb_may_pull (skb,X25_STD_MIN_LEN +2 )) goto out_clear;
Signature · 1 line
2.11.0
Re: [PATCH 3/3] net/x25: handle call collisions
From: Martin Schiller <[email protected]>
Date: Tue, 27 Nov 2018 09:50:29 +0100
Quoted 6 lines
If a session in
X25_STATE_1(Awaiting Call Accept) receives a call request, the session will be closed (x25_disconnect), cause=0x01 (Number Busy) and diag=0x48 (Call Collision) will be set and a clear request will be send.Signed-off-by Martin Schiller <[email protected]>
Applied.
From: Martin Schiller <[email protected]>
Date: Tue, 27 Nov 2018 09:50:27 +0100
Quoted 4 lines
The length of the called and calling address was not calculated correctly (BCD encoding).
Signed-off-by Martin Schiller <[email protected]>
Applied.