File: sockd_dumprt.c

package info (click to toggle)
socks4-server 4.3.beta2-20
  • links: PTS
  • area: main
  • in suites: buster, stretch
  • size: 1,512 kB
  • ctags: 1,778
  • sloc: ansic: 19,305; makefile: 399; sh: 52
file content (42 lines) | stat: -rw-r--r-- 898 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* sockd_dumpcf */

#include <sys/types.h>
#include <string.h>
#include <stdio.h>
#include <syslog.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "socks.h"


void sockd_dumprt(rtAddr, Nrt, useSyslog)
struct config *rtAddr;
int Nrt;
int useSyslog;
{
	char buf[1024], *bp;
	struct config *cp;
	int i, t;
	struct in_addr addr;
	
	if (useSyslog)
		syslog(LOG_HIGH,"Effective route entries: %d\n",Nrt);
	else
		printf("Effective route entries: %d\n",Nrt);
	for (i = 0, cp = rtAddr; i++ < Nrt; cp++) {
		strcpy(buf, inet_ntoa(cp->saddr));
		strcat(buf, " ");
		addr.s_addr = cp->daddr.s_addr;
		if (cp->ddomain != NULL)
			strcat(buf, cp->ddomain);
		else
			strcat(buf, inet_ntoa(cp->daddr));
		strcat(buf, " ");
		addr.s_addr = cp->dmask.s_addr;
		strcat(buf, inet_ntoa(cp->dmask));
		if (useSyslog)
			syslog(LOG_HIGH, "RT%3d>>%s<<\n",i,buf);
		else
			printf("RT%3d>>%s<<\n",i,buf);
	}
}