Re: Help with 1.8.1/4 and spoa_server/spoa_example

2019-07-06 Thread Aleksandar Lazic
Hi Christopher.

Am 05.07.2019 um 16:29 schrieb Christopher Faulet:
> Le 03/07/2019 à 16:16, Aleksandar Lazic a écrit :
>> I know this is a old haproxy version but I have not the option to update as 
>> it's
>> part of a vendor product.
>>
>> I need to bring the `[haproxy-2.0.git]/ contrib/spoa_server/` up and runnig 
>> or
>> `[haproxy-1.8.git]/contrib/spoa_example/` from 1.8.4 to be able to run a 
>> python
>> script.
>>
>> Any help is welcome and I can offer some money for the help. It's urgent so I
>> will need the help asap.
>>
>> You can contact me also off the list.
> 
> 
> Hi Aleks,
> 
> The spoa_example cannot run python script. But I take a look to the 
> spoa_server
> and it seems to usable with HAProxy 1.8 with a small patch. You must downgrade
> the SPOE version and change the encoding of the frame's flags. The example
> configuration must also be adapted because there is no debug converter in
> HAProxy 1.8.
> 
> But, as you said, HAProxy 1.8.4 is old, and many fixes was pushed on the SPOE
> since then. So you would experience some bugs. Be careful.
> 
> And I noticed a bug with the spoe_server, It seems to accept and process only
> one connection per worker because of a while loop to read frames. I'm cc'ing
> Thierry.
> 
> I attached a quick-and-dirty patch to downgrade SPOP version of the 
> spoa_server
> to 1.0.

Thank you very much.

Best regards
Aleks



Re: Help with 1.8.1/4 and spoa_server/spoa_example

2019-07-05 Thread Christopher Faulet

Le 03/07/2019 à 16:16, Aleksandar Lazic a écrit :

I know this is a old haproxy version but I have not the option to update as it's
part of a vendor product.

I need to bring the `[haproxy-2.0.git]/ contrib/spoa_server/` up and runnig or
`[haproxy-1.8.git]/contrib/spoa_example/` from 1.8.4 to be able to run a python
script.

Any help is welcome and I can offer some money for the help. It's urgent so I
will need the help asap.

You can contact me also off the list.



Hi Aleks,

The spoa_example cannot run python script. But I take a look to the spoa_server 
and it seems to usable with HAProxy 1.8 with a small patch. You must downgrade 
the SPOE version and change the encoding of the frame's flags. The example 
configuration must also be adapted because there is no debug converter in 
HAProxy 1.8.


But, as you said, HAProxy 1.8.4 is old, and many fixes was pushed on the SPOE 
since then. So you would experience some bugs. Be careful.


And I noticed a bug with the spoe_server, It seems to accept and process only 
one connection per worker because of a while loop to read frames. I'm cc'ing 
Thierry.


I attached a quick-and-dirty patch to downgrade SPOP version of the spoa_server 
to 1.0.



--
Christopher Faulet
>From 955c47ce6e8bf8a1ed644ffd353b52b54516c2fa Mon Sep 17 00:00:00 2001
From: Christopher Faulet 
Date: Fri, 5 Jul 2019 16:25:34 +0200
Subject: [PATCH] WIP: spoa_server: Downgrade SPOP version to 1.0

---
 contrib/spoa_server/spoa.c | 6 +++---
 contrib/spoa_server/spoa.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/spoa_server/spoa.c b/contrib/spoa_server/spoa.c
index f36c3db90..933eb79c8 100644
--- a/contrib/spoa_server/spoa.c
+++ b/contrib/spoa_server/spoa.c
@@ -687,7 +687,7 @@ static void prepare_agentack(struct worker *w)
 	w->ack[w->ack_len++] = SPOE_FRM_T_AGENT_ACK;
 
 	/* Set flags */
-	flags |= htonl(SPOE_FRM_FL_FIN);
+	flags |= SPOE_FRM_FL_FIN;
 	memcpy(w->ack + w->ack_len, , 4);
 	w->ack_len += 4;
 
@@ -949,7 +949,7 @@ prepare_agenthello(struct worker *w)
 	w->buf[idx++] = SPOE_FRM_T_AGENT_HELLO;
 
 	/* Set flags */
-	flags |= htonl(SPOE_FRM_FL_FIN);
+	flags |= SPOE_FRM_FL_FIN;
 	memcpy(w->buf+idx, , 4);
 	idx += 4;
 
@@ -994,7 +994,7 @@ prepare_agentdicon(struct worker *w)
 	w->buf[idx++] = SPOE_FRM_T_AGENT_DISCON;
 
 	/* Set flags */
-	flags |= htonl(SPOE_FRM_FL_FIN);
+	flags |= SPOE_FRM_FL_FIN;
 	memcpy(w->buf+idx, , 4);
 	idx += 4;
 
diff --git a/contrib/spoa_server/spoa.h b/contrib/spoa_server/spoa.h
index 8f912e435..0166c48c4 100644
--- a/contrib/spoa_server/spoa.h
+++ b/contrib/spoa_server/spoa.h
@@ -18,7 +18,7 @@
 #include 
 
 #define MAX_FRAME_SIZE16384
-#define SPOP_VERSION  "2.0"
+#define SPOP_VERSION  "1.0"
 #define SPOA_CAPABILITIES ""
 
 /* Flags set on the SPOE frame */
-- 
2.20.1



Help with 1.8.1/4 and spoa_server/spoa_example

2019-07-03 Thread Aleksandar Lazic
Hi.

I know this is a old haproxy version but I have not the option to update as it's
part of a vendor product.

I need to bring the `[haproxy-2.0.git]/ contrib/spoa_server/` up and runnig or
`[haproxy-1.8.git]/contrib/spoa_example/` from 1.8.4 to be able to run a python
script.

Any help is welcome and I can offer some money for the help. It's urgent so I
will need the help asap.

You can contact me also off the list.

Best regards
Aleks