diff mbox series

[v2] netfilter: nf_conntrack_amanda: add support for STATE streams

Message ID dd24bc58-2ad4-8e8b-7a50-deaf0a54d4ab@fidion.de
State Accepted
Delegated to: Pablo Neira
Headers show
Series [v2] netfilter: nf_conntrack_amanda: add support for STATE streams | expand

Commit Message

Florian Tham Feb. 18, 2019, 8:55 a.m. UTC
The Amanda CONNECT command has been updated to establish an optional
fourth connection [0]. Previously, a CONNECT command would look like:

    CONNECT DATA port0 MESG port1 INDEX port2

nf_conntrack_amanda analyses the CONNECT command string in order to
learn the port numbers of the related DATA, MESG and INDEX streams. As
of amanda v3.4, the CONNECT command can advertise an additional port:

    CONNECT DATA port0 MESG port1 INDEX port2 STATE port3

The new STATE stream is not handled, thus the connection on the STATE
port cannot be established.

The patch adds support for STATE streams to the amanda conntrack helper.

[0] https://github.com/zmanda/amanda/commit/3b8384fc9f2941e2427f44c3aee29f561ed67894#diff-711e502fc81a65182c0954765b42919eR456

Signed-off-by: Florian Tham <tham@fidion.de>
---
 net/netfilter/nf_conntrack_amanda.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Pablo Neira Ayuso Feb. 27, 2019, 9:47 a.m. UTC | #1
On Mon, Feb 18, 2019 at 09:55:46AM +0100, Florian Tham wrote:
> The Amanda CONNECT command has been updated to establish an optional
> fourth connection [0]. Previously, a CONNECT command would look like:
> 
>     CONNECT DATA port0 MESG port1 INDEX port2
> 
> nf_conntrack_amanda analyses the CONNECT command string in order to
> learn the port numbers of the related DATA, MESG and INDEX streams. As
> of amanda v3.4, the CONNECT command can advertise an additional port:
> 
>     CONNECT DATA port0 MESG port1 INDEX port2 STATE port3
> 
> The new STATE stream is not handled, thus the connection on the STATE
> port cannot be established.
> 
> The patch adds support for STATE streams to the amanda conntrack helper.
> 
> [0] https://github.com/zmanda/amanda/commit/3b8384fc9f2941e2427f44c3aee29f561ed67894#diff-711e502fc81a65182c0954765b42919eR456

Applied, thanks.
diff mbox series

Patch

diff --git a/net/netfilter/nf_conntrack_amanda.c b/net/netfilter/nf_conntrack_amanda.c
index 20edd589fe06..f2681ec5b5f6 100644
--- a/net/netfilter/nf_conntrack_amanda.c
+++ b/net/netfilter/nf_conntrack_amanda.c
@@ -54,6 +54,7 @@  enum amanda_strings {
 	SEARCH_DATA,
 	SEARCH_MESG,
 	SEARCH_INDEX,
+	SEARCH_STATE,
 };
 
 static struct {
@@ -81,6 +82,10 @@  static struct {
 		.string = "INDEX ",
 		.len	= 6,
 	},
+	[SEARCH_STATE] = {
+		.string = "STATE ",
+		.len	= 6,
+	},
 };
 
 static int amanda_help(struct sk_buff *skb,
@@ -124,7 +129,7 @@  static int amanda_help(struct sk_buff *skb,
 		goto out;
 	stop += start;
 
-	for (i = SEARCH_DATA; i <= SEARCH_INDEX; i++) {
+	for (i = SEARCH_DATA; i <= SEARCH_STATE; i++) {
 		off = skb_find_text(skb, start, stop, search[i].ts);
 		if (off == UINT_MAX)
 			continue;
@@ -168,7 +173,7 @@  static int amanda_help(struct sk_buff *skb,
 }
 
 static const struct nf_conntrack_expect_policy amanda_exp_policy = {
-	.max_expected		= 3,
+	.max_expected		= 4,
 	.timeout		= 180,
 };