--- libaitrpc/src/cli.c 2013/08/22 11:52:20 1.16.8.3 +++ libaitrpc/src/cli.c 2013/08/22 11:55:45 1.16.8.4 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: cli.c,v 1.16.8.3 2013/08/22 11:52:20 misho Exp $ +* $Id: cli.c,v 1.16.8.4 2013/08/22 11:55:45 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -390,7 +390,7 @@ rpc_pkt_Receive(int sock, int type, sockaddr_t * __res /* calc estimated length */ rpc = (struct tagRPCCall*) buf; - estlen = ntohs(rpc->call_len) + blen; + estlen = ntohl(rpc->call_len) + blen; printf("ret = %d len=%d\n", ret, estlen); if (estlen > AIT_LEN(pkt)) AIT_RE_BUF(pkt, estlen); @@ -462,7 +462,7 @@ rpc_pkt_Request(ait_val_t * __restrict pkt, rpc_sess_t } /* total packet length */ - rpc->call_len = htons(len); + rpc->call_len = htonl(len); if (!nocrc) { /* calculate CRC */ @@ -503,7 +503,7 @@ rpc_pkt_Replay(ait_val_t * __restrict pkt, rpc_sess_t /* calculate CRC */ crc = ntohs(rpc->call_crc); rpc->call_crc ^= rpc->call_crc; - if (crc != crcFletcher16((u_short*) buf, ntohs(rpc->call_len) / 2)) { + if (crc != crcFletcher16((u_short*) buf, ntohl(rpc->call_len) / 2)) { rpc_SetErr(ERPCMISMATCH, "Bad CRC RPC packet"); return -1; } @@ -529,7 +529,7 @@ rpc_pkt_Replay(ait_val_t * __restrict pkt, rpc_sess_t rpc_SetErr(EMSGSIZE, "Reply RPC packet not enough buffer space ..."); return -1; } - if (len > ntohs(rpc->call_len) - sizeof(struct tagRPCCall)) { + if (len > ntohl(rpc->call_len) - sizeof(struct tagRPCCall)) { rpc_SetErr(EMSGSIZE, "Reply RPC packet is too short ..."); return -1; }