ANDROID: netfilter: xt_qtaguid: xt_socket: build fixes
Add missing header <linux/miscdevice.h> and use
xt_socket_lookup_slow_v* instead of xt_socket_get*_sk
in xt_qtaguid.c.
Fix xt_socket_lookup_slow_v* functions in xt_socket.c
and declare them in xt_socket.h
Change-Id: I55819b2d4ffa82a2be20995c87d28fb5cc77b5ba
Signed-off-by: John Stultz <john.stultz@linaro.org>
[AmitP: Upstream commit 8db4c5be88 ("netfilter: move socket lookup
infrastructure to nf_socket_ipv{4,6}.c")] moved socket lookup
to nf_socket_ipv{4,6}.c, hence use nf_sk_lookup_slow_v[4|6]()
instead of obsolete xt_socket_lookup_slow_v[4|6]().
Also folded following android-4.9 commit changes into this patch
7de1bb86dc5a ("ANDROID: netfilter: xt_qtaguid/socket: build fixes for 4.4")
5b5ab94817f9 ("ANDROID: netfilter: xt_qtaguid: seq_printf fixes")]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
This commit is contained in:
@@ -27,9 +27,4 @@ struct xt_socket_mtinfo3 {
|
|||||||
| XT_SOCKET_NOWILDCARD \
|
| XT_SOCKET_NOWILDCARD \
|
||||||
| XT_SOCKET_RESTORESKMARK)
|
| XT_SOCKET_RESTORESKMARK)
|
||||||
|
|
||||||
struct sock *xt_socket_get4_sk(const struct sk_buff *skb,
|
|
||||||
struct xt_action_param *par);
|
|
||||||
struct sock *xt_socket_get6_sk(const struct sk_buff *skb,
|
|
||||||
struct xt_action_param *par);
|
|
||||||
|
|
||||||
#endif /* _XT_SOCKET_H */
|
#endif /* _XT_SOCKET_H */
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <linux/file.h>
|
#include <linux/file.h>
|
||||||
#include <linux/inetdevice.h>
|
#include <linux/inetdevice.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/miscdevice.h>
|
||||||
#include <linux/netfilter/x_tables.h>
|
#include <linux/netfilter/x_tables.h>
|
||||||
#include <linux/netfilter/xt_qtaguid.h>
|
#include <linux/netfilter/xt_qtaguid.h>
|
||||||
#include <linux/ratelimit.h>
|
#include <linux/ratelimit.h>
|
||||||
@@ -1588,10 +1589,10 @@ static struct sock *qtaguid_find_sk(const struct sk_buff *skb,
|
|||||||
|
|
||||||
switch (par->family) {
|
switch (par->family) {
|
||||||
case NFPROTO_IPV6:
|
case NFPROTO_IPV6:
|
||||||
sk = xt_socket_get6_sk(skb, par);
|
sk = nf_sk_lookup_slow_v6(dev_net(skb->dev), skb, par->in);
|
||||||
break;
|
break;
|
||||||
case NFPROTO_IPV4:
|
case NFPROTO_IPV4:
|
||||||
sk = xt_socket_get4_sk(skb, par);
|
sk = nf_sk_lookup_slow_v4(dev_net(skb->dev), skb, par->in);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -2541,7 +2542,6 @@ static void pp_stats_header(struct seq_file *m)
|
|||||||
static int pp_stats_line(struct seq_file *m, struct tag_stat *ts_entry,
|
static int pp_stats_line(struct seq_file *m, struct tag_stat *ts_entry,
|
||||||
int cnt_set)
|
int cnt_set)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
struct data_counters *cnts;
|
struct data_counters *cnts;
|
||||||
tag_t tag = ts_entry->tn.tag;
|
tag_t tag = ts_entry->tn.tag;
|
||||||
uid_t stat_uid = get_uid_from_tag(tag);
|
uid_t stat_uid = get_uid_from_tag(tag);
|
||||||
@@ -2560,7 +2560,7 @@ static int pp_stats_line(struct seq_file *m, struct tag_stat *ts_entry,
|
|||||||
}
|
}
|
||||||
ppi->item_index++;
|
ppi->item_index++;
|
||||||
cnts = &ts_entry->counters;
|
cnts = &ts_entry->counters;
|
||||||
ret = seq_printf(m, "%d %s 0x%llx %u %u "
|
seq_printf(m, "%d %s 0x%llx %u %u "
|
||||||
"%llu %llu "
|
"%llu %llu "
|
||||||
"%llu %llu "
|
"%llu %llu "
|
||||||
"%llu %llu "
|
"%llu %llu "
|
||||||
@@ -2590,7 +2590,7 @@ static int pp_stats_line(struct seq_file *m, struct tag_stat *ts_entry,
|
|||||||
cnts->bpc[cnt_set][IFS_TX][IFS_UDP].packets,
|
cnts->bpc[cnt_set][IFS_TX][IFS_UDP].packets,
|
||||||
cnts->bpc[cnt_set][IFS_TX][IFS_PROTO_OTHER].bytes,
|
cnts->bpc[cnt_set][IFS_TX][IFS_PROTO_OTHER].bytes,
|
||||||
cnts->bpc[cnt_set][IFS_TX][IFS_PROTO_OTHER].packets);
|
cnts->bpc[cnt_set][IFS_TX][IFS_PROTO_OTHER].packets);
|
||||||
return ret ?: 1;
|
return seq_has_overflowed(m) ? -ENOSPC : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool pp_sets(struct seq_file *m, struct tag_stat *ts_entry)
|
static bool pp_sets(struct seq_file *m, struct tag_stat *ts_entry)
|
||||||
|
|||||||
Reference in New Issue
Block a user