Blob Blame Raw
From e27a4f34800d8420a01ee3e7d4182c1d48489182 Mon Sep 17 00:00:00 2001
From: Dominic Cleal <dcleal@redhat.com>
Date: Wed, 12 Feb 2014 09:49:03 +0000
Subject: [PATCH 1/2] IPRoute2: handle hex IDs and hyphens in names, as present
 in rt_dsfield

Fixes RHBZ#1063961

(cherry picked from commit 2686edf4bcc0a2110ef5a2e8c01045ab0081b04e)

Conflicts:
	NEWS
---
 lenses/iproute2.aug            |  3 ++-
 lenses/tests/test_iproute2.aug | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lenses/iproute2.aug b/lenses/iproute2.aug
index 66b4a2c..6f6b1ba 100644
--- a/lenses/iproute2.aug
+++ b/lenses/iproute2.aug
@@ -2,7 +2,8 @@ module IPRoute2 =
   autoload xfm
 
   let empty   = [ del /[ \t]*#?[ \t]*\n/ "\n" ]
-  let record = [ store /[0-9]+/ . del /[ \t]+/ "\t" . key /[a-zA-Z0-9]+/ . Util.comment_or_eol ]
+  let id = Rx.hex | Rx.integer
+  let record = [ store id . del /[ \t]+/ "\t" . key /[a-zA-Z0-9-]+/ . Util.comment_or_eol ]
 
   let lns = ( empty | Util.comment | record ) *
 
diff --git a/lenses/tests/test_iproute2.aug b/lenses/tests/test_iproute2.aug
index cbd7802..cc24efe 100644
--- a/lenses/tests/test_iproute2.aug
+++ b/lenses/tests/test_iproute2.aug
@@ -19,6 +19,11 @@ let conf = "
 203	adsl3
 204	adsl4
 205	wifi0
+#
+# From rt_dsfield
+#
+0x00  default
+0x80  flash-override
 "
 
 test IPRoute2.lns get conf =
@@ -41,3 +46,8 @@ test IPRoute2.lns get conf =
   { "adsl3" = "203" }
   { "adsl4" = "204" }
   { "wifi0" = "205" }
+  { }
+  { "#comment" = "From rt_dsfield" }
+  { }
+  { "default" = "0x00" }
+  { "flash-override" = "0x80" }
-- 
1.8.5.3