[PATCH 0/2] Fix netcf interface schema
by Laine Stump
I noticed these when testing "virsh iface-define" with an updated
libvirt. Awhile back (1.2.6). I had changed the ordering of elements
emitted fort <interface> in libvirt in order to simplify the code when
adding in the new <link> element that shows up only in the status
(e.g. virsh iface-dumpxml). What I neglected to notice was that this
caused all attempts to use "virsh iface-define" to fail - that is the
reason for 1/2. 2/2 is really just informational.
These are bad enough that I'm going to do a new netcf release (even
though I tagged a release just yesterday).
Laine Stump (2):
allow reordering of elements in interface xml
permit link state in XML schema for bonds and vlans too
data/xml/interface.rng | 316 +++++++++++++++++++++++++++----------------------
1 file changed, 173 insertions(+), 143 deletions(-)
--
1.9.3
9 years, 8 months
[PATCH] Fix netmask for prefix == 32
by Laine Stump
This resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1116314
If an interface was defines with a network prefix of 32 (could be used
for a point-to-point link), instead of translating into a netmask of
255.255.255.255, it would end up being 0.0.0.0. This behavior was
caused by the function ipcalc_netmask() assuming that
~(0xffffffffu >> 32) would be 0xffffffffu, when in fact the result of
shifting right a 32 bit number by 32 positions is undefined. As it
happens, in the case of the code generated by gccc, the result of the
above is 0, when it should in fact be 0xffffffffu.
The safe way to deal with this is to simply special-case prefix == 32.
---
src/xslt_ext.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/xslt_ext.c b/src/xslt_ext.c
index f35f19b..bf1ec9c 100644
--- a/src/xslt_ext.c
+++ b/src/xslt_ext.c
@@ -1,7 +1,7 @@
/*
* xslt_ext.c: XSLT extension functions needed by the stylesheets
*
- * Copyright (C) 2009 Red Hat Inc.
+ * Copyright (C) 2009, 2014 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -43,6 +43,8 @@
static void ipcalc_netmask(xmlXPathParserContextPtr ctxt, int nargs) {
double raw_prefix;
unsigned long prefix = 0;
+ struct in_addr netmask;
+ xmlChar netmask_str[16];
if (nargs != 1) {
xmlXPathSetArityError(ctxt);
@@ -69,10 +71,13 @@ static void ipcalc_netmask(xmlXPathParserContextPtr ctxt, int nargs) {
goto error;
}
- struct in_addr netmask;
- xmlChar netmask_str[16];
-
- netmask.s_addr = htonl(~(0xffffffffu >> prefix));
+ /* We need to special-case 32, because the result of "x >> 32"
+ * is undefined when the number of bits in x's type is == 32.
+ */
+ if (prefix == 32)
+ netmask.s_addr = 0xffffffffu;
+ else
+ netmask.s_addr = htonl(~(0xffffffffu >> prefix));
if (! inet_ntop(AF_INET, &netmask,
(char *) netmask_str, sizeof(netmask_str))) {
--
1.9.3
9 years, 8 months
[PATCH] Fix name of DHCPV6C variable in ifcfg files
by Laine Stump
This is a *very* longstanding bug, which shows that nobody using DHCP
on IPv6 is using netcf - the name of the DHCPV6C variable was
incorrectly put in as DHCPV6 all the way back when the netcf package
was first written, and nobody noticed, until this bug was filed:
https://bugzilla.redhat.com/show_bug.cgi?id=1113978
---
data/xml/redhat-get.xsl | 4 ++--
data/xml/redhat-put.xsl | 2 +-
data/xml/suse-get.xsl | 4 ++--
data/xml/suse-put.xsl | 2 +-
tests/redhat/schema/ipv6-autoconf-dhcp.xml | 2 +-
tests/redhat/schema/ipv6-autoconf.xml | 2 +-
tests/redhat/schema/ipv6-dhcp.xml | 2 +-
tests/redhat/schema/ipv6-local.xml | 2 +-
tests/redhat/schema/ipv6-static-multi.xml | 2 +-
tests/redhat/schema/ipv6-static.xml | 2 +-
tests/suse/schema/ipv6-autoconf-dhcp.xml | 2 +-
tests/suse/schema/ipv6-autoconf.xml | 2 +-
tests/suse/schema/ipv6-dhcp.xml | 2 +-
tests/suse/schema/ipv6-local.xml | 2 +-
tests/suse/schema/ipv6-static-multi.xml | 2 +-
tests/suse/schema/ipv6-static.xml | 2 +-
16 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/data/xml/redhat-get.xsl b/data/xml/redhat-get.xsl
index fab8ecb..923dde0 100644
--- a/data/xml/redhat-get.xsl
+++ b/data/xml/redhat-get.xsl
@@ -211,10 +211,10 @@
<node label="IPV6_AUTOCONF" value="no"/>
</xsl:if>
<xsl:if test="count(dhcp) > 0">
- <node label="DHCPV6" value="yes"/>
+ <node label="DHCPV6C" value="yes"/>
</xsl:if>
<xsl:if test="count(dhcp) = 0">
- <node label="DHCPV6" value="no"/>
+ <node label="DHCPV6C" value="no"/>
</xsl:if>
<xsl:if test="count(ip) > 0">
<node label="IPV6ADDR">
diff --git a/data/xml/redhat-put.xsl b/data/xml/redhat-put.xsl
index 88e6d73..579da12 100644
--- a/data/xml/redhat-put.xsl
+++ b/data/xml/redhat-put.xsl
@@ -221,7 +221,7 @@
<xsl:if test="node[@label = 'IPV6_AUTOCONF'][@value = 'yes']">
<autoconf/>
</xsl:if>
- <xsl:if test="node[@label = 'DHCPV6'][@value = 'yes']">
+ <xsl:if test="node[@label = 'DHCPV6C'][@value = 'yes']">
<dhcp/>
</xsl:if>
<xsl:if test="node[@label = 'IPV6ADDR']">
diff --git a/data/xml/suse-get.xsl b/data/xml/suse-get.xsl
index dd5dff6..182d292 100644
--- a/data/xml/suse-get.xsl
+++ b/data/xml/suse-get.xsl
@@ -228,10 +228,10 @@
<node label="IPV6_AUTOCONF" value="no"/>
</xsl:if>
<xsl:if test="count(dhcp) > 0">
- <node label="DHCPV6" value="yes"/>
+ <node label="DHCPV6C" value="yes"/>
</xsl:if>
<xsl:if test="count(dhcp) = 0">
- <node label="DHCPV6" value="no"/>
+ <node label="DHCPV6C" value="no"/>
</xsl:if>
<xsl:if test="count(ip) > 0">
<node label="IPV6ADDR">
diff --git a/data/xml/suse-put.xsl b/data/xml/suse-put.xsl
index 1b5145a..f3903a2 100644
--- a/data/xml/suse-put.xsl
+++ b/data/xml/suse-put.xsl
@@ -214,7 +214,7 @@
<xsl:if test="node[@label = 'IPV6_AUTOCONF'][@value = 'yes']">
<autoconf/>
</xsl:if>
- <xsl:if test="node[@label = 'DHCPV6'][@value = 'yes']">
+ <xsl:if test="node[@label = 'DHCPV6C'][@value = 'yes']">
<dhcp/>
</xsl:if>
<xsl:if test="node[@label = 'IPV6ADDR']">
diff --git a/tests/redhat/schema/ipv6-autoconf-dhcp.xml b/tests/redhat/schema/ipv6-autoconf-dhcp.xml
index f755fa4..c15fea7 100644
--- a/tests/redhat/schema/ipv6-autoconf-dhcp.xml
+++ b/tests/redhat/schema/ipv6-autoconf-dhcp.xml
@@ -5,6 +5,6 @@
<node label="ONBOOT" value="yes"/>
<node label="IPV6INIT" value="yes"/>
<node label="IPV6_AUTOCONF" value="yes"/>
- <node label="DHCPV6" value="yes"/>
+ <node label="DHCPV6C" value="yes"/>
</tree>
</forest>
diff --git a/tests/redhat/schema/ipv6-autoconf.xml b/tests/redhat/schema/ipv6-autoconf.xml
index 637864c..b6d9049 100644
--- a/tests/redhat/schema/ipv6-autoconf.xml
+++ b/tests/redhat/schema/ipv6-autoconf.xml
@@ -5,6 +5,6 @@
<node label="ONBOOT" value="yes"/>
<node label="IPV6INIT" value="yes"/>
<node label="IPV6_AUTOCONF" value="yes"/>
- <node label="DHCPV6" value="no"/>
+ <node label="DHCPV6C" value="no"/>
</tree>
</forest>
diff --git a/tests/redhat/schema/ipv6-dhcp.xml b/tests/redhat/schema/ipv6-dhcp.xml
index c87f0ce..e3a36b0 100644
--- a/tests/redhat/schema/ipv6-dhcp.xml
+++ b/tests/redhat/schema/ipv6-dhcp.xml
@@ -5,6 +5,6 @@
<node label="ONBOOT" value="yes"/>
<node label="IPV6INIT" value="yes"/>
<node label="IPV6_AUTOCONF" value="no"/>
- <node label="DHCPV6" value="yes"/>
+ <node label="DHCPV6C" value="yes"/>
</tree>
</forest>
diff --git a/tests/redhat/schema/ipv6-local.xml b/tests/redhat/schema/ipv6-local.xml
index 96294f8..a6d4a3d 100644
--- a/tests/redhat/schema/ipv6-local.xml
+++ b/tests/redhat/schema/ipv6-local.xml
@@ -5,6 +5,6 @@
<node label="ONBOOT" value="yes"/>
<node label="IPV6INIT" value="yes"/>
<node label="IPV6_AUTOCONF" value="no"/>
- <node label="DHCPV6" value="no"/>
+ <node label="DHCPV6C" value="no"/>
</tree>
</forest>
diff --git a/tests/redhat/schema/ipv6-static-multi.xml b/tests/redhat/schema/ipv6-static-multi.xml
index e8eec8f..d865a05 100644
--- a/tests/redhat/schema/ipv6-static-multi.xml
+++ b/tests/redhat/schema/ipv6-static-multi.xml
@@ -5,7 +5,7 @@
<node label="ONBOOT" value="yes"/>
<node label="IPV6INIT" value="yes"/>
<node label="IPV6_AUTOCONF" value="no"/>
- <node label="DHCPV6" value="no"/>
+ <node label="DHCPV6C" value="no"/>
<node label="IPV6ADDR" value="3ffe:ffff:0:5::1/128"/>
<node label="IPV6ADDR_SECONDARIES" value="'3ffe:ffff:0:5::3/128 3ffe:ffff:0:5::5/128'"/>
</tree>
diff --git a/tests/redhat/schema/ipv6-static.xml b/tests/redhat/schema/ipv6-static.xml
index 187b1dc..26d71e0 100644
--- a/tests/redhat/schema/ipv6-static.xml
+++ b/tests/redhat/schema/ipv6-static.xml
@@ -5,7 +5,7 @@
<node label="ONBOOT" value="yes"/>
<node label="IPV6INIT" value="yes"/>
<node label="IPV6_AUTOCONF" value="no"/>
- <node label="DHCPV6" value="no"/>
+ <node label="DHCPV6C" value="no"/>
<node label="IPV6ADDR" value="3ffe:ffff:0:5::1/128"/>
<node label="IPV6_DEFAULTGW" value="3ffe:ffff:1234:5678::1"/>
</tree>
diff --git a/tests/suse/schema/ipv6-autoconf-dhcp.xml b/tests/suse/schema/ipv6-autoconf-dhcp.xml
index f755fa4..c15fea7 100644
--- a/tests/suse/schema/ipv6-autoconf-dhcp.xml
+++ b/tests/suse/schema/ipv6-autoconf-dhcp.xml
@@ -5,6 +5,6 @@
<node label="ONBOOT" value="yes"/>
<node label="IPV6INIT" value="yes"/>
<node label="IPV6_AUTOCONF" value="yes"/>
- <node label="DHCPV6" value="yes"/>
+ <node label="DHCPV6C" value="yes"/>
</tree>
</forest>
diff --git a/tests/suse/schema/ipv6-autoconf.xml b/tests/suse/schema/ipv6-autoconf.xml
index 637864c..b6d9049 100644
--- a/tests/suse/schema/ipv6-autoconf.xml
+++ b/tests/suse/schema/ipv6-autoconf.xml
@@ -5,6 +5,6 @@
<node label="ONBOOT" value="yes"/>
<node label="IPV6INIT" value="yes"/>
<node label="IPV6_AUTOCONF" value="yes"/>
- <node label="DHCPV6" value="no"/>
+ <node label="DHCPV6C" value="no"/>
</tree>
</forest>
diff --git a/tests/suse/schema/ipv6-dhcp.xml b/tests/suse/schema/ipv6-dhcp.xml
index c87f0ce..e3a36b0 100644
--- a/tests/suse/schema/ipv6-dhcp.xml
+++ b/tests/suse/schema/ipv6-dhcp.xml
@@ -5,6 +5,6 @@
<node label="ONBOOT" value="yes"/>
<node label="IPV6INIT" value="yes"/>
<node label="IPV6_AUTOCONF" value="no"/>
- <node label="DHCPV6" value="yes"/>
+ <node label="DHCPV6C" value="yes"/>
</tree>
</forest>
diff --git a/tests/suse/schema/ipv6-local.xml b/tests/suse/schema/ipv6-local.xml
index 96294f8..a6d4a3d 100644
--- a/tests/suse/schema/ipv6-local.xml
+++ b/tests/suse/schema/ipv6-local.xml
@@ -5,6 +5,6 @@
<node label="ONBOOT" value="yes"/>
<node label="IPV6INIT" value="yes"/>
<node label="IPV6_AUTOCONF" value="no"/>
- <node label="DHCPV6" value="no"/>
+ <node label="DHCPV6C" value="no"/>
</tree>
</forest>
diff --git a/tests/suse/schema/ipv6-static-multi.xml b/tests/suse/schema/ipv6-static-multi.xml
index e8eec8f..d865a05 100644
--- a/tests/suse/schema/ipv6-static-multi.xml
+++ b/tests/suse/schema/ipv6-static-multi.xml
@@ -5,7 +5,7 @@
<node label="ONBOOT" value="yes"/>
<node label="IPV6INIT" value="yes"/>
<node label="IPV6_AUTOCONF" value="no"/>
- <node label="DHCPV6" value="no"/>
+ <node label="DHCPV6C" value="no"/>
<node label="IPV6ADDR" value="3ffe:ffff:0:5::1/128"/>
<node label="IPV6ADDR_SECONDARIES" value="'3ffe:ffff:0:5::3/128 3ffe:ffff:0:5::5/128'"/>
</tree>
diff --git a/tests/suse/schema/ipv6-static.xml b/tests/suse/schema/ipv6-static.xml
index 187b1dc..26d71e0 100644
--- a/tests/suse/schema/ipv6-static.xml
+++ b/tests/suse/schema/ipv6-static.xml
@@ -5,7 +5,7 @@
<node label="ONBOOT" value="yes"/>
<node label="IPV6INIT" value="yes"/>
<node label="IPV6_AUTOCONF" value="no"/>
- <node label="DHCPV6" value="no"/>
+ <node label="DHCPV6C" value="no"/>
<node label="IPV6ADDR" value="3ffe:ffff:0:5::1/128"/>
<node label="IPV6_DEFAULTGW" value="3ffe:ffff:1234:5678::1"/>
</tree>
--
1.9.3
9 years, 8 months
[PATCH] Maximum vlanid should be 4095
by jiahu
The valid vlan id range is 0~4095.
Please refer to /usr/share/doc/initscripts-9.47/sysconfig.txt
Ethernet 802.1q VLAN items:
DEVICE=eth0.42
Initscripts use the device name for VLAN devices.
Example: eth0.42 for vlan 42 on device eth0.
Valid VLAN ID range is 0-4095. Most ethernet switches reserve
VLAN ID 1 to be used as management VLAN; starting from VLAN
ID 2 is recommended.
---
data/xml/interface.rng | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/data/xml/interface.rng b/data/xml/interface.rng
index 8a058a6..845d871 100644
--- a/data/xml/interface.rng
+++ b/data/xml/interface.rng
@@ -491,7 +491,7 @@
<define name='vlan-id'>
<data type="unsignedInt">
- <param name="maxInclusive">4096</param>
+ <param name="maxInclusive">4095</param>
</data>
</define>
</grammar>
--
1.8.3.1
9 years, 8 months