va_end(ap);
}
+static char *strip_weight(char *netstr) {
+ int len = strlen(netstr);
+ if(len >= 3 && !strcmp(netstr + len - 3, "#10"))
+ netstr[len - 3] = 0;
+ return netstr;
+}
+
static int info_node(int fd, const char *item) {
// Check the list of nodes
sendline(fd, "%d %d %s", CONTROL, REQ_DUMP_NODES, item);
printf(" reachable");
if(status.indirect)
printf(" indirect");
- if(status.ecdh)
- printf(" ecdh");
printf("\n");
printf("Options: ");
if(options & OPTION_INDIRECT)
if(options & OPTION_CLAMP_MSS)
printf(" clamp_mss");
printf("\n");
+ printf("Protocol: %d.%d\n", PROT_MAJOR, OPTION_VERSION(options));
printf("Reachability: ");
if(!*port)
printf("can reach itself\n");
return 1;
}
if(!strcmp(from, item))
- printf(" %s", subnet);
+ printf(" %s", strip_weight(subnet));
}
printf("\n");
static int info_subnet(int fd, const char *item) {
subnet_t subnet, find;
- if(!str2net(&find, item))
+ if(!str2net(&find, item)) {
+ fprintf(stderr, "Could not parse subnet or address '%s'.\n", item);
return 1;
+ }
bool address = !strchr(item, '/');
bool weight = strchr(item, '#');
}
found = true;
- printf("Subnet: %s\n", netstr);
+ printf("Subnet: %s\n", strip_weight(netstr));
printf("Owner: %s\n", owner);
}