Skip to content

Commit

Permalink
Ignore virtual ethernet devices that disappear (#51581)
Browse files Browse the repository at this point in the history
When checking if a device is up, today we can run into virtual ethernet
devices that disappear while we are in the middle of checking. This
leads to "no such device". This commit addresses such devices by
treating them as not being up, if they are virtual ethernet devices that
disappeared while we were checking.
  • Loading branch information
jasontedor committed Jan 28, 2020
1 parent 3a71929 commit b080237
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ private static boolean isUp(final NetworkInterface intf) throws IOException {
try {
return intf.isUp();
} catch (final SocketException e) {
// virtual ethernet devices come and go, we will treat such a device that disappeared as not being up
if (intf.getName().startsWith("veth") && e.getMessage().equals("No such device (getFlags() failed)")) {
return false;
}
throw new IOException("failed to check if interface [" + intf.getName() + "] is up", e);
}
}
Expand Down

0 comments on commit b080237

Please sign in to comment.