Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7c559a9e44ee61faf2f339604ce708decb345a93
Commit:     7c559a9e44ee61faf2f339604ce708decb345a93
Parent:     bc8498721dfe3f7d537f4f75302be7dbe9c7b939
Author:     Gerrit Renker <[EMAIL PROTECTED]>
AuthorDate: Thu Oct 4 14:39:22 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Oct 10 16:54:31 2007 -0700

    [DCCP]: Add socket option to query the current MPS
    
    This enables applications to query the current value of the Maximum
    Packet Size via a socket option, suggested as a SHOULD in (RFC 4340,
    p. 102).
    
    This socket option is useful to avoid the annoying bail-out via
    `-EMSGSIZE'.  In particular, as fragmentation is not currently
    supported (and its use is partly discouraged in RFC 4340).
    
    With this option, it is possible to size buffers accordingly, e.g.
    
        int buflen = dccp_get_cur_mps(sockfd);
    
        /* or */
        if (msgsize > dccp_get_cur_mps(sockfd))
                die("message is too large for this path");
    
    Signed-off-by: Gerrit Renker <[EMAIL PROTECTED]>
    Signed-off-by: Ian McDonald <[EMAIL PROTECTED]>
    Signed-off-by: Arnaldo Carvalho de Melo <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 Documentation/networking/dccp.txt |    3 +++
 include/linux/dccp.h              |    1 +
 net/dccp/proto.c                  |    4 ++++
 3 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/Documentation/networking/dccp.txt 
b/Documentation/networking/dccp.txt
index 477026a..f915718 100644
--- a/Documentation/networking/dccp.txt
+++ b/Documentation/networking/dccp.txt
@@ -41,6 +41,9 @@ the socket will fall back to 0 (which means that no 
meaningful service code
 is present). Connecting sockets set at most one service option; for
 listening sockets, multiple service codes can be specified.
 
+DCCP_SOCKOPT_GET_CUR_MPS is read-only and retrieves the current maximum packet
+size (application payload size) in bytes, see RFC 4340, section 14.
+
 DCCP_SOCKOPT_SEND_CSCOV and DCCP_SOCKOPT_RECV_CSCOV are used for setting the
 partial checksum coverage (RFC 4340, sec. 9.2). The default is that checksums
 always cover the entire packet and that only fully covered application data is
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 4ed82e2..0e44a3e 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -202,6 +202,7 @@ struct dccp_so_feat {
 #define DCCP_SOCKOPT_SERVICE           2
 #define DCCP_SOCKOPT_CHANGE_L          3
 #define DCCP_SOCKOPT_CHANGE_R          4
+#define DCCP_SOCKOPT_GET_CUR_MPS       5
 #define DCCP_SOCKOPT_SEND_CSCOV                10
 #define DCCP_SOCKOPT_RECV_CSCOV                11
 #define DCCP_SOCKOPT_CCID_RX_INFO      128
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 7e4f54a..c0b685e 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -587,6 +587,10 @@ static int do_dccp_getsockopt(struct sock *sk, int level, 
int optname,
        case DCCP_SOCKOPT_SERVICE:
                return dccp_getsockopt_service(sk, len,
                                               (__be32 __user *)optval, optlen);
+       case DCCP_SOCKOPT_GET_CUR_MPS:
+               val = dp->dccps_mss_cache;
+               len = sizeof(val);
+               break;
        case DCCP_SOCKOPT_SEND_CSCOV:
                val = dp->dccps_pcslen;
                len = sizeof(val);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to