#define DEFAULT_LOGFILE "log/socksd.log"
#endif
+#ifndef DEFAULT_REQFILE
+#define DEFAULT_REQFILE "log/socksd-request.log"
+#endif
+
#ifndef DEFAULT_CONFIG
#define DEFAULT_CONFIG "socksd.config"
#endif
static struct configurable config;
const char *serverlogfile = DEFAULT_LOGFILE;
+const char *reqlogfile = DEFAULT_REQFILE;
static const char *configfile = DEFAULT_CONFIG;
#ifdef ENABLE_IPV6
}
logmsg("Received ATYP %d", type);
+ {
+ FILE *dump;
+ dump = fopen(reqlogfile, "ab");
+ if(dump) {
+ int i;
+ fprintf(dump, "atyp %u =>", type);
+ switch(type) {
+ case 1:
+ /* 4 bytes IPv4 address */
+ fprintf(dump, " %u.%u.%u.%u\n",
+ address[0], address[1], address[2], address[3]);
+ break;
+ case 3:
+ /* The first octet of the address field contains the number of octets
+ of name that follow */
+ fprintf(dump, " %.*s\n", len-1, &address[1]);
+ break;
+ case 4:
+ /* 16 bytes IPv6 address */
+ for(i = 0; i < 16; i++) {
+ fprintf(dump, " %02x", address[i]);
+ }
+ fprintf(dump, "\n");
+ break;
+ }
+ fclose(dump);
+ }
+ }
+
if(!config.port) {
unsigned char *portp = &buffer[SOCKS5_DSTADDR + len];
s5port = (unsigned short)((portp[0]<<8) | (portp[1]));
if(argc>arg)
serverlogfile = argv[arg++];
}
+ else if(!strcmp("--reqfile", argv[arg])) {
+ arg++;
+ if(argc>arg)
+ reqlogfile = argv[arg++];
+ }
else if(!strcmp("--ipv6", argv[arg])) {
#ifdef ENABLE_IPV6
ipv_inuse = "IPv6";
" --logfile [file]\n"
" --pidfile [file]\n"
" --portfile [file]\n"
+ " --reqfile [file]\n"
" --ipv4\n"
" --ipv6\n"
" --bindonly\n"