aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2007-10-04 17:39:22 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:54:31 -0400
commit7c559a9e44ee61faf2f339604ce708decb345a93 (patch)
tree8e0e89521445a42cf801747af20be172b6e9e582 /net
parentbc8498721dfe3f7d537f4f75302be7dbe9c7b939 (diff)
[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 <gerrit@erg.abdn.ac.uk> Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/dccp/proto.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 7e4f54a4ecaf..c0b685efe245 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,
587 case DCCP_SOCKOPT_SERVICE: 587 case DCCP_SOCKOPT_SERVICE:
588 return dccp_getsockopt_service(sk, len, 588 return dccp_getsockopt_service(sk, len,
589 (__be32 __user *)optval, optlen); 589 (__be32 __user *)optval, optlen);
590 case DCCP_SOCKOPT_GET_CUR_MPS:
591 val = dp->dccps_mss_cache;
592 len = sizeof(val);
593 break;
590 case DCCP_SOCKOPT_SEND_CSCOV: 594 case DCCP_SOCKOPT_SEND_CSCOV:
591 val = dp->dccps_pcslen; 595 val = dp->dccps_pcslen;
592 len = sizeof(val); 596 len = sizeof(val);