Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Andrew Hendry <andrew.hendry@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Andrew Hendry and committed by
David S. Miller
386e50cc 0e481747

+19
+1
include/linux/x25.h
··· 25 25 #define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9) 26 26 #define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10) 27 27 #define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11) 28 + #define SIOCX25SCAUSEDIAG (SIOCPROTOPRIVATE + 12) 28 29 29 30 /* 30 31 * Values for {get,set}sockopt.
+12
net/x25/af_x25.c
··· 1471 1471 break; 1472 1472 } 1473 1473 1474 + case SIOCX25SCAUSEDIAG: { 1475 + struct x25_causediag causediag; 1476 + rc = -EFAULT; 1477 + if (copy_from_user(&causediag, argp, sizeof(causediag))) 1478 + break; 1479 + x25->causediag = causediag; 1480 + rc = 0; 1481 + break; 1482 + 1483 + } 1484 + 1474 1485 case SIOCX25SCUDMATCHLEN: { 1475 1486 struct x25_subaddr sub_addr; 1476 1487 rc = -EINVAL; ··· 1650 1639 case SIOCX25GCALLUSERDATA: 1651 1640 case SIOCX25SCALLUSERDATA: 1652 1641 case SIOCX25GCAUSEDIAG: 1642 + case SIOCX25SCAUSEDIAG: 1653 1643 case SIOCX25SCUDMATCHLEN: 1654 1644 case SIOCX25CALLACCPTAPPRV: 1655 1645 case SIOCX25SENDCALLACCPT:
+6
net/x25/x25_subr.c
··· 225 225 break; 226 226 227 227 case X25_CLEAR_REQUEST: 228 + dptr = skb_put(skb, 3); 229 + *dptr++ = frametype; 230 + *dptr++ = x25->causediag.cause; 231 + *dptr++ = x25->causediag.diagnostic; 232 + break; 233 + 228 234 case X25_RESET_REQUEST: 229 235 dptr = skb_put(skb, 3); 230 236 *dptr++ = frametype;