Skip to content

Commit 6ea9166

Browse files
author
Christoph Biedl
committed
Deal with a missing interface
At the moment, vblade handles an unknown or missing interface to bind to not that well (seen on Linux): | bind funky: No such device | Can't get hw addr: Bad file descriptor | pid 1664: e12.3, 131072 sectors O_RDWR | Can't get mtu: Bad file descriptor | putpkt aoe id: Bad file descriptor | read network: Bad file descriptor Two problems here: * (linux only) In dial, the getindx result is not checked. The following bind call however fails for an invalid interface index. But "bind funky" isn't quite a helpful error message. * The main routine does not check the dial result. Patches for both are fairly simple. The freebsd counterpart for the first one is missing, though.
1 parent 0b3652f commit 6ea9166

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

aoe.c

+2
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ main(int argc, char **argv)
536536
}
537537
ifname = argv[2];
538538
sfd = dial(ifname, bufcnt);
539+
if (sfd < 0)
540+
return 1;
539541
getea(sfd, ifname, mac);
540542
printf("pid %ld: e%d.%d, %lld sectors %s\n",
541543
(long) getpid(), shelf, slot, size,

linux.c

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ dial(char *eth, int bufcnt) // get us a raw connection to an interface
4747
return -1;
4848
}
4949
i = getindx(s, eth);
50+
if (i < 0) {
51+
perror(eth);
52+
return -1;
53+
}
5054
sa.sll_family = AF_PACKET;
5155
sa.sll_protocol = htons(0x88a2);
5256
sa.sll_ifindex = i;

0 commit comments

Comments
 (0)