Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/release/src/router/httpd/ctnf.c b/release/src/router/httpd/ctnf.c
- index 43888cb..c7d91de 100644
- --- a/release/src/router/httpd/ctnf.c
- +++ b/release/src/router/httpd/ctnf.c
- @@ -83,12 +83,28 @@ void asp_ctcount(int argc, char **argv)
- unsigned long rip;
- unsigned long lan;
- unsigned long mask;
- -
- +
- if (argc != 1) return;
- mode = atoi(argv[0]);
- memset(count, 0, sizeof(count));
- +
- +#if defined(TCONFIG_IPV6) && defined(LINUX26)
- + char src[INET6_ADDRSTRLEN];
- + char dst[INET6_ADDRSTRLEN];
- + struct in6_addr rip6;
- + struct in6_addr lan6;
- + struct in6_addr in6;
- + int lan6_prefix_len;
- +
- + lan6_prefix_len = nvram_get_int("ipv6_prefix_length");
- + if (ipv6_enabled()) {
- + inet_pton(AF_INET6, nvram_safe_get("ipv6_prefix"), &lan6);
- + ipv6_router_address(&rip6);
- + }
- +#endif
- +
- #if defined(TCONFIG_IPV6) && defined(LINUX26)
- if ((f = fopen("/proc/net/nf_conntrack", "r")) != NULL) {
- #else
- @@ -125,6 +141,15 @@ void asp_ctcount(int argc, char **argv)
- }
- else if (strncmp(s, "ipv6", 4) == 0) {
- t = s + 12;
- + if (rip != 0) {
- + if ((p = strstr(t + 14, "src=")) == NULL) continue;
- + sscanf(p, "src=%s dst=%s", src, dst);
- +
- + if (inet_pton(AF_INET6, src, &in6) <= 0) continue;
- + inet_ntop(AF_INET6, &in6, src, sizeof src);
- +
- + if (!IP6_PREFIX_NOT_MATCH(lan6, in6, lan6_prefix_len)) continue;
- + }
- }
- else {
- continue; // another proto family?!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement