check_ethernet: don't ping via "down" links

I've noticed that we have some timing problems since:

where we're holding /run/autotest_pause_ethernet_hook for upwards of 25
seconds. One reason: we're wasting a lot of time when there are
un-connected links (e.g., Chromeboxes with built-in Ethernet, but the
lab uses a USB dongle). Don't bother pinging anything if the operational
state is not "up".

Per Linux documentation:

  Indicates the interface RFC2863 operational state as a string.
  Possible values are:
  "unknown", "notpresent", "down", "lowerlayerdown", "testing",
  "dormant", "up".

TEST=plug in an unused USB ethernet dongle; ensure only eth1 is active;
     then watch how long check_ethernet.hook takes

Change-Id: I8c1288c36cc9b15347dc8ea86cafb2e4bf12fb9f
Tested-by: Brian Norris <>
Commit-Ready: Brian Norris <>
Legacy-Commit-Queue: Commit Bot <>
Reviewed-by: Grant Grundler <>
1 file changed