X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fsubnet_parse.c;h=c5f6976ff4080e364ccfc4b5a55c704e959fe7d1;hb=4e5c2193a1fa1ed054956fc0b1df387b19c546a5;hp=c919b59a8eef028710498f77052ebb894c6ba350;hpb=04fc19112da5e7fcefefcf6e490987cdcfb6f620;p=tinc diff --git a/src/subnet_parse.c b/src/subnet_parse.c index c919b59a..c5f6976f 100644 --- a/src/subnet_parse.c +++ b/src/subnet_parse.c @@ -372,7 +372,7 @@ bool net2str(char *netstr, int len, const subnet_t *subnet) { result = snprintf(netstr, len, *format, ":::"); i += max_zero_length; } else { - result = snprintf(netstr, len, "%hx:", ntohs(subnet->net.ipv6.address.x[i])); + result = snprintf(netstr, len, "%x:", ntohs(subnet->net.ipv6.address.x[i])); i++; } netstr += result; @@ -401,11 +401,8 @@ bool net2str(char *netstr, int len, const subnet_t *subnet) { len -= result; } - if (subnet->weight != DEFAULT_WEIGHT) { + if (subnet->weight != DEFAULT_WEIGHT) snprintf(netstr, len, "#%d", subnet->weight); - netstr += result; - len -= result; - } return true; }