crosh: network_diag: make ip matching a bit more robust

The current way we match the IP address doesn't escape the regex which
means the dots are allowed to match any character.  This could lead to
extra/incorrect matches in the arp table which confuses the diagnostic
logic (thinks we have an arp entry when we really don't).

There's a similar issue when it comes to matching device names, but
that doesn't come up as often as all our interfaces are alphanumeric
(with perhaps dashes or underscores thrown in).  We might as well be
correct at any rate :).

BUG=chromium:766271
TEST=`network_diag --wifi` still works

Change-Id: Iac32cc6d80547a63d24417bbef85d1cb620e0f38
Reviewed-on: https://chromium-review.googlesource.com/675706
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
1 file changed