aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/options.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2006-03-20 22:06:02 -0800
committerDavid S. Miller <davem@davemloft.net>2006-03-20 22:06:02 -0800
commit6df9424a9ca35f9fab773d1a0a8919781a367125 (patch)
tree3c577a45046f9daeb574a76df704f88f76175faf /net/dccp/options.c
parent[DCCP] ccid2: coding style cleanups (diff)
downloadlinux-dev-6df9424a9ca35f9fab773d1a0a8919781a367125.tar.xz
linux-dev-6df9424a9ca35f9fab773d1a0a8919781a367125.zip
[DCCP] options: Fix some aspects of mandatory option processing
According to dccp draft (draft-ietf-dccp-spec-13.txt) section 5.8.2 (Mandatory Option) the following patch correct the handling of the following cases: 1) "... and any Mandatory options received on DCCP-Data packets MUST be ignored." 2) "The connection is in error and should be reset with Reset Code 5, ... if option O is absent (Mandatory was the last byte of the option list), or if option O equals Mandatory." Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/options.c')
-rw-r--r--net/dccp/options.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/dccp/options.c b/net/dccp/options.c
index 79d228e4d6b2..8867b6f43220 100644
--- a/net/dccp/options.c
+++ b/net/dccp/options.c
@@ -109,7 +109,8 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
case DCCPO_MANDATORY:
if (mandatory)
goto out_invalid_option;
- mandatory = 1;
+ if (pkt_type != DCCP_PKT_DATA)
+ mandatory = 1;
break;
case DCCPO_NDP_COUNT:
if (len > 3)
@@ -249,6 +250,10 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
mandatory = 0;
}
+ /* mandatory was the last byte in option list -> reset connection */
+ if (mandatory)
+ goto out_invalid_option;
+
return 0;
out_invalid_option: