Skip to contentSkip to conversation

conntrack: remove -o userspace

PATCH In review Florian Westphal 2 participants 2 messages May 16, 2022 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 conntrack: remove -o userspace

This flag makes life a lot harder because lack of the flag hides very useful information. Remove it and always tag events triggered by userspace flush.

Option is still parsed for backwards compatibility sake.

---
 conntrack.8     | 2 +-
 src/conntrack.c | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)
conntrack.8 +1 -1
index c3214ee0c886..0db427b7b9ea 100644
@@ -114,7 +114,7 @@ Load entries from a given file. To read from stdin, "\-" should be specified.
 Atomically zero counters after reading them.  This option is only valid in
 combination with the "\-L, \-\-dump" command options.
 .TP
-.BI "-o, --output [extended,xml,save,timestamp,id,ktimestamp,labels,userspace] "
+.BI "-o, --output [extended,xml,save,timestamp,id,ktimestamp,labels] "
 Display output in a certain format. With the extended output option, this tool
 displays the layer 3 information. With ktimestamp, it displays the in-kernel
 timestamp available since 2.6.38 (you can enable it via the \fBsysctl(8)\fP
src/conntrack.c +3 -4
index a77354344290..bd02b139dc97 100644
@@ -1128,8 +1128,7 @@ enum {
 	_O_ID	= (1 << 3),
 	_O_KTMS	= (1 << 4),
 	_O_CL	= (1 << 5),
-	_O_US	= (1 << 6),
-	_O_SAVE	= (1 << 7),
+	_O_SAVE	= (1 << 6),
 };
 
 enum {
@@ -1149,7 +1148,7 @@ static struct parse_parameter {
 	{ {"ALL", "NEW", "UPDATES", "DESTROY"}, 4,
 	  { CT_EVENT_F_ALL, CT_EVENT_F_NEW, CT_EVENT_F_UPD, CT_EVENT_F_DEL } },
 	{ {"xml", "extended", "timestamp", "id", "ktimestamp", "labels", "userspace", "save"}, 8,
-	  { _O_XML, _O_EXT, _O_TMS, _O_ID, _O_KTMS, _O_CL, _O_US, _O_SAVE },
+	  { _O_XML, _O_EXT, _O_TMS, _O_ID, _O_KTMS, _O_CL, 0, _O_SAVE },
 	},
 };
 
@@ -1978,7 +1977,7 @@ static int event_cb(const struct nlmsghdr *nlh, void *data)
 
 	nfct_snprintf_labels(buf, sizeof(buf), ct, type, op_type, op_flags, labelmap);
 done:
-	if ((output_mask & _O_US) && nlh->nlmsg_pid) {
+	if (nlh->nlmsg_pid) {
 		char *prog = get_progname(nlh->nlmsg_pid);
 
 		if (prog)
Signature · 1 line
2.35.3
#1 lore raw
Quoted 5 lines · Florian Westphal

This flag makes life a lot harder because lack of the flag hides very useful information. Remove it and always tag events triggered by userspace flush.

Option is still parsed for backwards compatibility sake.

OK, if you prefer it this way.

Quoted 54 lines
---
 conntrack.8     | 2 +-
 src/conntrack.c | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)
conntrack.8 +1 -1
index c3214ee0c886..0db427b7b9ea 100644
@@ -114,7 +114,7 @@ Load entries from a given file. To read from stdin, "\-" should be specified.
 Atomically zero counters after reading them.  This option is only valid in
 combination with the "\-L, \-\-dump" command options.
 .TP
-.BI "-o, --output [extended,xml,save,timestamp,id,ktimestamp,labels,userspace] "
+.BI "-o, --output [extended,xml,save,timestamp,id,ktimestamp,labels] "
 Display output in a certain format. With the extended output option, this tool
 displays the layer 3 information. With ktimestamp, it displays the in-kernel
 timestamp available since 2.6.38 (you can enable it via the \fBsysctl(8)\fP
src/conntrack.c +3 -4
index a77354344290..bd02b139dc97 100644
@@ -1128,8 +1128,7 @@ enum {
 	_O_ID	= (1 << 3),
 	_O_KTMS	= (1 << 4),
 	_O_CL	= (1 << 5),
-	_O_US	= (1 << 6),
-	_O_SAVE	= (1 << 7),
+	_O_SAVE	= (1 << 6),
 };
 
 enum {
@@ -1149,7 +1148,7 @@ static struct parse_parameter {
 	{ {"ALL", "NEW", "UPDATES", "DESTROY"}, 4,
 	  { CT_EVENT_F_ALL, CT_EVENT_F_NEW, CT_EVENT_F_UPD, CT_EVENT_F_DEL } },
 	{ {"xml", "extended", "timestamp", "id", "ktimestamp", "labels", "userspace", "save"}, 8,
-	  { _O_XML, _O_EXT, _O_TMS, _O_ID, _O_KTMS, _O_CL, _O_US, _O_SAVE },
+	  { _O_XML, _O_EXT, _O_TMS, _O_ID, _O_KTMS, _O_CL, 0, _O_SAVE },
 	},
 };
 
@@ -1978,7 +1977,7 @@ static int event_cb(const struct nlmsghdr *nlh, void *data)
 
 	nfct_snprintf_labels(buf, sizeof(buf), ct, type, op_type, op_flags, labelmap);
 done:
-	if ((output_mask & _O_US) && nlh->nlmsg_pid) {
+	if (nlh->nlmsg_pid) {
 		char *prog = get_progname(nlh->nlmsg_pid);
 
 		if (prog)
Signature · 1 line
2.35.3