WCCP config cleanups mk2 - clean of the additional extras slipped in last time. - corrected according to Adrians updated info
Amos
# Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: [EMAIL PROTECTED] # target_branch: file:///src/squid/bzr/trunk/ # testament_sha1: a498a9a51a706bf7632ed8248d8ccf8f44f5684f # timestamp: 2008-09-12 20:15:11 +1200 # base_revision_id: [EMAIL PROTECTED] # bmvbzbywqmjrun2v # # Begin patch === modified file 'src/cf.data.depend' --- src/cf.data.depend 2008-04-03 05:31:29 +0000 +++ src/cf.data.depend 2008-09-12 08:14:32 +0000 @@ -47,6 +47,8 @@ tristate uri_whitespace ushort +wccp2_method +wccp2_amethod wccp2_service wccp2_service_info wordlist === modified file 'src/cf.data.pre' --- src/cf.data.pre 2008-09-03 13:22:55 +0000 +++ src/cf.data.pre 2008-09-12 01:14:37 +0000 @@ -3957,7 +3957,17 @@ LOC: Config.Wccp.router DEFAULT: 0.0.0.0 IFDEF: USE_WCCP -DOC_NONE +DOC_START + Use this option to define your WCCP ``home'' router for + Squid. + + wccp_router supports a single WCCP(v1) router + + wccp2_router supports multiple WCCPv2 routers + + only one of the two may be used at the same time and defines + which version of WCCP to use. +DOC_END NAME: wccp2_router TYPE: IPAddress_list @@ -4005,33 +4015,33 @@ DOC_END NAME: wccp2_forwarding_method -TYPE: int +TYPE: wccp2_method LOC: Config.Wccp2.forwarding_method -DEFAULT: 1 +DEFAULT: gre IFDEF: USE_WCCPv2 DOC_START WCCP2 allows the setting of forwarding methods between the router/switch and the cache. Valid values are as follows: - 1 - GRE encapsulation (forward the packet in a GRE/WCCP tunnel) - 2 - L2 redirect (forward the packet using Layer 2/MAC rewriting) + gre - GRE encapsulation (forward the packet in a GRE/WCCP tunnel) + l2 - L2 redirect (forward the packet using Layer 2/MAC rewriting) Currently (as of IOS 12.4) cisco routers only support GRE. Cisco switches only support the L2 redirect assignment method. DOC_END NAME: wccp2_return_method -TYPE: int +TYPE: wccp2_method LOC: Config.Wccp2.return_method -DEFAULT: 1 +DEFAULT: gre IFDEF: USE_WCCPv2 DOC_START WCCP2 allows the setting of return methods between the router/switch and the cache for packets that the cache decides not to handle. Valid values are as follows: - 1 - GRE encapsulation (forward the packet in a GRE/WCCP tunnel) - 2 - L2 redirect (forward the packet using Layer 2/MAC rewriting) + gre - GRE encapsulation (forward the packet in a GRE/WCCP tunnel) + l2 - L2 redirect (forward the packet using Layer 2/MAC rewriting) Currently (as of IOS 12.4) cisco routers only support GRE. Cisco switches only support the L2 redirect assignment. @@ -4043,16 +4053,16 @@ DOC_END NAME: wccp2_assignment_method -TYPE: int +TYPE: wccp2_amethod LOC: Config.Wccp2.assignment_method -DEFAULT: 1 +DEFAULT: hash IFDEF: USE_WCCPv2 DOC_START WCCP2 allows the setting of methods to assign the WCCP hash Valid values are as follows: - 1 - Hash assignment - 2 - Mask assignment + hash - Hash assignment + mask - Mask assignment As a general rule, cisco routers support the hash assignment method and cisco switches support the mask assignment method. === modified file 'src/protos.h' --- src/protos.h 2008-09-03 04:40:31 +0000 +++ src/protos.h 2008-09-12 01:14:37 +0000 @@ -813,10 +813,16 @@ SQUIDCEXTERN char *strtokFile(void); #if USE_WCCPv2 + +SQUIDCEXTERN void parse_wccp2_method(int *v); +SQUIDCEXTERN void free_wccp2_method(int *v); +SQUIDCEXTERN void dump_wccp2_method(StoreEntry * e, const char *label, int v); +SQUIDCEXTERN void parse_wccp2_amethod(int *v); +SQUIDCEXTERN void free_wccp2_amethod(int *v); +SQUIDCEXTERN void dump_wccp2_amethod(StoreEntry * e, const char *label, int v); + SQUIDCEXTERN void parse_wccp2_service(void *v); - SQUIDCEXTERN void free_wccp2_service(void *v); - SQUIDCEXTERN void dump_wccp2_service(StoreEntry * e, const char *label, void *v); SQUIDCEXTERN int check_null_wccp2_service(void *v); === modified file 'src/wccp2.cc' --- src/wccp2.cc 2008-08-13 03:24:57 +0000 +++ src/wccp2.cc 2008-09-12 08:14:32 +0000 @@ -109,14 +109,17 @@ #define WCCP2_CAPABILITY_ASSIGNMENT_METHOD 0x02 #define WCCP2_CAPABILITY_RETURN_METHOD 0x03 -#define WCCP2_FORWARDING_METHOD_GRE 0x00000001 -#define WCCP2_FORWARDING_METHOD_L2 0x00000002 - -#define WCCP2_ASSIGNMENT_METHOD_HASH 0x00000001 -#define WCCP2_ASSIGNMENT_METHOD_MASK 0x00000002 - -#define WCCP2_PACKET_RETURN_METHOD_GRE 0x00000001 -#define WCCP2_PACKET_RETURN_METHOD_L2 0x00000002 +#define WCCP2_METHOD_GRE 0x00000001 +#define WCCP2_METHOD_L2 0x00000002 + +#define WCCP2_FORWARDING_METHOD_GRE WCCP2_METHOD_GRE +#define WCCP2_FORWARDING_METHOD_L2 WCCP2_METHOD_L2 + +#define WCCP2_ASSIGNMENT_METHOD_HASH 0x00000001 +#define WCCP2_ASSIGNMENT_METHOD_MASK 0x00000002 + +#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 @@ -1989,6 +1992,102 @@ * Configuration option parsing code */ +/** + * Parse wccp2_return_method and wccp2_forwarding_method options + * they can be '1' aka 'gre' or '2' aka 'l2' + * repesenting the integer numeric of the same. + */ +void +parse_wccp2_method(int *method) +{ + char *t; + + /* Snarf the method */ + if ((t = strtok(NULL, w_space)) == NULL) { + debugs(80, DBG_CRITICAL, "wccp2_*_method: missing setting."); + self_destruct(); + } + + /* update configuration if its valid */ + if (strcmp(t, "gre") == 0 || strcmp(t, "1") == 0) { + *method = WCCP2_METHOD_GRE; + } else if (strcmp(t, "l2") == 0 || strcmp(t, "2") == 0) { + *method = WCCP2_METHOD_L2; + } else { + debugs(80, DBG_CRITICAL, "wccp2_*_method: unknown setting, got " << t ); + self_destruct(); + } +} + +void +dump_wccp2_method(StoreEntry * e, const char *label, int v) +{ + switch(v) + { + case WCCP2_METHOD_GRE: + storeAppendPrintf(e, "%s gre\n", label); + break; + case WCCP2_METHOD_L2: + storeAppendPrintf(e, "%s l2\n", label); + break; + default: + debugs(80, DBG_CRITICAL, "FATAL: WCCPv2 configured method (" << v << ") is not valid."); + self_destruct(); + } +} + +void +free_wccp2_method(int *v) +{ } + +/** + * Parse wccp2_assignment_method option + * they can be '1' aka 'hash' or '2' aka 'mask' + * repesenting the integer numeric of the same. + */ +void +parse_wccp2_amethod(int *method) +{ + char *t; + + /* Snarf the method */ + if ((t = strtok(NULL, w_space)) == NULL) { + debugs(80, DBG_CRITICAL, "wccp2_assignment_method: missing setting."); + self_destruct(); + } + + /* update configuration if its valid */ + if (strcmp(t, "hash") == 0 || strcmp(t, "1") == 0) { + *method = WCCP2_ASSIGNMENT_METHOD_HASH; + } else if (strcmp(t, "mask") == 0 || strcmp(t, "2") == 0) { + *method = WCCP2_ASSIGNMENT_METHOD_MASK; + } else { + debugs(80, DBG_CRITICAL, "wccp2_assignment_method: unknown setting, got " << t ); + self_destruct(); + } +} + +void +dump_wccp2_amethod(StoreEntry * e, const char *label, int v) +{ + switch(v) + { + case WCCP2_ASSIGNMENT_METHOD_HASH: + storeAppendPrintf(e, "%s hash\n", label); + break; + case WCCP2_ASSIGNMENT_METHOD_MASK: + storeAppendPrintf(e, "%s mask\n", label); + break; + default: + debugs(80, DBG_CRITICAL, "FATAL: WCCPv2 configured " << label << " (" << v << ") is not valid."); + self_destruct(); + } +} + +void +free_wccp2_amethod(int *v) +{ } + /* * Format: * # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWSbDTrwAEpNfgGwwW/f//3// /uT////+YBh9VB99N9U73nTu7gCJQlVFVSJQkUkRFdFqsBitgoNCuh0a5cRWqA0oANADQlTQg0pm ppk02ppkGm1P1I00BoAAAANBpoHNGjQ0wgGmBNNAGQ0MQBoxGhgjIANTQZSbKmho0aYRpo0GQMTA Q0aNAA0yaDCRCCITE0yRpPRT1PU2pifqaam0TQ000BkNNGT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