From: VMware, Inc <> Date: Wed, 18 Sep 2013 03:31:31 +0000 (-0700) Subject: Fix parsing logic in guestInfo to parse vlan configured NICs X-Git-Tag: 2013.09.16-1328054~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=518fab531f95c6a31f15f3fb7ae8a43d0eab4064;p=thirdparty%2Fopen-vm-tools.git Fix parsing logic in guestInfo to parse vlan configured NICs The regular expression used to parse routes /proc/net/route and /proc/net/ipv6_route fail when the device names contain "." eg: eth0.80 which is how the interface names appear when we have VLANs configured. This fix modifies the regex to handle this case by parsing until a whitespace character is encountered. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/slashProc/net.c b/open-vm-tools/lib/slashProc/net.c index 7b4fcd4e4..fbaf0176c 100644 --- a/open-vm-tools/lib/slashProc/net.c +++ b/open-vm-tools/lib/slashProc/net.c @@ -536,7 +536,7 @@ SlashProcNet_GetRoute(void) myFieldsRE = g_regex_new("^Iface\\s+Destination\\s+Gateway\\s+Flags\\s+" "RefCnt\\s+Use\\s+Metric\\s+Mask\\s+MTU\\s+" "Window\\s+IRTT\\s*$", 0, 0, NULL); - myValuesRE = g_regex_new("^(\\w+)\\s+([[:xdigit:]]{8})\\s+" + myValuesRE = g_regex_new("^(\\S+)\\s+([[:xdigit:]]{8})\\s+" "([[:xdigit:]]{8})\\s+([[:xdigit:]]{4})\\s+" "\\d+\\s+\\d+\\s+(\\d+)\\s+" "([[:xdigit:]]{8})\\s+(\\d+)\\s+\\d+\\s+(\\d+)\\s*$", @@ -727,7 +727,7 @@ SlashProcNet_GetRoute6(void) "([[:xdigit:]]{32}) ([[:xdigit:]]{2}) " "([[:xdigit:]]{32}) ([[:xdigit:]]{8}) " "[[:xdigit:]]{8} [[:xdigit:]]{8} " - "([[:xdigit:]]{8})\\s+(\\w+)\\s*$", 0, 0, + "([[:xdigit:]]{8})\\s+(\\S+)\\s*$", 0, 0, NULL); ASSERT(myValuesRE); }