2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-04 16:25:17 +00:00

lib: add ipv6 helper functions for tnl_config

These functions will be used by the next patches.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Jiri Benc
2015-10-22 15:28:54 -02:00
committed by Ben Pfaff
parent dd7652e66b
commit 9835576bc1
5 changed files with 23 additions and 0 deletions

View File

@@ -136,6 +136,15 @@ set_dscp(int fd, int family, uint8_t dscp)
return retval ? sock_errno() : 0;
}
/* Checks whether 'host_name' is an IPv4 or IPv6 address. It is assumed
* that 'host_name' is valid. Returns false if it is IPv4 address, true if
* it is IPv6 address. */
bool
addr_is_ipv6(const char *host_name)
{
return strchr(host_name, ':') != NULL;
}
/* Translates 'host_name', which must be a string representation of an IP
* address, into a numeric IP address in '*addr'. Returns 0 if successful,
* otherwise a positive errno value. */