Put minor protocol version in connection options so other nodes can see it.
This allows two nodes that do not have a meta-connection with each other see which version they are.
This commit is contained in:
parent
68de7b481e
commit
76a3ada4eb
5 changed files with 6 additions and 2 deletions
|
@ -32,6 +32,7 @@
|
||||||
#define OPTION_TCPONLY 0x0002
|
#define OPTION_TCPONLY 0x0002
|
||||||
#define OPTION_PMTU_DISCOVERY 0x0004
|
#define OPTION_PMTU_DISCOVERY 0x0004
|
||||||
#define OPTION_CLAMP_MSS 0x0008
|
#define OPTION_CLAMP_MSS 0x0008
|
||||||
|
#define OPTION_VERSION(x) ((x) >> 24) /* Top 8 bits are for protocol minor version */
|
||||||
|
|
||||||
typedef struct connection_status_t {
|
typedef struct connection_status_t {
|
||||||
unsigned int pinged:1; /* sent ping */
|
unsigned int pinged:1; /* sent ping */
|
||||||
|
|
|
@ -117,6 +117,7 @@ static int info_node(int fd, const char *item) {
|
||||||
if(options & OPTION_CLAMP_MSS)
|
if(options & OPTION_CLAMP_MSS)
|
||||||
printf(" clamp_mss");
|
printf(" clamp_mss");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
printf("Protocol: %d.%d\n", PROT_MAJOR, OPTION_VERSION(options));
|
||||||
printf("Reachability: ");
|
printf("Reachability: ");
|
||||||
if(!*port)
|
if(!*port)
|
||||||
printf("can reach itself\n");
|
printf("can reach itself\n");
|
||||||
|
|
|
@ -411,6 +411,8 @@ static bool setup_myself(void) {
|
||||||
myself->connection->protocol_major = PROT_MAJOR;
|
myself->connection->protocol_major = PROT_MAJOR;
|
||||||
myself->connection->protocol_minor = PROT_MINOR;
|
myself->connection->protocol_minor = PROT_MINOR;
|
||||||
|
|
||||||
|
myself->options |= PROT_MINOR << 24;
|
||||||
|
|
||||||
if(!(name = get_name())) {
|
if(!(name = get_name())) {
|
||||||
logger(DEBUG_ALWAYS, LOG_ERR, "Name for tinc daemon required!");
|
logger(DEBUG_ALWAYS, LOG_ERR, "Name for tinc daemon required!");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
/* Protocol version. Different major versions are incompatible. */
|
/* Protocol version. Different major versions are incompatible. */
|
||||||
|
|
||||||
#define PROT_MAJOR 17
|
#define PROT_MAJOR 17
|
||||||
#define PROT_MINOR 2
|
#define PROT_MINOR 2 /* Should not exceed 255! */
|
||||||
|
|
||||||
/* Silly Windows */
|
/* Silly Windows */
|
||||||
|
|
||||||
|
|
|
@ -506,7 +506,7 @@ bool send_ack(connection_t *c) {
|
||||||
|
|
||||||
get_config_int(lookup_config(c->config_tree, "Weight"), &c->estimated_weight);
|
get_config_int(lookup_config(c->config_tree, "Weight"), &c->estimated_weight);
|
||||||
|
|
||||||
return send_request(c, "%d %s %d %x", ACK, myport, c->estimated_weight, c->options);
|
return send_request(c, "%d %s %d %x", ACK, myport, c->estimated_weight, (c->options & 0xffffff) | (PROT_MINOR << 24));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void send_everything(connection_t *c) {
|
static void send_everything(connection_t *c) {
|
||||||
|
|
Loading…
Reference in a new issue