The regexps that are currently used for matching the 'default' keyword
when reading the network-scripts/route6-XXX RedHat configuration file
in settings/plugins/ifcfg-rh/reader.c
will just match the string 'defa', that matches the hex in
IPV6_ADDR_REGEX:
1005 #define IPV6_ADDR_REGEX "[0-9A-Fa-f:.]+"
(...)
1022 const char *pattern_to1 = "^\\s*(" IPV6_ADDR_REGEX "|default)"
/* IPv6 or 'default' keyword */
1023 "(?:/(\\d{1,2}))?";/* optional prefix
*/
1024 const char *pattern_to2 = "to\\s+(" IPV6_ADDR_REGEX "|default)"
/* IPv6 or 'default' keyword */
1025 "(?:/(\\d{1,2}))?";
Which leads to this error:
NetworkManager[2236]: ifcfg-rh: error: Invalid IP6 route destination
address 'defa'
One quick way out is to swap 'default' and IPV6_ADDR_REGEX in the
regexps (as in the attached patch) so that 'default' matches first (at
least in the current g_regexp implementation: as for this being correct
and portable, I can only go as far as Friedl's "Mastering Regular
Expressions", page 112: "you can pretty much count on
each alternative being checked in the order given in the expression").
Thanks.
Francesco Prelz
INFN - Milan
--- ./src/settings/plugins/ifcfg-rh/reader.c.ORIG 2013-01-21
16:59:46.000000000 +0100
+++ ./src/settings/plugins/ifcfg-rh/reader.c 2013-01-21 17:04:23.000000000
+0100
@@ -1041,9 +1041,9 @@
gboolean success = FALSE;
const char *pattern_empty = "^\\s*(\\#.*)?$";
- const char *pattern_to1 = "^\\s*(" IPV6_ADDR_REGEX "|default)" /* IPv6
or 'default' keyword */
+ const char *pattern_to1 = "^\\s*(default|" IPV6_ADDR_REGEX ")" /* IPv6
or 'default' keyword */
"(?:/(\\d{1,3}))?"; /*
optional prefix */
- const char *pattern_to2 = "to\\s+(" IPV6_ADDR_REGEX "|default)" /* IPv6
or 'default' keyword */
+ const char *pattern_to2 = "to\\s+(default|" IPV6_ADDR_REGEX ")" /* IPv6
or 'default' keyword */
"(?:/(\\d{1,3}))?"; /*
optional prefix */
const char *pattern_via = "via\\s+(" IPV6_ADDR_REGEX ")"; /* IPv6
of gateway */
const char *pattern_metric = "metric\\s+(\\d+)"; /*
metric */
_______________________________________________
networkmanager-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/networkmanager-list