proxy.c (145519) | proxy.c (153881) |
---|---|
1/* $FreeBSD: head/contrib/ipfilter/samples/proxy.c 145519 2005-04-25 18:20:15Z darrenr $ */ | 1/* $FreeBSD: head/contrib/ipfilter/samples/proxy.c 153881 2005-12-30 11:52:26Z guido $ */ |
2 3/* 4 * Sample transparent proxy program. 5 * 6 * Sample implementation of a program which intercepts a TCP connectiona and 7 * just echos all data back to the origin. Written to work via inetd as a 8 * "nonwait" program running as root; ie. 9 * tcpmux stream tcp nowait root /usr/local/bin/proxy proxy --- 79 unchanged lines hidden (view full) --- 89 90 /* 91 * Build up the NAT natlookup structure. 92 */ 93 bzero((char *)&natlook, sizeof(natlook)); 94 natlook.nl_outip = sin.sin_addr; 95 natlook.nl_inip = sloc.sin_addr; 96 natlook.nl_flags = IPN_TCP; | 2 3/* 4 * Sample transparent proxy program. 5 * 6 * Sample implementation of a program which intercepts a TCP connectiona and 7 * just echos all data back to the origin. Written to work via inetd as a 8 * "nonwait" program running as root; ie. 9 * tcpmux stream tcp nowait root /usr/local/bin/proxy proxy --- 79 unchanged lines hidden (view full) --- 89 90 /* 91 * Build up the NAT natlookup structure. 92 */ 93 bzero((char *)&natlook, sizeof(natlook)); 94 natlook.nl_outip = sin.sin_addr; 95 natlook.nl_inip = sloc.sin_addr; 96 natlook.nl_flags = IPN_TCP; |
97 natlook.nl_outport = ntohs(sin.sin_port); 98 natlook.nl_inport = ntohs(sloc.sin_port); | 97 natlook.nl_outport = sin.sin_port; 98 natlook.nl_inport = sloc.sin_port; |
99 100 /* 101 * Open the NAT device and lookup the mapping pair. 102 */ 103 fd = open(IPNAT_NAME, O_RDONLY); 104 if (ioctl(fd, SIOCGNATL, &obj) == -1) { 105 perror("ioctl(SIOCGNATL)"); 106 exit(-1); --- 212 unchanged lines hidden --- | 99 100 /* 101 * Open the NAT device and lookup the mapping pair. 102 */ 103 fd = open(IPNAT_NAME, O_RDONLY); 104 if (ioctl(fd, SIOCGNATL, &obj) == -1) { 105 perror("ioctl(SIOCGNATL)"); 106 exit(-1); --- 212 unchanged lines hidden --- |