Commit cca6ad32 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add v4tov6.

parent 21148a84
...@@ -284,3 +284,10 @@ v4mapped(const unsigned char *address) ...@@ -284,3 +284,10 @@ v4mapped(const unsigned char *address)
{ {
return in_prefix(address, v4prefix, 96); return in_prefix(address, v4prefix, 96);
} }
void
v4tov6(unsigned char *dst, const unsigned char *src)
{
memcpy(dst, v4prefix, 12);
memcpy(dst + 12, src, 4);
}
...@@ -50,6 +50,7 @@ int parse_net(const char *net, unsigned char *prefix_r, unsigned char *plen_r); ...@@ -50,6 +50,7 @@ int parse_net(const char *net, unsigned char *prefix_r, unsigned char *plen_r);
int wait_for_fd(int direction, int fd, int msecs); int wait_for_fd(int direction, int fd, int msecs);
int martian_prefix(const unsigned char *prefix, int plen); int martian_prefix(const unsigned char *prefix, int plen);
int v4mapped(const unsigned char *address); int v4mapped(const unsigned char *address);
void v4tov6(unsigned char *dst, const unsigned char *src);
/* If debugging is disabled, we want to avoid calling format_address /* If debugging is disabled, we want to avoid calling format_address
for every omitted debugging message. So debug is a macro. But for every omitted debugging message. So debug is a macro. But
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment