diff -c -r squid-1.NOVM.22/src/Makefile.in squid-1.NOVM.22-new/src/Makefile.in
*** squid-1.NOVM.22/src/Makefile.in	Thu Jun 25 22:08:32 1998
--- squid-1.NOVM.22-new/src/Makefile.in	Sun Sep 20 18:41:21 1998
***************
*** 18,23 ****
--- 18,25 ----
  USE_BIN_TREE    = # -DUSE_BIN_TREE
  RELOAD_INTO_IMS	= # -DRELOAD_INTO_IMS
  UNDERSCORES_OPT = # -DALLOW_HOSTNAME_UNDERSCORES
+ IPFILTER_OPT= -DWITH_IPFILTER=1
+ 
  RETRY_PATCH	= -DRETRY_PATCH
  NO_CACHE_ACL	= # -DNO_CACHE_ACL=1
  
***************
*** 25,31 ****
                    $(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \
                    $(KILL_PARENT_OPT) $(USE_POLL_OPT) \
                    $(USE_SPLAY_TREE) $(USE_BIN_TREE) \
! 		  $(RELOAD_INTO_IMS) $(UNDERSCORES_OPT) \
  		  $(RETRY_PATCH) $(NO_CACHE_ACL)
  
  prefix		= @prefix@
--- 27,33 ----
                    $(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \
                    $(KILL_PARENT_OPT) $(USE_POLL_OPT) \
                    $(USE_SPLAY_TREE) $(USE_BIN_TREE) \
! 		  $(RELOAD_INTO_IMS) $(UNDERSCORES_OPT) $(IPFILTER_OPT)\
  		  $(RETRY_PATCH) $(NO_CACHE_ACL)
  
  prefix		= @prefix@
diff -c -r squid-1.NOVM.22/src/cache_cf.c squid-1.NOVM.22-new/src/cache_cf.c
*** squid-1.NOVM.22/src/cache_cf.c	Thu Jun 25 22:08:37 1998
--- squid-1.NOVM.22-new/src/cache_cf.c	Sun Sep 20 18:43:30 1998
***************
*** 1115,1120 ****
--- 1115,1125 ----
  	else if (!strcmp(token, "logfile_rotate"))
  	    parseIntegerValue(&Config.Log.rotateNumber);
  
+ #if WITH_IPFILTER
+ 	else if (!strcmp(token, "httpd_accel_uses_ipfilter_redirect"))
+ 	    parseOnOff(&opt_accel_uses_ipfilter_redirect);
+ #endif
+ 
  	else if (!strcmp(token, "httpd_accel_with_proxy"))
  	    parseOnOff(&Config.Accel.withProxy);
  
diff -c -r squid-1.NOVM.22/src/icp.c squid-1.NOVM.22-new/src/icp.c
*** squid-1.NOVM.22/src/icp.c	Thu Jun 25 23:21:17 1998
--- squid-1.NOVM.22-new/src/icp.c	Sun Sep 20 18:39:28 1998
***************
*** 105,110 ****
--- 105,118 ----
   */
  
  #include "squid.h"
+ #if WITH_IPFILTER
+ #include <sys/ioctl.h>
+ #include <netinet/in_systm.h>
+ #include <net/if.h>
+ #include "/sys/netinet/ip_compat.h"
+ #include "/sys/netinet/ip_fil.h"
+ #include "/sys/netinet/ip_nat.h"
+ #endif
  
  int neighbors_do_private_keys = 1;
  
***************
*** 1602,1608 ****
  	return -1;
      }
      debug(12, 5, "parseHttpRequest: Request is '%s'\n", url);
- 
      token = strtok(NULL, null_string);
      for (t = token; t && *t && *t != '\n' && *t != '\r'; t++);
      if (t == NULL || *t == '\0' || t == token) {
--- 1610,1615 ----
***************
*** 1669,1675 ****
  		(int) Config.Accel.port,
  		url);
  	    debug(12, 5, "VHOST REWRITE: '%s'\n", icpState->url);
! 	} else {
  	    url_sz = strlen(Config.Accel.prefix) + strlen(url) +
  		Config.appendDomainLen + 1;
  	    icpState->url = xcalloc(url_sz, 1);
--- 1676,1719 ----
  		(int) Config.Accel.port,
  		url);
  	    debug(12, 5, "VHOST REWRITE: '%s'\n", icpState->url);
! 	} 
! #if WITH_IPFILTER
! 	else if (opt_accel_uses_ipfilter_redirect) {
! 	  natlookup_t	natlook;
! 	  int ffd;
! 	  /*
! 	   * Build up the NAT natlookup structure.
! 	   */
! 	  bzero((char *)&natlook, sizeof(natlook));
! 	  natlook.nl_outip = icpState->peer.sin_addr;
! 	  natlook.nl_inip = icpState->me.sin_addr;
! 	  natlook.nl_flags = IPN_TCP;
! 	  natlook.nl_outport = icpState->peer.sin_port;
! 	  natlook.nl_inport = icpState->me.sin_port;
! 
! 	/*
! 	 * Open the NAT device and lookup the mapping pair.
! 	 */
! 	  ffd = open(IPL_NAT, O_RDONLY);
! 	  if (ioctl(ffd, SIOCGNATL, &natlook) == -1) {
! 	    syslog(LOG_DAEMON|LOG_INFO,"cannot access to %s",IPL_NAT);
! 	    close (ffd);
! 	    goto Z;
! 	  }
! 	  close(ffd);
! 	  syslog(LOG_DAEMON|LOG_INFO, "connect to %s,%d",
! 		 inet_ntoa(natlook.nl_realip), ntohs(natlook.nl_realport));
! 	  url_sz = strlen(url) + 32 + Config.appendDomainLen;
! 	  icpState->url = xcalloc(url_sz, 1);
! 	  sprintf(icpState->url, "http://%s:%d%s",
! 		  inet_ntoa(natlook.nl_realip),
! 		  (int)ntohs(natlook.nl_realport),
! 		  url);
! 	  debug(12, 5, "VHOST REWRITE: '%s'\n", icpState->url);
! 	}
! #endif
! 	else {
! 	Z:
  	    url_sz = strlen(Config.Accel.prefix) + strlen(url) +
  		Config.appendDomainLen + 1;
  	    icpState->url = xcalloc(url_sz, 1);
diff -c -r squid-1.NOVM.22/src/main.c squid-1.NOVM.22-new/src/main.c
*** squid-1.NOVM.22/src/main.c	Fri Dec 19 01:19:12 1997
--- squid-1.NOVM.22-new/src/main.c	Sun Sep 20 18:39:36 1998
***************
*** 124,129 ****
--- 124,132 ----
  int opt_mem_pools = 0;
  int opt_forwarded_for = 1;
  int opt_accel_uses_host = 0;
+ #if WITH_IPFILTER
+ int opt_accel_uses_ipfilter_redirect = 0;
+ #endif
  int vhost_mode = 0;
  int Squid_MaxFD = SQUID_MAXFD;
  int Biggest_FD = -1;
diff -c -r squid-1.NOVM.22/src/squid.h squid-1.NOVM.22-new/src/squid.h
*** squid-1.NOVM.22/src/squid.h	Sat Nov  1 01:38:21 1997
--- squid-1.NOVM.22-new/src/squid.h	Sun Sep 20 18:39:42 1998
***************
*** 351,356 ****
--- 351,359 ----
  extern int opt_mem_pools;	/* main.c */
  extern int opt_forwarded_for;	/* main.c */
  extern int opt_accel_uses_host;	/* main.c */
+ #if WITH_IPFILTER
+ extern int opt_accel_uses_ipfilter_redirect;	/* main.c */
+ #endif
  extern char ThisCache[];	/* main.c */
  
  /* Prototypes and definitions which don't really deserve a separate
