
Hello community, here is the log from the commit of package booth for openSUSE:Factory checked in at 2015-08-02 22:45:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/booth (Old) and /work/SRC/openSUSE:Factory/.booth.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "booth" Changes: -------- --- /work/SRC/openSUSE:Factory/booth/booth.changes 2015-07-22 09:19:52.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.booth.new/booth.changes 2015-08-02 22:45:59.000000000 +0200 @@ -1,0 +2,10 @@ +Fri Jul 31 12:00:39 UTC 2015 - dmuhamedagic@suse.com + +- Update to version v0.2.0_96_g9dae592: + + ticket: prevent running external program twice + + ticket: make sure that we're the leader if granting ticket (bsc#940037) + + docs: add booth operation FSM dot graphs + + main: add peer statistics + + main: add booth peers command + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ booth.spec ++++++ --- /var/tmp/diff_new_pack.LOvlQQ/_old 2015-08-02 22:46:01.000000000 +0200 +++ /var/tmp/diff_new_pack.LOvlQQ/_new 2015-08-02 22:46:01.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package booth # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed ++++++ booth.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/.git_info new/booth/.git_info --- old/booth/.git_info 2015-07-21 11:57:16.000000000 +0200 +++ new/booth/.git_info 2015-07-31 13:59:36.000000000 +0200 @@ -1 +1 @@ -v0.2.0-89-gd9f16ba +v0.2.0-96-g9dae592 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/README new/booth/README --- old/booth/README 2015-07-21 11:45:06.000000000 +0200 +++ new/booth/README 2015-07-31 13:56:22.000000000 +0200 @@ -168,7 +168,7 @@ over TCP) and other booth servers (connecting over UDP). The authentication is based on SHA1 HMAC (Keyed-Hashing Message Authentication) and shared key. The HMAC implementation is -provided by the mhash library. +provided by the libgcrypt or mhash library. Message encryption is not included as the information exchanged between various booth parties does not seem to justify that. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/docs/boothd.8.txt new/booth/docs/boothd.8.txt --- old/booth/docs/boothd.8.txt 2015-07-21 11:45:06.000000000 +0200 +++ new/booth/docs/boothd.8.txt 2015-07-31 13:56:22.000000000 +0200 @@ -18,6 +18,8 @@ *booth* 'revoke' [-s 'site'] [-c 'config'] [-w] 'ticket' +*booth* 'peers' [-s 'site'] [-c 'config'] + *booth* 'status' [-D] [-c 'config'] @@ -145,7 +147,33 @@ an OCF-compatible return code. With '-D', a human-readable message is printed to STDERR as well. +*'peers'*:: + List the other 'boothd' servers we know about. ++ +In addition to the type, name (IP address), and the last time the +server was heard from, network statistics are also printed. The +statistics are split into two rows, the first one consists of +counters for the sent packets and the second one for the received +packets. The first counter is the total number of packets and +descriptions of the other counters follows: + +'resends':: + Packets which had to be resent because the recipient didn't + acknowledge a message. This usually means that either the + message or the acknowledgement got lost. The number of + resends usually reflect the network reliability. + +'error':: + Packets which either couldn't be sent, got truncated, or were + badly formed. Should be zero. + +'invalid':: + These packets contain either invalid or non-existing ticket + name or refer to a non-existing ticket leader. Should be + zero. +'authfail':: + Packets which couldn't be authenticated. Should be zero. CONFIGURATION FILE ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/docs/fsm-full.dot new/booth/docs/fsm-full.dot --- old/booth/docs/fsm-full.dot 1970-01-01 01:00:00.000000000 +0100 +++ new/booth/docs/fsm-full.dot 2015-07-31 13:56:22.000000000 +0200 @@ -0,0 +1,17 @@ +digraph G { + + label="Booth full FSM"; + fontname="Helvetica"; + fontsize="11"; + compound="true"; + ST_INIT -> ST_CANDIDATE [label="grant"]; + ST_INIT -> ST_FOLLOWER [label="HrtB|UpdE"]; + ST_FOLLOWER -> ST_CANDIDATE [label="VtFr(tkt_drop)\ntkt_lost"]; + ST_LEADER -> ST_FOLLOWER [label="lost_maj"]; + ST_CANDIDATE -> ST_CANDIDATE [label="timeout"]; + ST_CANDIDATE -> ST_LEADER [label="VtFr, timeout"]; + ST_CANDIDATE -> ST_FOLLOWER [label="HrtB|UpdE\nRJC!(outd|valid)"]; + ST_CANDIDATE -> ST_INIT [label="RJC!(outd+no_leader)"]; + ST_LEADER -> ST_INIT [label="Revk"]; + ST_FOLLOWER -> ST_INIT [label="Revk"]; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/docs/fsm-netfail.dot new/booth/docs/fsm-netfail.dot --- old/booth/docs/fsm-netfail.dot 1970-01-01 01:00:00.000000000 +0100 +++ new/booth/docs/fsm-netfail.dot 2015-07-31 13:56:22.000000000 +0200 @@ -0,0 +1,11 @@ +digraph G { + + label="Booth network failure FSM"; + fontname="Helvetica"; + fontsize="11"; + compound="true"; + ST_FOLLOWER -> ST_CANDIDATE [label="tkt_lost"]; + ST_LEADER -> ST_FOLLOWER [label="tkt_lost"]; + ST_CANDIDATE -> ST_CANDIDATE [label="timeout"]; + ST_CANDIDATE -> ST_LEADER [label="VtFr, timeout"]; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/docs/fsm-normal.dot new/booth/docs/fsm-normal.dot --- old/booth/docs/fsm-normal.dot 1970-01-01 01:00:00.000000000 +0100 +++ new/booth/docs/fsm-normal.dot 2015-07-31 13:56:22.000000000 +0200 @@ -0,0 +1,13 @@ +digraph G { + + label="Booth normal process FSM"; + fontname="Helvetica"; + fontsize="11"; + compound="true"; + ST_INIT -> ST_CANDIDATE [label="grant"]; + ST_INIT -> ST_FOLLOWER [label="HrtB|UpdE"]; + ST_CANDIDATE -> ST_LEADER [label="VtFr"]; + ST_LEADER -> ST_INIT [label="Revk"]; + ST_FOLLOWER -> ST_INIT [label="Revk"]; +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/booth.h new/booth/src/booth.h --- old/booth/src/booth.h 2015-07-21 11:45:06.000000000 +0200 +++ new/booth/src/booth.h 2015-07-31 13:56:22.000000000 +0200 @@ -50,9 +50,6 @@ #define BOOTH_DEFAULT_PORT 9929 -/* TODO: remove */ -#define BOOTH_PROTO_FAMILY AF_INET - #define BOOTHC_MAGIC 0x5F1BA08C #define BOOTHC_VERSION 0x00010003 @@ -164,6 +161,7 @@ CMD_LIST = CHAR2CONST('C', 'L', 's', 't'), CMD_GRANT = CHAR2CONST('C', 'G', 'n', 't'), CMD_REVOKE = CHAR2CONST('C', 'R', 'v', 'k'), + CMD_PEERS = CHAR2CONST('P', 'e', 'e', 'r'), /* Replies */ CL_RESULT = CHAR2CONST('R', 's', 'l', 't'), @@ -258,6 +256,16 @@ int saddrlen; int addrlen; + /** statistics */ + time_t last_recv; + unsigned int sent_cnt; + unsigned int sent_err_cnt; + unsigned int resend_cnt; + unsigned int recv_cnt; + unsigned int recv_err_cnt; + unsigned int sec_cnt; + unsigned int invalid_cnt; + /** last timestamp seen from this site */ uint32_t last_secs; uint32_t last_usecs; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/config.c new/booth/src/config.c --- old/booth/src/config.c 2015-07-21 11:45:06.000000000 +0200 +++ new/booth/src/config.c 2015-07-31 13:56:22.000000000 +0200 @@ -83,7 +83,7 @@ site = booth_conf->site + booth_conf->site_count; - site->family = BOOTH_PROTO_FAMILY; + site->family = AF_INET; site->type = type; /* Make site_id start at a non-zero point. * Perhaps use hash over string or address? */ @@ -784,10 +784,6 @@ booth_conf->gid = gr->gr_gid; } - - /* TODO: check whether uid or gid is 0 again? - * The admin may shoot himself in the foot, though. */ - return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/config.h new/booth/src/config.h --- old/booth/src/config.h 2015-07-21 11:45:06.000000000 +0200 +++ new/booth/src/config.h 2015-07-31 13:56:22.000000000 +0200 @@ -62,7 +62,7 @@ /** If >0, time to wait for a site to get fenced. * The ticket may be acquired after that timespan by * another site. */ - int acquire_after; /* TODO: needed? */ + int acquire_after; /* How often to renew the ticket (in ms) */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/main.c new/booth/src/main.c --- old/booth/src/main.c 2015-07-21 11:45:06.000000000 +0200 +++ new/booth/src/main.c 2015-07-31 13:56:22.000000000 +0200 @@ -200,6 +200,73 @@ return -1; } +static int format_peers(char **pdata, unsigned int *len) +{ + struct booth_site *s; + char *data, *cp; + char time_str[64]; + int i, alloc; + + *pdata = NULL; + *len = 0; + + alloc = booth_conf->site_count * (BOOTH_NAME_LEN + 256); + data = malloc(alloc); + if (!data) + return -ENOMEM; + + cp = data; + foreach_node(i, s) { + if (s == local) + continue; + strftime(time_str, sizeof(time_str), "%F %T", + localtime(&s->last_recv)); + cp += snprintf(cp, + alloc - (cp - data), + "%-12s %s, last recv: %s\n", + type_to_string(s->type), + s->addr_string, + time_str); + cp += snprintf(cp, + alloc - (cp - data), + "\tSent pkts:%u error:%u resends:%u\n", + s->sent_cnt, + s->sent_err_cnt, + s->resend_cnt); + cp += snprintf(cp, + alloc - (cp - data), + "\tRecv pkts:%u error:%u authfail:%u invalid:%u\n\n", + s->recv_cnt, + s->recv_err_cnt, + s->sec_cnt, + s->invalid_cnt); + if (alloc - (cp - data) <= 0) + return -ENOMEM; + } + + *pdata = data; + *len = cp - data; + + return 0; +} + + +static void list_peers(int fd, struct boothc_ticket_msg *msg) +{ + char *data; + int olen; + struct boothc_hdr_msg hdr; + + if (format_peers(&data, &olen) < 0) + goto out; + + init_header(&hdr.header, CL_LIST, 0, 0, RLT_SUCCESS, 0, sizeof(hdr) + olen); + (void)send_header_plus(fd, &hdr, data, olen); + +out: + if (data) + free(data); +} /* Only used for client requests (tcp) */ void process_connection(int ci) @@ -233,6 +300,9 @@ case CMD_LIST: ticket_answer_list(req_cl->fd, msg); goto kill; + case CMD_PEERS: + list_peers(req_cl->fd, msg); + goto kill; case CMD_GRANT: case CMD_REVOKE: @@ -528,6 +598,8 @@ op_str = "revoke"; else if (cmd == CMD_LIST) op_str = "list"; + else if (cmd == CMD_PEERS) + op_str = "peers"; else { log_error("internal error reading reply result!"); return -1; @@ -565,7 +637,7 @@ case RLT_SYNC_SUCC: case RLT_SUCCESS: - if (cmd != CMD_LIST) + if (cmd != CMD_LIST && cmd != CMD_PEERS) log_info("%s succeeded!", op_str); rv = 0; break; @@ -660,7 +732,7 @@ out_free: if (rv < 0) { - (void)test_reply(ntohl(reply.header.result), CMD_LIST); + (void)test_reply(ntohl(reply.header.result), cmd); } free(data); out_close: @@ -838,7 +910,6 @@ static inline int is_root(void) { - /* TODO: getuid()? Better way to check? */ return geteuid() == 0; } @@ -941,14 +1012,14 @@ int re = -1; memset(&hints, 0, sizeof(hints)); - hints.ai_family = BOOTH_PROTO_FAMILY; + hints.ai_family = AF_INET; hints.ai_socktype = SOCK_DGRAM; re = getaddrinfo(hostname, NULL, &hints, &result); if (re == 0) { struct in_addr addr = ((struct sockaddr_in *)result->ai_addr)->sin_addr; - const char *re_ntop = inet_ntop(BOOTH_PROTO_FAMILY, &addr, ip_str, ip_size); + const char *re_ntop = inet_ntop(AF_INET, &addr, ip_str, ip_size); if (re_ntop == NULL) { re = -1; } @@ -1009,6 +1080,8 @@ cl.op = CMD_GRANT; else if (!strcmp(op, "revoke")) cl.op = CMD_REVOKE; + else if (!strcmp(op, "peers")) + cl.op = CMD_PEERS; else { fprintf(stderr, "client operation \"%s\" is unknown\n", op); @@ -1211,11 +1284,6 @@ ret = PCMK_OCF_NOT_RUNNING; - /* TODO: query all, and return quit only if it's _cleanly_ not - * running, ie. _neither_ of port/lockfile/process is available? - * - * Currently a single failure says "not running", even if "only" the - * lockfile has been removed. */ rv = setup_config(type); if (rv) { @@ -1312,8 +1380,6 @@ return rv; } - /* TODO: ulimits? But that would restrict crm_ticket and handler - * scripts, too! */ return 0; } @@ -1457,6 +1523,10 @@ rv = query_get_string_answer(CMD_LIST); break; + case CMD_PEERS: + rv = query_get_string_answer(CMD_PEERS); + break; + case CMD_GRANT: rv = do_grant(); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/ticket.c new/booth/src/ticket.c --- old/booth/src/ticket.c 2015-07-21 11:45:06.000000000 +0200 +++ new/booth/src/ticket.c 2015-07-31 13:56:22.000000000 +0200 @@ -146,6 +146,11 @@ return 1; if (tk->leader == local) { + if (tk->state != ST_LEADER) { + tk_log_info("ticket state not yet consistent, " + "delaying ticket grant to CIB"); + return 1; + } pcmk_handler.grant_ticket(tk); } else { pcmk_handler.revoke_ticket(tk); @@ -279,9 +284,6 @@ break; case RUNCMD_MORE: /* need to wait for the outcome before starting elections */ - /* set next_state appropriately, so that elections are - * started */ - set_next_state(tk, ST_LEADER); return 0; default: return RLT_EXT_FAILED; @@ -785,6 +787,7 @@ for (i = 0; i < booth_conf->site_count; i++) { n = booth_conf->site + i; if (!(tk->acks_received & n->bitmask)) { + n->resend_cnt++; tk_log_debug("resending %s to %s", state_to_string(tk->last_request), site_string(n) @@ -1078,19 +1081,25 @@ return -1; } + time(&source->last_recv); + source->recv_cnt++; + if (check_boothc_header(&msg->header, msglen) < 0) { log_error("message from %s receive error", site_string(source)); + source->recv_err_cnt++; return -1; } if (check_auth(source, msg, msglen)) { log_error("%s failed to authenticate", site_string(source)); + source->sec_cnt++; return -1; } if (!check_ticket(msg->ticket.id, &tk)) { log_warn("got invalid ticket name %s from %s", msg->ticket.id, site_string(source)); + source->invalid_cnt++; return -EINVAL; } @@ -1098,6 +1107,7 @@ leader_u = ntohl(msg->ticket.leader); if (!find_site_by_id(leader_u, &leader)) { tk_log_error("message with unknown leader %u received", leader_u); + source->invalid_cnt++; return -EINVAL; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/booth/src/transport.c new/booth/src/transport.c --- old/booth/src/transport.c 2015-07-21 11:45:06.000000000 +0200 +++ new/booth/src/transport.c 2015-07-31 13:56:22.000000000 +0200 @@ -715,17 +715,20 @@ { int rv; + to->sent_cnt++; rv = sendto(local->udp_fd, buf, len, MSG_NOSIGNAL, (struct sockaddr *)&to->sa6, to->saddrlen); if (rv == len) { rv = 0; } else if (rv < 0) { + to->sent_err_cnt++; log_error("Cannot send to %s: %d %s", site_string(to), errno, strerror(errno)); } else { rv = -1; + to->sent_err_cnt++; log_error("Packet sent to %s got truncated", site_string(to)); }
participants (1)
-
root@hilbert.suse.de