]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix parsing logic in guestInfo to parse vlan configured NICs
authorVMware, Inc <>
Wed, 18 Sep 2013 03:31:31 +0000 (20:31 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 23 Sep 2013 05:14:24 +0000 (22:14 -0700)
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 <dtor@vmware.com>
open-vm-tools/lib/slashProc/net.c

index 7b4fcd4e45ebfb1c3633fbe7b2dcdf0babc4a9d0..fbaf0176c2b43d0325d2b0b163c700801a52c7ff 100644 (file)
@@ -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);
    }