From: glenn <> Date: Sat, 12 Jun 1999 05:30:36 +0000 (+0000) Subject: GRE code removal, allow it to be done in the kernel X-Git-Tag: SQUID_3_0_PRE1~2157 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32c28da5cef0d6ae9ed64b7f46ef888df52af442;p=thirdparty%2Fsquid.git GRE code removal, allow it to be done in the kernel --- diff --git a/src/globals.h b/src/globals.h index 021e19d73b..0a897a1dab 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.82 1999/05/25 06:53:41 wessels Exp $ + * $Id: globals.h,v 1.83 1999/06/11 23:30:36 glenn Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -101,8 +101,6 @@ extern char *snmp_agentinfo; #ifdef WCCP extern int theInWccpConnection; /* -1 */ extern int theOutWccpConnection; /* -1 */ -extern int theInGreConnection; /* -1 */ -extern int theOutGreConnection; /* -1 */ #endif extern int vhost_mode; /* 0 */ extern int n_disk_objects; /* 0 */ diff --git a/src/wccp.cc b/src/wccp.cc index a264f9f12c..4ae384b4c3 100644 --- a/src/wccp.cc +++ b/src/wccp.cc @@ -1,6 +1,6 @@ /* - * $Id: wccp.cc,v 1.3 1999/04/27 05:46:13 glenn Exp $ + * $Id: wccp.cc,v 1.4 1999/06/11 23:30:37 glenn Exp $ * * DEBUG: section 80 WCCP Support * AUTHOR: Glenn Chisholm @@ -33,8 +33,6 @@ * */ #include "squid.h" -#include -#include #define WCCP_PORT 2048 #define WCCP_VERSION 4 @@ -48,15 +46,6 @@ #define WCCP_I_SEE_YOU 8 #define WCCP_ASSIGN_BUCKET 9 -#define GRE_PROTOCOL_TYPE 0x883E -#define GRE_PROTOCOL 47 -#define GRE_REQUEST_SIZE 65536 - -struct gre_packet_t { - int header; - char *data; -}; - struct wccp_here_i_am_t { int type; int version; @@ -141,21 +130,12 @@ wccpConnectionOpen(void) port, COMM_NONBLOCKING, "WCCP Port"); - theInGreConnection = comm_open(SOCK_RAW, - GRE_PROTOCOL, - Config.Addrs.wccp_incoming, - 0, - COMM_NONBLOCKING, - "GRE Port"); leave_suid(); - if ((theInWccpConnection < 0) || (theInGreConnection < 0)) + if (theInWccpConnection < 0) fatal("Cannot open WCCP Port"); commSetSelect(theInWccpConnection, COMM_SELECT_READ, wccpHandleUdp, NULL, 0); - commSetSelect(theInGreConnection, COMM_SELECT_READ, wccpHandleGre, NULL, 0); debug(1, 1) ("Accepting WCCP UDP messages on port %d, FD %d.\n", (int) port, theInWccpConnection); - debug(1, 1) ("Accepting WCCP GRE messages on FD %d.\n", - theInGreConnection); if (Config.Addrs.wccp_outgoing.s_addr != no_addr.s_addr) { enter_suid(); theOutWccpConnection = comm_open(SOCK_DGRAM, @@ -164,30 +144,19 @@ wccpConnectionOpen(void) port, COMM_NONBLOCKING, "WCCP Port"); - theOutGreConnection = comm_open(SOCK_RAW, - GRE_PROTOCOL, - Config.Addrs.wccp_outgoing, - 0, - COMM_NONBLOCKING, - "GRE Port"); leave_suid(); - if ((theOutWccpConnection < 0) || (theOutGreConnection < 0)) + if (theOutWccpConnection < 0) fatal("Cannot open Outgoing WCCP Port"); commSetSelect(theOutWccpConnection, COMM_SELECT_READ, wccpHandleUdp, NULL, 0); - commSetSelect(theInGreConnection, - COMM_SELECT_READ, - wccpHandleGre, - NULL, 0); debug(1, 1) ("Outgoing WCCP messages on port %d, FD %d.\n", (int) port, theOutWccpConnection); fd_note(theOutWccpConnection, "Outgoing WCCP socket"); fd_note(theInWccpConnection, "Incoming WCCP socket"); } else { theOutWccpConnection = theInWccpConnection; - theOutGreConnection = theInGreConnection; } } else { debug(1, 1) ("WCCP Disabled.\n"); @@ -221,47 +190,6 @@ wccpConnectionClose(void) * Functions for handling the requests. */ -/* - * Accept the GRE packet - */ -void -wccpHandleGre(int sock, void *not_used) -{ - struct gre_packet_t *gre_packet = NULL; - struct sockaddr_in from; - struct ip *ip_header = NULL; - char buf[GRE_REQUEST_SIZE]; - socklen_t from_len; - int len; - - debug(80, 6) ("wccpHandleGre: Called.\n"); - - commSetSelect(sock, COMM_SELECT_READ, wccpHandleGre, NULL, 0); - from_len = sizeof(struct sockaddr_in); - memset(&from, '\0', from_len); - - Counter.syscalls.sock.recvfroms++; - - len = recvfrom(sock, - buf, - GRE_REQUEST_SIZE, - 0, - (struct sockaddr *) &from, - &from_len); - - if (len > 0) { - debug(80, 1) ("wccpHandleGre: FD %d: received %d bytes from %s.\n", - sock, - len, - inet_ntoa(from.sin_addr)); - buf[len] = '\0'; - ip_header = (struct ip *) buf; - len = ip_header->ip_hl << 2; - gre_packet = (struct gre_packet_t *) (buf + len); - debug(80, 1) ("wccpHandleGre: Packet %x, IP Len %d.\n", ntohl(gre_packet->header), len); - } -} - /* * Accept the UDP packet */