mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-29 14:50:59 +01:00
BUG/MEDIUM: contrib/spoa_server: Set FIN flag on agent frames
When communicating over SPOP the AGENT-HELLO, AGENT-DISCONNECT, and ACK frames must have the FIN flag set.
This commit is contained in:
parent
5897867ac5
commit
4e0fa55dcd
@ -679,13 +679,16 @@ error:
|
|||||||
* the number of written bytes otherwise. */
|
* the number of written bytes otherwise. */
|
||||||
static void prepare_agentack(struct worker *w)
|
static void prepare_agentack(struct worker *w)
|
||||||
{
|
{
|
||||||
|
unsigned int flags = 0;
|
||||||
|
|
||||||
w->ack_len = 0;
|
w->ack_len = 0;
|
||||||
|
|
||||||
/* Frame type */
|
/* Frame type */
|
||||||
w->ack[w->ack_len++] = SPOE_FRM_T_AGENT_ACK;
|
w->ack[w->ack_len++] = SPOE_FRM_T_AGENT_ACK;
|
||||||
|
|
||||||
/* No flags for now */
|
/* Set flags */
|
||||||
memset(w->ack + w->ack_len, 0, 4); /* No flags */
|
flags |= htonl(SPOE_FRM_FL_FIN);
|
||||||
|
memcpy(w->ack + w->ack_len, &flags, 4);
|
||||||
w->ack_len += 4;
|
w->ack_len += 4;
|
||||||
|
|
||||||
/* Set stream-id and frame-id for ACK frames */
|
/* Set stream-id and frame-id for ACK frames */
|
||||||
@ -940,12 +943,14 @@ static int
|
|||||||
prepare_agenthello(struct worker *w)
|
prepare_agenthello(struct worker *w)
|
||||||
{
|
{
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
unsigned int flags = 0;
|
||||||
|
|
||||||
/* Frame Type */
|
/* Frame Type */
|
||||||
w->buf[idx++] = SPOE_FRM_T_AGENT_HELLO;
|
w->buf[idx++] = SPOE_FRM_T_AGENT_HELLO;
|
||||||
|
|
||||||
/* No flags for now */
|
/* Set flags */
|
||||||
memset(w->buf+idx, 0, 4); /* No flags */
|
flags |= htonl(SPOE_FRM_FL_FIN);
|
||||||
|
memcpy(w->buf+idx, &flags, 4);
|
||||||
idx += 4;
|
idx += 4;
|
||||||
|
|
||||||
/* No stream-id and frame-id for HELLO frames */
|
/* No stream-id and frame-id for HELLO frames */
|
||||||
@ -978,6 +983,7 @@ prepare_agentdicon(struct worker *w)
|
|||||||
{
|
{
|
||||||
const char *reason;
|
const char *reason;
|
||||||
int rlen, idx = 0;
|
int rlen, idx = 0;
|
||||||
|
unsigned int flags = 0;
|
||||||
|
|
||||||
if (w->status_code >= SPOE_FRM_ERRS)
|
if (w->status_code >= SPOE_FRM_ERRS)
|
||||||
w->status_code = SPOE_FRM_ERR_UNKNOWN;
|
w->status_code = SPOE_FRM_ERR_UNKNOWN;
|
||||||
@ -987,8 +993,9 @@ prepare_agentdicon(struct worker *w)
|
|||||||
/* Frame type */
|
/* Frame type */
|
||||||
w->buf[idx++] = SPOE_FRM_T_AGENT_DISCON;
|
w->buf[idx++] = SPOE_FRM_T_AGENT_DISCON;
|
||||||
|
|
||||||
/* No flags for now */
|
/* Set flags */
|
||||||
memset(w->buf+idx, 0, 4);
|
flags |= htonl(SPOE_FRM_FL_FIN);
|
||||||
|
memcpy(w->buf+idx, &flags, 4);
|
||||||
idx += 4;
|
idx += 4;
|
||||||
|
|
||||||
/* No stream-id and frame-id for DISCONNECT frames */
|
/* No stream-id and frame-id for DISCONNECT frames */
|
||||||
|
|||||||
@ -21,6 +21,9 @@
|
|||||||
#define SPOP_VERSION "2.0"
|
#define SPOP_VERSION "2.0"
|
||||||
#define SPOA_CAPABILITIES ""
|
#define SPOA_CAPABILITIES ""
|
||||||
|
|
||||||
|
/* Flags set on the SPOE frame */
|
||||||
|
#define SPOE_FRM_FL_FIN 0x00000001
|
||||||
|
|
||||||
/* All supported data types */
|
/* All supported data types */
|
||||||
enum spoe_data_type {
|
enum spoe_data_type {
|
||||||
SPOE_DATA_T_NULL = 0,
|
SPOE_DATA_T_NULL = 0,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user