Commit Graph

7 Commits

Author SHA1 Message Date
Maciej Żenczykowski 533391cc59 ANDROID: fix a bug in quota2
If quota is precisely equal to skb->len then a notification
would not be sent due to immediately hitting 0.

This fixes that, and takes the opportunity to slightly clean
up the code and make quota behave more correctly for packet mode
as well.

Test: builds, net tests continue to pass
Bug: 164336990
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I78a11b48794496255513a6226c0469d809d7aa56
(cherry picked from commit b20eacd8ddbd1dbf403df94f5ba6384e6fef0113)
2020-08-24 20:37:32 +02:00
syphyr 9fe9503eac netfilter: Remove Samsung debug from xt_quota2
Change-Id: I0f835016b7fd6ca16a3ff12e46a6e02341a6679e
2020-08-24 20:37:23 +02:00
LuK1337 fc9499e55a Import latest Samsung release
* Package version: T713XXU2BQCO

Change-Id: I293d9e7f2df458c512d59b7a06f8ca6add610c99
2017-04-18 03:43:52 +02:00
Subash Abhinov Kasiviswanathan 8b4f8900a0 net: netfilter: fix compilation warnings
Fix compilation warnings due to type casting between pointers and
function pointers which are treated as errors when the configs
CONFIG_NETFILTER_XT_MATCH_QTAGUID and
CONFIG_NETFILTER_XT_MATCH_QUOTA2 are enabled

CRs-fixed: 638281
Change-Id: Idce65bcaddc68cc58e42951c183a8fa78810f28f
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2014-05-05 12:00:36 -06:00
Arve Hjønnevåg 73570fe76d netfilter: xt_quota2: 3.10 fixes.
- Stop using obsolete create_proc_entry api.
- Use proc_set_user instead of directly accessing the private structure.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
2013-07-01 15:52:03 -07:00
JP Abgrall ea34f99edb netfilter: fixup the quota2, and enable.
The xt_quota2 came from
  http://sourceforge.net/projects/xtables-addons/develop

It needed tweaking for it to compile within the kernel tree.
Fixed kmalloc() and create_proc_entry() invocations within
 a non-interruptible context.
Removed useless copying of current quota back to the iptable's
struct matchinfo:
  - those are per CPU: they will change randomly based on which
    cpu gets to update the value.
  - they prevent matching a rule: e.g.
      -A chain -m quota2 --name q1 --quota 123
     can't be followed by
      -D chain -m quota2 --name q1 --quota 123
    as the 123 will be compared to the struct matchinfo's quota member.
Use the NETLINK NETLINK_NFLOG family to log a single message
when the quota limit is reached.
It uses the same packet type as ipt_ULOG, but
 - never copies skb data,
 - uses 112 as the event number (ULOG's +1)
It doesn't log if the module param "event_num" is 0.

Change-Id: I021d3b743db3b22158cc49acb5c94d905b501492
Signed-off-by: JP Abgrall <jpa@google.com>
2013-07-01 13:40:36 -07:00
JP Abgrall 3db08b39ea netfilter: adding the original quota2 from xtables-addons
The original xt_quota in the kernel is plain broken:
  - counts quota at a per CPU level
    (was written back when ubiquitous SMP was just a dream)
  - provides no way to count across IPV4/IPV6.

This patch is the original unaltered code from:
  http://sourceforge.net/projects/xtables-addons

  at commit e84391ce665cef046967f796dd91026851d6bbf3

Change-Id: I19d49858840effee9ecf6cff03c23b45a97efdeb
Signed-off-by: JP Abgrall <jpa@google.com>
2013-07-01 13:40:36 -07:00