--- libaitrpc/src/cli.c 2015/01/21 20:28:41 1.23.2.5 +++ libaitrpc/src/cli.c 2015/01/21 20:58:07 1.23.2.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: cli.c,v 1.23.2.5 2015/01/21 20:28:41 misho Exp $ +* $Id: cli.c,v 1.23.2.6 2015/01/21 20:58:07 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -351,9 +351,9 @@ rpc_pkt_Receive(int sock, int type, sockaddr_t * __res if (type == SOCK_STREAM) ret = rpc_Read(sock, type, !estlen ? MSG_PEEK : 0, NULL, buf, blen); else if (type == SOCK_EXT) { - ret = rpc_Read(sock, type, 0, NULL, AIT_GET_BUF(pkt), AIT_LEN(pkt)); - if (ret > 0) - estlen = ret; + ret = rpc_Read(sock, type, 0, NULL, buf, blen); + if (estlen) /* hack for skip sanity checks */ + ret += sizeof(struct tagRPCCall); } else if (type == SOCK_BPF) { ret = rpc_Read(sock, type, 0, sa, AIT_GET_BUF(pkt), AIT_LEN(pkt)); if (ret > 0) @@ -370,7 +370,7 @@ rpc_pkt_Receive(int sock, int type, sockaddr_t * __res } /* check for loop request */ - if (!(rpc->call_io & RPC_ACK)) + if (!estlen && !(rpc->call_io & RPC_ACK)) continue; /* check for response from known address */ @@ -379,9 +379,15 @@ rpc_pkt_Receive(int sock, int type, sockaddr_t * __res estlen = ntohl(rpc->call_len); if (estlen > AIT_LEN(pkt)) AIT_RE_BUF(pkt, estlen); + blen = estlen; buf = AIT_GET_BUF(pkt); + + if (type == SOCK_EXT) { + blen -= sizeof(struct tagRPCCall); + buf += sizeof(struct tagRPCCall); + } + rpc = (struct tagRPCCall*) buf; - blen = estlen; continue; }