1 |
diff -ur oidentd.orig/src/kernel/linux.c oidentd-2.0.8/src/kernel/linux.c |
2 |
--- oidentd.orig/src/kernel/linux.c 2006-05-22 06:58:53.000000000 +0300 |
3 |
+++ oidentd-2.0.8/src/kernel/linux.c 2007-07-11 21:28:56.000000000 +0300 |
4 |
@@ -48,6 +48,7 @@ |
5 |
#define CFILE6 "/proc/net/tcp6" |
6 |
#define MASQFILE "/proc/net/ip_masquerade" |
7 |
#define CONNTRACK "/proc/net/ip_conntrack" |
8 |
+#define NFCONNTRACK "/proc/net/nf_conntrack" |
9 |
|
10 |
static int netlink_sock; |
11 |
extern struct sockaddr_storage proxy; |
12 |
@@ -82,7 +83,15 @@ |
13 |
debug("fopen: %s: %s", CONNTRACK, strerror(errno)); |
14 |
return false; |
15 |
} |
16 |
- masq_fp = fopen("/dev/null", "r"); |
17 |
+ |
18 |
+ masq_fp = fopen(NFCONNTRACK, "r"); |
19 |
+ if (masq_fp == NULL) { |
20 |
+ if (errno != ENOENT) { |
21 |
+ debug("fopen: %s: %s", NFCONNTRACK, strerror(errno)); |
22 |
+ return false; |
23 |
+ } |
24 |
+ masq_fp = fopen("/dev/null", "r"); |
25 |
+ } |
26 |
} |
27 |
|
28 |
netfilter = true; |
29 |
@@ -367,6 +376,15 @@ |
30 |
&nport_temp, &mport_temp); |
31 |
} |
32 |
|
33 |
+ if (ret != 21) { |
34 |
+ ret = sscanf(buf, |
35 |
+ "%*15s %*d %15s %*d %*d ESTABLISHED src=%d.%d.%d.%d dst=%d.%d.%d.%d sport=%d dport=%d packets=%*d bytes=%*d src=%d.%d.%d.%d dst=%d.%d.%d.%d sport=%d dport=%d", |
36 |
+ proto, &l1, &l2, &l3, &l4, &r1, &r2, &r3, &r4, |
37 |
+ &masq_lport_temp, &masq_fport_temp, |
38 |
+ &nl1, &nl2, &nl3, &nl4, &nr1, &nr2, &nr3, &nr4, |
39 |
+ &nport_temp, &mport_temp); |
40 |
+ } |
41 |
+ |
42 |
if (ret != 21) |
43 |
continue; |
44 |
|