Commit 0092a3c5 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Check for V4-mapped addresses in kernel.c.

parent 7e30942b
......@@ -582,6 +582,25 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
}
}
/* Check that the protocol family is consistent. */
if(plen >= 96 && v4mapped(dest)) {
if(!v4mapped(gate)) {
errno = EINVAL;
return -1;
}
} else {
if(v4mapped(gate)) {
errno = EINVAL;
return -1;
}
}
if(v4mapped(gate)) {
/* Not implemented yet. */
errno = EINVAL;
return -1;
}
if(operation == ROUTE_MODIFY) {
if(newmetric == metric && memcmp(newgate, gate, 16) == 0 &&
newifindex == ifindex)
......
......@@ -261,6 +261,25 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
char local[1][1][16] = IN6ADDR_LOOPBACK_INIT;
/* Check that the protocol family is consistent. */
if(plen >= 96 && v4mapped(dest)) {
if(!v4mapped(gate)) {
errno = EINVAL;
return -1;
}
} else {
if(v4mapped(gate)) {
errno = EINVAL;
return -1;
}
}
if(v4mapped(gate)) {
/* Not implemented yet. */
errno = EINVAL;
return -1;
}
if(operation == ROUTE_MODIFY && newmetric == metric &&
memcmp(newgate, gate, 16) == 0 && newifindex == ifindex)
return 0;
......
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