From patchwork Wed Nov 18 23:24:01 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrew hendry X-Patchwork-Id: 38791 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 37F151007D1 for ; Thu, 19 Nov 2009 10:24:13 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757017AbZKRXX4 (ORCPT ); Wed, 18 Nov 2009 18:23:56 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752980AbZKRXX4 (ORCPT ); Wed, 18 Nov 2009 18:23:56 -0500 Received: from mail-px0-f180.google.com ([209.85.216.180]:39631 "EHLO mail-px0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752532AbZKRXXz (ORCPT ); Wed, 18 Nov 2009 18:23:55 -0500 Received: by pxi10 with SMTP id 10so1169255pxi.33 for ; Wed, 18 Nov 2009 15:24:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=SodHIP/3xXacSborfpU77t0bkYR96zjfSX5Nm2BCXRM=; b=tX/q2JuLo5DhwoRpIjwAFpcWMNJ4SLp7ebIxJWGoNSrqtEnm20ACpFe6Dqo7+Uvr/C 3v4qucq288+z7hRpYhegS2P1DrXD8ZufHYmMeX3VydL7uHmjWdlEoiyEILSo6v1H8MSx 9qiFd67/gfFmMTqEgae1xyuZZ200ngfYIjvjs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=phsZXoDSbYeC67tVApq5HIP6p0NWgTNBwrfFV93EdJ0o2gauZZwILNJiXKGuvP2Tuu heJsGVuGOMXP3P/R9nFoag46zE1+x0nhmm4vLnqrAeDx6iqdd9cdKeDMojKM6nmXld5W ugJJcX35CAfzoLkBpykEHhemur2rsGiaWoiDE= MIME-Version: 1.0 Received: by 10.142.7.12 with SMTP id 12mr1337045wfg.328.1258586641328; Wed, 18 Nov 2009 15:24:01 -0800 (PST) In-Reply-To: <20091113.203248.84989794.davem@davemloft.net> References: <20091113.203248.84989794.davem@davemloft.net> Date: Thu, 19 Nov 2009 10:24:01 +1100 Message-ID: Subject: Re: [PATCH] X25: Enable setting of cause and diagnostic fields From: andrew hendry To: David Miller Cc: netdev@vger.kernel.org, linux-x25@vger.kernel.org, linux-kernel@vger.kernel.org Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Thanks, will make sure to check 32/64 in the future. 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 On Sat, Nov 14, 2009 at 3:32 PM, David Miller wrote: > From: andrew hendry > Date: Thu, 12 Nov 2009 11:13:27 +1100 > >> 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 > > This change is incomplete. > > You need to add handling to compat_x25_ioctl(). > --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -uprN -X a/Documentation/dontdiff a/include/linux/x25.h b/include/linux/x25.h --- a/include/linux/x25.h 2009-11-16 13:44:41.138892908 +1100 +++ b/include/linux/x25.h 2009-11-11 16:05:06.625958557 +1100 @@ -25,6 +25,7 @@ #define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9) #define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10) #define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11) +#define SIOCX25SCAUSEDIAG (SIOCPROTOPRIVATE + 12) /* * Values for {get,set}sockopt. diff -uprN -X a/Documentation/dontdiff a/net/x25/af_x25.c b/net/x25/af_x25.c --- a/net/x25/af_x25.c 2009-11-16 13:44:41.745816123 +1100 +++ b/net/x25/af_x25.c 2009-11-16 13:49:51.277655328 +1100 @@ -1430,6 +1430,17 @@ static int x25_ioctl(struct socket *sock 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: { struct x25_subaddr sub_addr; rc = -EINVAL; @@ -1587,6 +1598,7 @@ static int compat_x25_ioctl(struct socke case SIOCX25GCALLUSERDATA: case SIOCX25SCALLUSERDATA: case SIOCX25GCAUSEDIAG: + case SIOCX25SCAUSEDIAG: case SIOCX25SCUDMATCHLEN: case SIOCX25CALLACCPTAPPRV: case SIOCX25SENDCALLACCPT: diff -uprN -X a/Documentation/dontdiff a/net/x25/x25_subr.c b/net/x25/x25_subr.c --- a/net/x25/x25_subr.c 2009-11-16 13:44:42.337741236 +1100 +++ b/net/x25/x25_subr.c 2009-11-11 16:28:30.316150252 +1100 @@ -225,6 +225,12 @@ void x25_write_internal(struct sock *sk, break; case X25_CLEAR_REQUEST: + dptr = skb_put(skb, 3); + *dptr++ = frametype; + *dptr++ = x25->causediag.cause; + *dptr++ = x25->causediag.diagnostic; + break; + case X25_RESET_REQUEST: dptr = skb_put(skb, 3); *dptr++ = frametype;