[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 3/3] Do a better job of validating IP and MAC addresses in network.rng



On 11/11/2010 04:05 PM, Eric Blake wrote:
On 11/11/2010 01:41 PM, Laine Stump wrote:
+<!-- An ipv4 "dotted quad" address -->
+<define name='ipv4-addr'>
+<data type='string'>
+<param name="pattern">(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2}))\.){3}((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2}))</param>
This allows 01.1.1.1 (leading zero looks unusual in an IPv4 address).  I
would have done something like:

(((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9][0-9])|[0-9])\.){3}...


I see what you mean.

How about if I squash in the attached delta-diff?

(I'll send a patch for the same regex in interface.rng, the source of this one, separately).
>From 6519766e5725d0d0d9fa27cb26c8e9822195eab6 Mon Sep 17 00:00:00 2001
From: Laine Stump <laine laine org>
Date: Thu, 11 Nov 2010 16:52:45 -0500
Subject: [PATCH] Fixup ipv4-address regex

---
 docs/schemas/network.rng |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index aa98997..1daa30e 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -129,7 +129,7 @@
   <!-- An ipv4 "dotted quad" address -->
   <define name='ipv4-addr'>
     <data type='string'>
-      <param name="pattern">(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2}))\.){3}((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2}))</param>
+      <param name="pattern">(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))</param>
     </data>
   </define>
 
-- 
1.7.2.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]