aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2006-03-21 01:06:02 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-21 01:06:02 -0500
commit6df9424a9ca35f9fab773d1a0a8919781a367125 (patch)
tree3c577a45046f9daeb574a76df704f88f76175faf
parentc0c736db7ef4a7bdc1a28f3de751cc7e9f720313 (diff)
[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>
-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)
109 case DCCPO_MANDATORY: 109 case DCCPO_MANDATORY:
110 if (mandatory) 110 if (mandatory)
111 goto out_invalid_option; 111 goto out_invalid_option;
112 mandatory = 1; 112 if (pkt_type != DCCP_PKT_DATA)
113 mandatory = 1;
113 break; 114 break;
114 case DCCPO_NDP_COUNT: 115 case DCCPO_NDP_COUNT:
115 if (len > 3) 116 if (len > 3)
@@ -249,6 +250,10 @@ int dccp_parse_options(struct sock *sk, struct sk_buff *skb)
249 mandatory = 0; 250 mandatory = 0;
250 } 251 }
251 252
253 /* mandatory was the last byte in option list -> reset connection */
254 if (mandatory)
255 goto out_invalid_option;
256
252 return 0; 257 return 0;
253 258
254out_invalid_option: 259out_invalid_option: