diff options
author | Martin Schwenke <martin@meltin.net> | 2018-08-17 14:35:07 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2018-08-30 04:48:59 +0200 |
commit | 028fdc12e7399dae23fec20deb3ec0284f9d0ce2 (patch) | |
tree | a38261394d4b69077cf320b07c1332bc21da4713 /ctdb/common | |
parent | cb4848e35951d8dc232643b45116fb54655ffa30 (diff) | |
download | samba-028fdc12e7399dae23fec20deb3ec0284f9d0ce2.tar.gz |
ctdb-common: Clean up types/declarations in TCP socket reading
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/common')
-rw-r--r-- | ctdb/common/system_socket.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/ctdb/common/system_socket.c b/ctdb/common/system_socket.c index a52a7947af8..7adb55040f4 100644 --- a/ctdb/common/system_socket.c +++ b/ctdb/common/system_socket.c @@ -789,16 +789,16 @@ int ctdb_sys_read_tcp_packet(int s, void *private_data, int *rst, uint16_t *window) { - int ret; -#define RCVPKTSIZE 100 - char pkt[RCVPKTSIZE]; + ssize_t nread; + uint8_t pkt[100]; /* Large enough for simple ACK/RST packets */ struct ether_header *eth; struct iphdr *ip; struct ip6_hdr *ip6; struct tcphdr *tcp; + int ret; - ret = recv(s, pkt, RCVPKTSIZE, MSG_TRUNC); - if (ret < sizeof(*eth)+sizeof(*ip)) { + nread = recv(s, pkt, sizeof(pkt), MSG_TRUNC); + if (nread < sizeof(*eth)+sizeof(*ip)) { return EMSGSIZE; } @@ -828,7 +828,7 @@ int ctdb_sys_read_tcp_packet(int s, void *private_data, /* make sure its not a short packet */ if (offsetof(struct tcphdr, th_ack) + 4 + - (ip->ihl*4) + sizeof(*eth) > ret) { + (ip->ihl*4) + sizeof(*eth) > nread) { return EMSGSIZE; } /* TCP */ @@ -926,7 +926,6 @@ int ctdb_sys_read_tcp_packet(int s, struct ip *ip; struct ip6_hdr *ip6; struct tcphdr *tcp; - struct ctdb_killtcp_connection *conn; struct pcap_pkthdr pkthdr; const u_char *buffer; pcap_t *pt = (pcap_t *)private_data; |