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
(cherry picked from commit b0de69a847cab5cd8452c872f8327b289a3c07c0)
Reviewed-on: https://chromium-review.googlesource.com/677920
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
1 file changed