summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJP Abgrall <jpa@google.com>2011-12-02 13:53:27 +0800
committerAndy Green <andy.green@linaro.org>2011-12-02 13:53:27 +0800
commit3244d33b39db4f68a701bb7bb1e6b0e083fc67d1 (patch)
tree6d92ffd5a396e376037c3215df8b52caa47b1be6 /net
parente1a284488cc5709a25177c132ab1f7cd03df9a17 (diff)
nf: qtaguid: make procfs entry for ctrl return correct data.
(This is a direct cherry-pick from 2.6.39: I3b925802) Fixed procreader for /proc/net/xt_qtaguid/ctrl: it would just fill the output with the same entry. Simplify the **start handling. Signed-off-by: JP Abgrall <jpa@google.com> Change-Id: I3b92580228f2b57795bb2d0d6197fc95ab6be552
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/xt_qtaguid.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/net/netfilter/xt_qtaguid.c b/net/netfilter/xt_qtaguid.c
index c58cf6305f0..3cdf1d8a26d 100644
--- a/net/netfilter/xt_qtaguid.c
+++ b/net/netfilter/xt_qtaguid.c
@@ -13,7 +13,6 @@
* via the DEFAULT_DEBUG_MASK. See xt_qtaguid_internal.h.
*/
#define DEBUG
-/* TODO: support ipv6 for iface_stat */
#include <linux/file.h>
#include <linux/inetdevice.h>
@@ -38,6 +37,7 @@
#define XT_SOCKET_SUPPORTED_HOOKS \
((1 << NF_INET_PRE_ROUTING) | (1 << NF_INET_LOCAL_IN))
+
static const char *module_procdirname = "xt_qtaguid";
static struct proc_dir_entry *xt_qtaguid_procdir;
@@ -1575,11 +1575,15 @@ ret_res:
return res;
}
-/* TODO: Use Documentation/filesystems/seq_file.txt? */
-static int qtaguid_ctrl_proc_read(char *page, char **start, off_t off,
- int count, int *eof, void *data)
+/*
+ * Procfs reader to get all active socket tags using style "1)" as described in
+ * fs/proc/generic.c
+ */
+static int qtaguid_ctrl_proc_read(char *page, char **num_items_returned,
+ off_t items_to_skip, int char_count, int *eof,
+ void *data)
{
- char *out = page + off;
+ char *outp = page;
int len;
uid_t uid;
struct rb_node *node;
@@ -1627,6 +1631,9 @@ static int qtaguid_ctrl_proc_read(char *page, char **start, off_t off,
*outp = '\0';
return outp - page;
}
+ outp += len;
+ char_count -= len;
+ (*num_items_returned)++;
}
spin_unlock_bh(&sock_tag_list_lock);