Commit a79b74a9 authored by Russ Fish's avatar Russ Fish
Browse files

Cache the getmac output early on, while all interfaces are enabled.

parent f52ed723
...@@ -223,10 +223,18 @@ find_iface(char *macaddr) ...@@ -223,10 +223,18 @@ find_iface(char *macaddr)
static int static int
find_iface(char *macaddr) find_iface(char *macaddr)
{ {
#if 1
/* We cache the getmac output early on in rc.cygwin, while all of the
* interfaces are still enabled. Later, we get no MAC info.
*/
FILE *fp = fopen("/var/emulab/boot/getmac-cache", "r");
#else
/* We copy the Windows getmac.exe and library framedyn.dll into $BINDIR /* We copy the Windows getmac.exe and library framedyn.dll into $BINDIR
* because our path gets "untainted" into a pure Unix form in rc scripts. * because our path gets "untainted" into a pure Unix form in rc scripts.
*/ */
FILE *fp = popen("bash -c 'cd /usr/local/etc/emulab; ./getmac /nh /v /fo csv'", "r"); FILE *fp = popen(
"bash -c 'cd /usr/local/etc/emulab; ./getmac /nh /v /fo csv'", "r");
#endif
char buf[BUFSIZ]; char buf[BUFSIZ];
while (fgets(buf, BUFSIZ, fp) != NULL) { while (fgets(buf, BUFSIZ, fp) != NULL) {
......
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