summaryrefslogtreecommitdiff
path: root/eth-multiplexer/ethernet.h
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-11-05 18:41:13 +0100
committerJustus Winter <justus@gnupg.org>2016-11-05 18:47:09 +0100
commit54c6736341bda9564a028ad3d61d46488e53b8a6 (patch)
tree0e27d98a6ace8074b63a5ab60576c292ffbd529b /eth-multiplexer/ethernet.h
parent115695afe34e5253816ff0e828054f8c07e2ddbd (diff)
eth-multiplexer: Generate stable ethernet addresses.
Previously, the ethernet multiplexer generated ethernet addresses for the virtual interfaces using a pseudo-random number generator. This has the downside of generating a new address every time. Generate stable pseudo-random addresses instead. * eth-multiplexer/Makefile (HURDLIBS): Link to libihash. * eth-multiplexer/ethernet.c (ether_address): New variable. (get_ethernet_address): New function. (ethernet_open): Get the ethernet address of the real interface. * eth-multiplexer/ethernet.h (ether_address): New declaration. * eth-multiplexer/vdev.c (add_vdev): Compute the ethernet address by hashing the address of the real interface with the name of the virtual interface.
Diffstat (limited to 'eth-multiplexer/ethernet.h')
-rw-r--r--eth-multiplexer/ethernet.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/eth-multiplexer/ethernet.h b/eth-multiplexer/ethernet.h
index 8efab9b1..a2b2f5ee 100644
--- a/eth-multiplexer/ethernet.h
+++ b/eth-multiplexer/ethernet.h
@@ -23,10 +23,12 @@
#ifndef ETHERNET_H
#define ETHERNET_H
+#include <mach.h>
+#include <net/if_ether.h>
#include <netinet/in.h>
-#include <stdlib.h>
extern mach_port_t ether_port;
+extern char ether_address[ETH_ALEN];
int ethernet_open (char *dev_name, device_t master_device,
struct port_bucket *etherport_bucket,