Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 211679
b: refs/heads/master
c: 1ae4de0
h: refs/heads/master
i:
  211677: 1d60f82
  211675: d7826c8
  211671: d87c9be
  211663: 89505fe
  211647: 48b5452
v: v3
  • Loading branch information
Eric Paris authored and James Morris committed Oct 20, 2010
1 parent 7d3366e commit c99c546
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1cc63249adfa957b34ca51effdee90ff8261d63f
refs/heads/master: 1ae4de0cdf855305765592647025bde55e85e451
28 changes: 25 additions & 3 deletions trunk/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/percpu.h>
#include <linux/security.h>
#include <net/net_namespace.h>

#include <linux/netfilter.h>
Expand Down Expand Up @@ -87,6 +88,29 @@ static void ct_seq_stop(struct seq_file *s, void *v)
rcu_read_unlock();
}

#ifdef CONFIG_NF_CONNTRACK_SECMARK
static int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct)
{
int ret;
u32 len;
char *secctx;

ret = security_secid_to_secctx(ct->secmark, &secctx, &len);
if (ret)
return ret;

ret = seq_printf(s, "secctx=%s ", secctx);

security_release_secctx(secctx, len);
return ret;
}
#else
static inline int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct)
{
return 0;
}
#endif

static int ct_seq_show(struct seq_file *s, void *v)
{
struct nf_conntrack_tuple_hash *hash = v;
Expand Down Expand Up @@ -148,10 +172,8 @@ static int ct_seq_show(struct seq_file *s, void *v)
goto release;
#endif

#ifdef CONFIG_NF_CONNTRACK_SECMARK
if (seq_printf(s, "secmark=%u ", ct->secmark))
if (ct_show_secctx(s, ct))
goto release;
#endif

if (seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use)))
goto release;
Expand Down
28 changes: 25 additions & 3 deletions trunk/net/netfilter/nf_conntrack_standalone.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/seq_file.h>
#include <linux/percpu.h>
#include <linux/netdevice.h>
#include <linux/security.h>
#include <net/net_namespace.h>
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
Expand Down Expand Up @@ -108,6 +109,29 @@ static void ct_seq_stop(struct seq_file *s, void *v)
rcu_read_unlock();
}

#ifdef CONFIG_NF_CONNTRACK_SECMARK
static int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct)
{
int ret;
u32 len;
char *secctx;

ret = security_secid_to_secctx(ct->secmark, &secctx, &len);
if (ret)
return ret;

ret = seq_printf(s, "secctx=%s ", secctx);

security_release_secctx(secctx, len);
return ret;
}
#else
static inline int ct_show_secctx(struct seq_file *s, const struct nf_conn *ct)
{
return 0;
}
#endif

/* return 0 on success, 1 in case of error */
static int ct_seq_show(struct seq_file *s, void *v)
{
Expand Down Expand Up @@ -168,10 +192,8 @@ static int ct_seq_show(struct seq_file *s, void *v)
goto release;
#endif

#ifdef CONFIG_NF_CONNTRACK_SECMARK
if (seq_printf(s, "secmark=%u ", ct->secmark))
if (ct_show_secctx(s, ct))
goto release;
#endif

#ifdef CONFIG_NF_CONNTRACK_ZONES
if (seq_printf(s, "zone=%u ", nf_ct_zone(ct)))
Expand Down

0 comments on commit c99c546

Please sign in to comment.