Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Tom Eastep <teastep@shorewall.net>
To: Mr Dash Four <mr.dash.four@googlemail.com>
Cc: Jan Engelhardt <jengelh@medozas.de>,
	netfilter@vger.kernel.org,
	Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: decipher the secmark number from nf_conntrack/ip_conntrack
Date: Mon, 20 Sep 2010 14:49:10 -0700	[thread overview]
Message-ID: <4C97D6D6.9040805@shorewall.net> (raw)
In-Reply-To: <4C9756AB.5040304@googlemail.com>


[-- Attachment #1.1: Type: text/plain, Size: 893 bytes --]

On 9/20/10 5:42 AM, Mr Dash Four wrote:

> The output of SECMARK_print is seen when I list the mangle table with
> iptables ('iptables -t mangle -L -n' for example) and there is the
> SELinux context in full view as I originally registered the rule match
> with. So, if I am to kindly ask the devs maintaining the iptables code
> to change the above function to include the following line:
> 
> printf("selctx %s [%u]", info->u.sel.selctx,info->u.sel.selsid);\
> 
> instead of:
> 
> printf("selctx %s ", info->u.sel.selctx);\
> 

That breaks iptables-save/-restore. The attached patch does not.

-Tom
-- 
Tom Eastep        \ When I die, I want to go like my Grandfather who
Shoreline,         \ died peacefully in his sleep. Not screaming like
Washington, USA     \ all of the passengers in his car
http://shorewall.net \________________________________________________

[-- Attachment #1.2: SECMARK.diff --]
[-- Type: text/plain, Size: 983 bytes --]

--- libxt_SECMARK.c~	2009-06-16 07:37:44.000000000 -0700
+++ libxt_SECMARK.c	2010-09-20 11:57:58.000000000 -0700
@@ -65,7 +65,7 @@
 {
 	switch (info->mode) {
 	case SECMARK_MODE_SEL:
-		printf("selctx %s ", info->u.sel.selctx);\
+	        printf("selctx %s [%u] ", info->u.sel.selctx, info->u.sel.selsid);
 		break;
 	
 	default:
@@ -83,13 +83,25 @@
 	print_secmark(info);
 }
 
+static void save_secmark(const struct xt_secmark_target_info *info)
+{
+	switch (info->mode) {
+	case SECMARK_MODE_SEL:
+		printf("selctx %s ", info->u.sel.selctx);\
+		break;
+	
+	default:
+		xtables_error(OTHER_PROBLEM, PFX "invalid mode %hhu\n", info->mode);
+	}
+}
+
 static void SECMARK_save(const void *ip, const struct xt_entry_target *target)
 {
 	const struct xt_secmark_target_info *info =
 		(struct xt_secmark_target_info*)target->data;
 
 	printf("--");
-	print_secmark(info);
+	save_secmark(info);
 }
 
 static struct xtables_target secmark_target = {

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 258 bytes --]

  parent reply	other threads:[~2010-09-20 21:49 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-19 23:04 decipher the secmark number from nf_conntrack/ip_conntrack Mr Dash Four
2010-09-20  0:48 ` Jan Engelhardt
2010-09-20 10:41   ` Mr Dash Four
2010-09-20 12:23     ` Jan Engelhardt
2010-09-20 12:42       ` Mr Dash Four
2010-09-20 18:15         ` Mr Dash Four
2010-09-20 21:49         ` Tom Eastep [this message]
2010-09-20 23:26           ` Jan Engelhardt
2010-09-20 23:55             ` Tom Eastep
2010-09-21  9:59             ` Mr Dash Four
2010-09-21 20:13               ` Mr Dash Four
2010-09-21 20:26                 ` Eric Paris
2010-09-21 21:00                   ` Eric Paris
2010-09-21 22:38                     ` Mr Dash Four
2010-09-21 22:42                     ` Jan Engelhardt
2010-09-21 22:51                       ` Mr Dash Four
2010-09-21 23:10                       ` Eric Paris
2010-09-21 23:35                         ` Jan Engelhardt
2010-09-23 18:39                           ` Eric Paris
2010-09-23 18:49                             ` Jan Engelhardt
2010-09-23 18:52                               ` Eric Paris
2010-09-23 18:57                                 ` Jan Engelhardt
2010-09-23 18:58                                   ` Eric Paris
2010-09-23 19:20                                   ` Mr Dash Four
2010-09-23 19:51                                     ` Jan Engelhardt
2010-09-23 20:05                                       ` Mr Dash Four
2010-09-23 20:18                                       ` Mr Dash Four
2010-09-23 20:34                                         ` Eric Paris
2010-09-23 20:38                                           ` Mr Dash Four
2010-09-23 20:53                                           ` Jan Engelhardt
2010-09-23 20:56                                             ` Mr Dash Four
2010-09-23 21:23                                               ` Jan Engelhardt
2010-09-23 21:38                                                 ` Mr Dash Four
2010-09-23 22:12                                                   ` Jan Engelhardt
2010-09-23 22:30                                                     ` Mr Dash Four
2010-09-23 22:42                                                       ` Eric Paris
2010-09-23 23:59                                                       ` Jan Engelhardt
2010-09-24  0:24                                                         ` Tom Eastep
2010-09-24  0:32                                                           ` Mr Dash Four
2010-09-24  1:18                                                           ` Jan Engelhardt
2010-09-24  0:27                                                         ` Mr Dash Four
2010-09-23 20:42                                         ` Jan Engelhardt
2010-09-23 20:53                                           ` Mr Dash Four
2010-09-21 22:29                   ` Mr Dash Four
2010-09-22  2:25                   ` Tom Eastep

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C97D6D6.9040805@shorewall.net \
    --to=teastep@shorewall.net \
    --cc=jengelh@medozas.de \
    --cc=mr.dash.four@googlemail.com \
    --cc=netfilter@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox