summaryrefslogtreecommitdiff
path: root/lib/net.c
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2015-12-18 11:57:38 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2015-12-20 13:47:39 +0100
commit7fd4143eadd5af6e1ad7825d7d7506ad021bf1ad (patch)
treeb16f93737a5bda12b6677a5ad3f45cf5b1c13c30 /lib/net.c
parent9656dce72eead158e6da3ad560720bb0addfe7e2 (diff)
Integrated address print lengths
Minor changes by Ondrej Santiago Zajicek
Diffstat (limited to 'lib/net.c')
-rw-r--r--lib/net.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/net.c b/lib/net.c
index 56eb16fd..b851871a 100644
--- a/lib/net.c
+++ b/lib/net.c
@@ -18,6 +18,13 @@ const u8 net_max_prefix_length[] = {
[NET_VPN6] = IP4_MAX_PREFIX_LENGTH
};
+const u16 net_max_text_length[] = {
+ [NET_IP4] = 18, /* "255.255.255.255/32" */
+ [NET_IP6] = 43, /* "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128" */
+ [NET_VPN4] = 40, /* "4294967296:4294967296 255.255.255.255/32" */
+ [NET_VPN6] = 65, /* "4294967296:4294967296 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff/128" */
+};
+
int
net_format(const net_addr *N, char *buf, int buflen)