/* * Copyright (c) 1996-2007, OpenFWTK Development Group * All rights reserved. See LICENSE. */ #include #include #include #include #include "defs.h" #include "ext.h" #include "firewall.h" #include "firewall2.h" #if defined(linux) || defined (SOLARIS) extern void initsetproctitle(int,char**); extern void setproctitle(const char *fmt, ...); #endif extern char ptyibuf[BUFSIZ], *ptyip; extern char ptyibuf2[BUFSIZ]; void ShowUsage(void); void doit(void); static int dscp = 0; static int keepalive = 0; static fwparm aoptions[] = { { FWPARM_DSCP, "-dscp", (char*) &dscp }, { FWPARM_BOOL, "-keepalive", (char*) &keepalive }, { 0, 0, 0 } }; int main(int argc, char *argv[], char *env[]) { int on = 1; #if defined(HAS_IPPROTO_IP) && defined(IP_TOS) int tos = -1; #endif Cfg* confp; pfrontp = pbackp = ptyobuf; netip = netibuf; nfrontp = nbackp = netobuf; #if defined(ENCRYPT) nclearto = 0; #endif proxy_init(argc,argv); proxy_chroot_setugid(); if ((confp=proxy_conf_hosts(proxy_confp,proxy_stats.rladdr, proxy_stats.riaddr))) proxy_parse_options(confp,aoptions); else { proxy_exit(); } if (dscp) proxy_set_dscp(0,dscp); if (keepalive && setsockopt(0, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof (on)) < 0) { syslog(LOG_WARNING, "fwtksyserr: setsockopt (SO_KEEPALIVE): %s",strerror(errno)); } net = 0; doit(); exit(0); /* NOTREACHED */ return 0; } /* end of main */ void ShowUsage(void) { fprintf(stderr, "Usage: %s [-p ]\n", proxy_name); exit(1); }