Skip to contentSkip to conversation

Mandatory Option Draft Cleanup

PATCH New Hagen Paul Pfeifer 2 participants 3 messages Feb 22, 2006 – Feb 28, 2006 Networking

lore
Share & tools
lore
#0 lore raw

Sorry for the non-informative subject line! ;-)

HGN

Signature · 2 lines
Living on Earth may be expensive, but it includes
an annual free trip around the Sun.
#1 lore raw

PATCH 1/1 Mandatory Option Draft Cleanup

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."

net/dccp/options.c +6 -1
index 7d73b33..3db9aad 100644
@@ -107,7 +107,8 @@ int dccp_parse_options(struct sock *sk, 
 		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)
@@ -247,6 +248,10 @@ int dccp_parse_options(struct sock *sk, 
 			mandatory = 0;
 	}
 
+	/* mandatory was the last byte in option list -> reset connection */
+	if (mandatory)
+		goto out_invalid_option;
+
 	return 0;
 
 out_invalid_option:
#2 lore raw
In reply to Hagen Paul Pfeifer
Quoted 7 lines · Hagen Paul Pfeifer

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."

Quoted 6 lines

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."

Thanks, I got this one merged already, take a look at:

http://www.kernel.org/git/?p=linux/kernel/git/acme/net-2.6.17.git;a=summary

Will submit to Dave later today.

- Arnaldo