SHARE
TWEET

http3.patch toastman / teddy build

a guest Feb 20th, 2011 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/release/src/router/httpd/ctnf.c b/release/src/router/httpd/ctnf.c
  2. index 43888cb..c7d91de 100644
  3. --- a/release/src/router/httpd/ctnf.c
  4. +++ b/release/src/router/httpd/ctnf.c
  5. @@ -83,12 +83,28 @@ void asp_ctcount(int argc, char **argv)
  6.         unsigned long rip;
  7.         unsigned long lan;
  8.         unsigned long mask;
  9. -
  10. +              
  11.         if (argc != 1) return;
  12.         mode = atoi(argv[0]);
  13.  
  14.         memset(count, 0, sizeof(count));
  15.  
  16. +
  17. +#if defined(TCONFIG_IPV6) && defined(LINUX26)
  18. +       char src[INET6_ADDRSTRLEN];
  19. +       char dst[INET6_ADDRSTRLEN];
  20. +       struct in6_addr rip6;
  21. +       struct in6_addr lan6;
  22. +       struct in6_addr in6;
  23. +       int lan6_prefix_len;
  24. +
  25. +       lan6_prefix_len = nvram_get_int("ipv6_prefix_length");
  26. +       if (ipv6_enabled()) {
  27. +               inet_pton(AF_INET6, nvram_safe_get("ipv6_prefix"), &lan6);
  28. +               ipv6_router_address(&rip6);
  29. +       }
  30. +#endif
  31. +
  32.  #if defined(TCONFIG_IPV6) && defined(LINUX26)
  33.         if ((f = fopen("/proc/net/nf_conntrack", "r")) != NULL) {
  34.  #else
  35. @@ -125,6 +141,15 @@ void asp_ctcount(int argc, char **argv)
  36.                         }
  37.                         else if (strncmp(s, "ipv6", 4) == 0) {
  38.                                 t = s + 12;
  39. +                               if (rip != 0) {
  40. +                                       if ((p = strstr(t + 14, "src=")) == NULL) continue;
  41. +                                       sscanf(p, "src=%s dst=%s", src, dst);
  42. +                                      
  43. +                                       if (inet_pton(AF_INET6, src, &in6) <= 0) continue;
  44. +                                       inet_ntop(AF_INET6, &in6, src, sizeof src);
  45. +                                      
  46. +                                       if (!IP6_PREFIX_NOT_MATCH(lan6, in6, lan6_prefix_len)) continue;
  47. +                               }
  48.                         }
  49.                         else {
  50.                                 continue; // another proto family?!
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top