Repository : ssh://git@open-mesh.org/alfred
On branch : master
commit 25b4ae66dca453604e91d90d459b2523bb3da891 Author: Sven Eckelmann sven@narfation.org Date: Fri Apr 1 19:22:36 2016 +0200
alfred: Only accept valid mac addresses via unix socket
Not only 00:00:00:00:00:00 but also multicast addresses are invalid as data source for alfred. These have to be checked too before accepting the mac address received from the client over the unix socket.
Fixes: 58e109973bbe ("alfred: Allow setting the source mac via unix sock") Signed-off-by: Sven Eckelmann sven@narfation.org Signed-off-by: Simon Wunderlich sw@simonwunderlich.de
25b4ae66dca453604e91d90d459b2523bb3da891 unix_sock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/unix_sock.c b/unix_sock.c index a0ccc13..ee6dd8f 100644 --- a/unix_sock.c +++ b/unix_sock.c @@ -97,7 +97,6 @@ static int unix_sock_add_data(struct globals *globals, struct alfred_push_data_v0 *push, int client_sock) { - static const char zero[ETH_ALEN] = { 0 }; struct alfred_data *data; struct dataset *dataset; int len, data_len, ret = -1; @@ -124,7 +123,7 @@ static int unix_sock_add_data(struct globals *globals, /* clients should set the source mac to 00:00:00:00:00:00 * to make the server set the source for them */ - if (memcmp(zero, data->source, sizeof(data->source)) == 0) + if (!is_valid_ether_addr(data->source)) memcpy(data->source, &interface->hwaddr, sizeof(interface->hwaddr));