Commit 386e50cc authored by Andrew Hendry's avatar Andrew Hendry Committed by David S. Miller

X25: Enable setting of cause and diagnostic fields

Adds SIOCX25SCAUSEDIAG, allowing X.25 programs to set the cause and
diagnostic fields.

Normally used to indicate status upon closing connections.
Signed-off-by: default avatarAndrew Hendry <andrew.hendry@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0e481747
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9) #define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9)
#define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10) #define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10)
#define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11) #define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11)
#define SIOCX25SCAUSEDIAG (SIOCPROTOPRIVATE + 12)
/* /*
* Values for {get,set}sockopt. * Values for {get,set}sockopt.
......
...@@ -1471,6 +1471,17 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1471,6 +1471,17 @@ static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
break; break;
} }
case SIOCX25SCAUSEDIAG: {
struct x25_causediag causediag;
rc = -EFAULT;
if (copy_from_user(&causediag, argp, sizeof(causediag)))
break;
x25->causediag = causediag;
rc = 0;
break;
}
case SIOCX25SCUDMATCHLEN: { case SIOCX25SCUDMATCHLEN: {
struct x25_subaddr sub_addr; struct x25_subaddr sub_addr;
rc = -EINVAL; rc = -EINVAL;
...@@ -1639,6 +1650,7 @@ static int compat_x25_ioctl(struct socket *sock, unsigned int cmd, ...@@ -1639,6 +1650,7 @@ static int compat_x25_ioctl(struct socket *sock, unsigned int cmd,
case SIOCX25GCALLUSERDATA: case SIOCX25GCALLUSERDATA:
case SIOCX25SCALLUSERDATA: case SIOCX25SCALLUSERDATA:
case SIOCX25GCAUSEDIAG: case SIOCX25GCAUSEDIAG:
case SIOCX25SCAUSEDIAG:
case SIOCX25SCUDMATCHLEN: case SIOCX25SCUDMATCHLEN:
case SIOCX25CALLACCPTAPPRV: case SIOCX25CALLACCPTAPPRV:
case SIOCX25SENDCALLACCPT: case SIOCX25SENDCALLACCPT:
......
...@@ -225,6 +225,12 @@ void x25_write_internal(struct sock *sk, int frametype) ...@@ -225,6 +225,12 @@ void x25_write_internal(struct sock *sk, int frametype)
break; break;
case X25_CLEAR_REQUEST: case X25_CLEAR_REQUEST:
dptr = skb_put(skb, 3);
*dptr++ = frametype;
*dptr++ = x25->causediag.cause;
*dptr++ = x25->causediag.diagnostic;
break;
case X25_RESET_REQUEST: case X25_RESET_REQUEST:
dptr = skb_put(skb, 3); dptr = skb_put(skb, 3);
*dptr++ = frametype; *dptr++ = frametype;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment