pcpserver.c: properly fill the opcode field of response

fixes #327
This commit is contained in:
Thomas Bernard 2018-09-07 17:24:43 +02:00
parent a2baa36312
commit 95d707a71f
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
1 changed files with 2 additions and 2 deletions

View File

@ -1434,7 +1434,7 @@ static int processPCPRequest(void * req, int req_size, pcp_info_t *pcp_msg_info)
} }
static void createPCPResponse(unsigned char *response, pcp_info_t *pcp_msg_info) static void createPCPResponse(unsigned char *response, const pcp_info_t *pcp_msg_info)
{ {
response[2] = 0; /* reserved */ response[2] = 0; /* reserved */
memset(response + 12, 0, 12); /* reserved */ memset(response + 12, 0, 12); /* reserved */
@ -1445,7 +1445,7 @@ static void createPCPResponse(unsigned char *response, pcp_info_t *pcp_msg_info)
response[0] = pcp_msg_info->version; response[0] = pcp_msg_info->version;
} }
response[1] |= 0x80; /* r_opcode */ response[1] = pcp_msg_info->opcode | 0x80; /* r_opcode */
response[3] = pcp_msg_info->result_code; response[3] = pcp_msg_info->result_code;
if(epoch_origin == 0) { if(epoch_origin == 0) {
epoch_origin = startup_time; epoch_origin = startup_time;