Re: [PATCH] WCCPv2 documentation and cleanup for bug 2404

2009-02-06 Thread Henrik Nordstrom

hnordstrom has voted approve.
Status is now: Approved
Comment:
Looks fine from what I can tell by reading the patch.

To answer one of the questions in the patch:

+char buckets[32]; /* Draft indicates 8x 32-bit buckets. ?? */

It's a bitmask. Does not matter if it's defined as 8x32bit or 32x8bit, 
still the same bitmask size.


For details, see: 
http://bundlebuggy.aaronbentley.com/project/squid/request/%3C4968ABB9.4040002%40treenet.co.nz%3E

Project: Squid


[PATCH] WCCPv2 documentation and cleanup for bug 2404

2009-01-10 Thread Amos Jeffries

This patch:
 - adds a reference to each struct mentioning the exact draft
   RFC section where that struct is defined.
 - fixes sent mask structure fields to match draft. (bug 2404)
 - removes two duplicate useless structs

Submitting as a patch to give anyone interested time to double-check the 
code changes.



As a result we are a step closer toward splitting the code into a 
separate library. It's highlighted some of the WCCPv2 issues and a 
pathway forward now clear:

 - move types definitions to a protocol types header (wccp2_types.h ?)
 - correct mangled definitions for generic use. including code in that.
 - add capability handling
 - add hash/mask service negotiation
 - add sibling peer discovery through WCCP group details ??


Amos
--
Please be using
  Current Stable Squid 2.7.STABLE5 or 3.0.STABLE11
  Current Beta Squid 3.1.0.3
=== modified file 'src/wccp2.cc'
--- src/wccp2.cc	2008-10-10 08:02:53 +
+++ src/wccp2.cc	2009-01-10 13:36:20 +
@@ -1,6 +1,5 @@
-
 /*
- * $Id: wccp2.cc,v 1.23 2008/02/09 03:48:05 swilton Exp $
+ * $Id$
  *
  * DEBUG: section 80WCCP Support
  * AUTHOR: Steven Wilton
@@ -34,6 +33,9 @@
  */
 
 #include squid.h
+
+#if USE_WCCPv2
+
 #include comm.h
 #include event.h
 #include Parsing.h
@@ -41,7 +43,6 @@
 #include SwapDir.h
 #include IPAddress.h
 
-#if USE_WCCPv2
 #if HAVE_NETDB_H
 #include netdb.h
 #endif
@@ -58,99 +59,87 @@
 static EVH wccp2AssignBuckets;
 
 /* KDW WCCP V2 */
-#define WCCP2_HERE_I_AM		10
-#define WCCP2_I_SEE_YOU		11
-#define WCCP2_REDIRECT_ASSIGN		12
-#define WCCP2_REMOVAL_QUERY		13
-
-#define WCCP2_VERSION			0x200
-
+
+#define WCCP2_HASH_ASSIGNMENT		0x00
+#define WCCP2_MASK_ASSIGNMENT		0x01
+
+#define	WCCP2_NONE_SECURITY_LEN	0
+#define	WCCP2_MD5_SECURITY_LEN	16
+
+/* Useful defines */
+#define	WCCP2_NUMPORTS	8
+#define	WCCP2_PASSWORD_LEN	8
+
+
+/* WCCPv2 Pakcet format structures */
+/* Defined in draft-wilson-wccp-v2-12-oct-2001.txt */
+
+
+/** \interface WCCPv2_Protocol
+ * Generic header struct
+ */
+struct wccp2_item_header_t {
+uint16_t type;
+uint16_t length;
+};
+
+/* item type values */
 #define WCCP2_SECURITY_INFO		0
-#define WCCP2_NO_SECURITY		0
-#define WCCP2_MD5_SECURITY		1
-
 #define WCCP2_SERVICE_INFO		1
-#define WCCP2_SERVICE_STANDARD		0
-#define WCCP2_SERVICE_DYNAMIC		1
-#define WCCP2_SERVICE_ID_HTTP		0x00
-
-#define WCCP2_SERVICE_SRC_IP_HASH	0x1
-#define WCCP2_SERVICE_DST_IP_HASH	0x2
-#define WCCP2_SERVICE_SRC_PORT_HASH	0x4
-#define WCCP2_SERVICE_DST_PORT_HASH	0x8
-#define WCCP2_SERVICE_PORTS_DEFINED	0x10
-#define WCCP2_SERVICE_PORTS_SOURCE	0x20
-#define WCCP2_SERVICE_SRC_IP_ALT_HASH	0x100
-#define WCCP2_SERVICE_DST_IP_ALT_HASH	0x200
-#define WCCP2_SERVICE_SRC_PORT_ALT_HASH	0x400
-#define WCCP2_SERVICE_DST_PORT_ALT_HASH	0x800
-
 #define WCCP2_ROUTER_ID_INFO		2
-
 #define WCCP2_WC_ID_INFO		3
-
 #define WCCP2_RTR_VIEW_INFO		4
-
 #define WCCP2_WC_VIEW_INFO		5
-
 #define WCCP2_REDIRECT_ASSIGNMENT	6
-
 #define WCCP2_QUERY_INFO		7
-
 #define WCCP2_CAPABILITY_INFO		8
-
 #define WCCP2_ALT_ASSIGNMENT		13
-
 #define WCCP2_ASSIGN_MAP		14
-
 #define WCCP2_COMMAND_EXTENSION		15
 
-#define WCCP2_CAPABILITY_FORWARDING_METHOD	0x01
-#define WCCP2_CAPABILITY_ASSIGNMENT_METHOD	0x02
-#define WCCP2_CAPABILITY_RETURN_METHOD		0x03
-
-#define WCCP2_METHOD_GRE		0x0001
-#define WCCP2_METHOD_L2			0x0002
-
-#define WCCP2_FORWARDING_METHOD_GRE	WCCP2_METHOD_GRE
-#define WCCP2_FORWARDING_METHOD_L2	WCCP2_METHOD_L2
-
-#define WCCP2_ASSIGNMENT_METHOD_HASH	0x0001
-#define WCCP2_ASSIGNMENT_METHOD_MASK	0x0002
-
-#define WCCP2_PACKET_RETURN_METHOD_GRE	WCCP2_METHOD_GRE
-#define WCCP2_PACKET_RETURN_METHOD_L2	WCCP2_METHOD_L2
-
-#define WCCP2_HASH_ASSIGNMENT		0x00
-#define WCCP2_MASK_ASSIGNMENT		0x01
-
-#define	WCCP2_NONE_SECURITY_LEN	0
-#define	WCCP2_MD5_SECURITY_LEN	16
-
-/* Useful defines */
-#define	WCCP2_NUMPORTS	8
-#define	WCCP2_PASSWORD_LEN	8
-
-/* WCCP v2 packet header */
-
-/// \interface WCCPv2_Protocol
-struct wccp2_here_i_am_header_t {
+
+
+/** \interface WCCPv2_Protocol
+ * Sect 5.5  WCCP Message Header
+ */
+struct wccp2_message_header_t {
 uint32_t type;
 uint16_t version;
+#define WCCP2_VERSION  0x200
+
 uint16_t length;
 };
-
-static struct wccp2_here_i_am_header_t wccp2_here_i_am_header;
-
-/* Security struct for the no security option */
-
+static struct wccp2_message_header_t wccp2_here_i_am_header;
+
+/* message types */
+#define WCCP2_HERE_I_AM   10
+#define WCCP2_I_SEE_YOU   11
+#define WCCP2_REDIRECT_ASSIGN 12
+#define WCCP2_REMOVAL_QUERY   13
+
+
+/** \interface WCCPv2_Protocol
+ * Sect 5.6.1 Security Info Component
+ *
+ * Basic security Header. Matches no security case exactly.
+ */
 struct wccp2_security_none_t {
 uint16_t security_type;
 uint16_t security_length;
 uint32_t security_option;
 };
 
-/// \interface WCCPv2_Protocol
+/* security options */
+#define WCCP2_NO_SECURITY		0
+#define WCCP2_MD5_SECURITY		1
+
+
+/** \interface WCCPv2_Protocol
+ * Sect 5.6.1 

Re: [PATCH] WCCPv2 documentation and cleanup for bug 2404

2009-01-10 Thread Bundle Buggy

Bundle Buggy has detected this merge request.

For details, see: 
http://bundlebuggy.aaronbentley.com/project/squid/request/%3C4968ABB9.4040002%40treenet.co.nz%3E

Project: Squid


Re: [PATCH] WCCPv2 documentation and cleanup for bug 2404

2009-01-10 Thread Adrian Chadd
Have you tested these changes against various WCCPv2 implementations?

I do recall some structure definitions in the draft mis-matching the
wide number of IOS versions out there, this is why I'm curious.



Adrian

2009/1/10 Amos Jeffries squ...@treenet.co.nz:
 This patch:
  - adds a reference to each struct mentioning the exact draft
   RFC section where that struct is defined.
  - fixes sent mask structure fields to match draft. (bug 2404)
  - removes two duplicate useless structs

 Submitting as a patch to give anyone interested time to double-check the
 code changes.


 As a result we are a step closer toward splitting the code into a separate
 library. It's highlighted some of the WCCPv2 issues and a pathway forward
 now clear:
  - move types definitions to a protocol types header (wccp2_types.h ?)
  - correct mangled definitions for generic use. including code in that.
  - add capability handling
  - add hash/mask service negotiation
  - add sibling peer discovery through WCCP group details ??


 Amos
 --
 Please be using
  Current Stable Squid 2.7.STABLE5 or 3.0.STABLE11
  Current Beta Squid 3.1.0.3



Re: [PATCH] WCCPv2 documentation and cleanup for bug 2404

2009-01-10 Thread Amos Jeffries

Adrian Chadd wrote:

Have you tested these changes against various WCCPv2 implementations?

I do recall some structure definitions in the draft mis-matching the
wide number of IOS versions out there, this is why I'm curious.



I have no testing capability. Thus I'm not committing until someone can 
confirm it works.


Amos




Adrian

2009/1/10 Amos Jeffries squ...@treenet.co.nz:

This patch:
 - adds a reference to each struct mentioning the exact draft
  RFC section where that struct is defined.
 - fixes sent mask structure fields to match draft. (bug 2404)
 - removes two duplicate useless structs

Submitting as a patch to give anyone interested time to double-check the
code changes.


As a result we are a step closer toward splitting the code into a separate
library. It's highlighted some of the WCCPv2 issues and a pathway forward
now clear:
 - move types definitions to a protocol types header (wccp2_types.h ?)
 - correct mangled definitions for generic use. including code in that.
 - add capability handling
 - add hash/mask service negotiation
 - add sibling peer discovery through WCCP group details ??


Amos
--
Please be using
 Current Stable Squid 2.7.STABLE5 or 3.0.STABLE11
 Current Beta Squid 3.1.0.3




--
Please be using
  Current Stable Squid 2.7.STABLE5 or 3.0.STABLE11
  Current Beta Squid 3.1.0.3


Re: [PATCH] WCCPv2 documentation and cleanup for bug 2404

2009-01-10 Thread Amos Jeffries

Amos Jeffries wrote:

Adrian Chadd wrote:

Have you tested these changes against various WCCPv2 implementations?

I do recall some structure definitions in the draft mis-matching the
wide number of IOS versions out there, this is why I'm curious.



I have no testing capability. Thus I'm not committing until someone can 
confirm it works.


PS. I found your notes in the mask structure and the way received masks 
appears to operate does look markedly different to the draft. I haven't 
touched that one other than to document the anomaly a bit more.


Amos



Adrian

2009/1/10 Amos Jeffries squ...@treenet.co.nz:

This patch:
 - adds a reference to each struct mentioning the exact draft
  RFC section where that struct is defined.
 - fixes sent mask structure fields to match draft. (bug 2404)
 - removes two duplicate useless structs

Submitting as a patch to give anyone interested time to double-check the
code changes.


As a result we are a step closer toward splitting the code into a 
separate
library. It's highlighted some of the WCCPv2 issues and a pathway 
forward

now clear:
 - move types definitions to a protocol types header (wccp2_types.h ?)
 - correct mangled definitions for generic use. including code in that.
 - add capability handling
 - add hash/mask service negotiation
 - add sibling peer discovery through WCCP group details ??


Amos
--
Please be using
 Current Stable Squid 2.7.STABLE5 or 3.0.STABLE11
 Current Beta Squid 3.1.0.3







--
Please be using
  Current Stable Squid 2.7.STABLE5 or 3.0.STABLE11
  Current Beta Squid 3.1.0.3