[PATCH 0/3] Eliminate errors and config-based ips from ncf_if_xml_state
by Laine Stump
The originalpatch for ncf_if_xml_state would search for the first ip
node within the ipv4 protocol node, and replace it with the results of
SIOCGIFADDR (or sometimes just add a new one on.)
Now we remove all ip addresses sourced from the config, even if we
can't get any replacements from the device.
14 years, 7 months
[PATCH 0/3] Add ncf_if_xml_state to report live interface config
by Laine Stump
The backend of this uses ioctl(SIOCGIFADDR), instead of the NETLINK
socket (which is the proper way to do it), which limits it to
IPv4-only, and just a single IP address per interface. This is just
temporary until I understand netlink better (and it does happen to
meet the requirements of most users), and allows us to give the new
API a workout in the meantime.
Note that I just added the function name into the public symbol list
in the NETCF_1.0.0 section, since the actual version is still at
0.1.1, so I'm not sure what to do with it...
14 years, 7 months
ANNOUNCE: netcf 0.1.2
by David Lutterkort
I am pleased to announce the release of netcf 0.1.2.
This release contains a few bugfixes, but it's mostly about two
additional features:
* Configure IPv6 addresses on interfaces (see
tests/interface/ipv6-*.xml)
* ncf_if_xml_state: new API call to get currently assigned IP of
an interface (Laine Stump)
Tarball: https://fedorahosted.org/released/netcf/netcf-0.1.2.tar.gz
GPG signature[1]: https://fedorahosted.org/released/netcf/netcf-0.1.2.tar.gz.sig
RPM's for Fedora and EPEL are making their way through the build systems
and will be available shortly from the usual repos.
David
[1] To verify the signature, first download both the .sig file and the
corresponding tarball. Then, run a command like this:
gpg --verify netcf-0.1.2.tar.gz.sig
If that command fails because you don't have the required public key,
then run this command to import it:
gpg --keyserver keys.gnupg.net --recv-keys FC6E8A22
and rerun the `gpg --verify' command.
14 years, 7 months
Basic IPv6 support
by David Lutterkort
These patches add basic IPv6 support to netcf. They are not terribly
well-tested, but seem to work AFAICT (I'd appreciate any help testing this).
The interface.rng schema (patch 1/3) now allows an IPv6 block
<protocol family="ipv6">
<autoconf/>
<dhcp/>
<ip address="3ffe:ffff:0:5::1" prefix="128"/>
.. more <ip/> addresses ..
<route gateway="3ffe:ffff:1234:5678::1"/>
</protocol>
where anything inside the <protocol/> tag is optional.
Detailed examples can be found in patch 3/3
Given the Fedora release schedule, I am probably going to cut another netcf
release containing these patches tomorrow. Therefore, feedback by tomorrow
would be most valuable ;)
David
14 years, 7 months
Preparing for aditional drivers
by Jonas Eriksson
Hello,
This is the last set of patches before the amount of shared code
between the SuSE-driver (in its current state, at least) and the
current initscripts driver is almost nil.
The last two patches were only discussed briefly, so I kept them
at the end. Feel free to react, and note that it means that all
"variables" in an ifcfg-file will get single quotes. The lens is
however able to read unquoted variables from these files.
For the SuSE-driver, I currently lack VLAN-support (which on SuSE
is a mess in some aspects), and some tests. Hopefully, these
things won't take long to fix.
/Jonas
14 years, 7 months
ANNOUNCE: netcf 0.1.1
by David Lutterkort
I am pleased to announce the release of netcf 0.1.1.
Besides many bugfixes, this release makes it possible to add bonds to
bridges, allows bridges with nothing enslaved, and lets you set the
forward delay of a bridge.
Detailed news:
- Bridge: allow setting forward delay
- Bridge: allow bridges with nothing enslaved
- Bridge: allow enslaving a bond
- Bond: properly translate numeric modes into textual modes
- Lookup MAC's without regarding case (bz 512955)
- Fix initialization of libxslt-1.1.24; this works around a threading bug
in libxslt exposed by using netcf with libvirt (Daniel Veillard)
- Print augeas initialization errors only when the environment variable
NETCF_DEBUG exists (bz 513212)
- Ignore the same backup etc. files ignored by the initscripts (bz 512950)
- Search interface config files in the same manner as initscripts'
need_config (bz 512950)
- Only read/modify iptables and system-config-firewall when
net.bridge.bridge-nf-call-iptables sysctl is 1 (bz 517617)
- Respect PREFIX in ifcfg file; if it's not there, continue to derive it
from NETMASK
- Properly propagate errors from running ifup/ifdown
- ncf_define: fix removal of old interface config before redefining it
- ncf_define: do not crash when defining a VLAN interface without a name
(commit fb0543cc)
- Move code around for upcoming SuSe driver (Jonas Eriksson)
Tarball: https://fedorahosted.org/released/netcf/netcf-0.1.1.tar.gz
GPG signature[1]: https://fedorahosted.org/released/netcf/netcf-0.1.1.tar.gz.sig
RPM's for Fedora and EPEL are making their way through the build systems
and will be available shortly from the usual repos.
David
[1] To verify the signature, first download both the .sig file and the
corresponding tarball. Then, run a command like this:
gpg --verify netcf-0.1.1.tar.gz.sig
If that command fails because you don't have the required public key,
then run this command to import it:
gpg --keyserver keys.gnupg.net --recv-keys FC6E8A22
and rerun the `gpg --verify' command.
14 years, 7 months
[PATCH] * src/drv_initscripts (device_name_from_xml): allow no name on interface
by David Lutterkort
The name for VLAN interfaces is optional; generate a name if it is missing
---
src/drv_initscripts.c | 46 ++++++++++++++++++++++++++++++++++++++--------
1 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/src/drv_initscripts.c b/src/drv_initscripts.c
index 299949b..2abed25 100644
--- a/src/drv_initscripts.c
+++ b/src/drv_initscripts.c
@@ -739,15 +739,45 @@ char *drv_xml_desc(struct netcf_if *nif) {
goto done;
}
-/* Get the content of /interface/@name. Result must be freed with xmlFree() */
-static char *device_name_from_xml(xmlDocPtr xml) {
- xmlNodePtr iface;
- char *result;
+/* Get the content of /interface/@name. Result must be freed with xmlFree()
+ *
+ * The name on VLAN interfaces is optional; if there is no
+ * /interface/@name, construct a name for the VLAN interface and set
+ * /interface/@name in NCF_XML to it. This way, other code can assume we
+ * always have a name on the interface.
+ */
+static char *device_name_from_xml(struct netcf *ncf, xmlDocPtr ncf_xml) {
+ xmlXPathContextPtr context = NULL;
+ xmlXPathObjectPtr obj = NULL;
+ char *result = NULL;
- iface = xmlDocGetRootElement(xml);
- if (iface == NULL) return NULL;
+ context = xmlXPathNewContext(ncf_xml);
+ ERR_NOMEM(context == NULL, ncf);
- result = xml_prop(iface, "name");
+ obj = xmlXPathEvalExpression(BAD_CAST "string(/interface/@name)", context);
+ ERR_NOMEM(obj == NULL, ncf);
+ assert(obj->type == XPATH_STRING);
+
+ if (xmlStrlen(obj->stringval) == 0) {
+ xmlXPathFreeObject(obj);
+ obj = xmlXPathEvalExpression(BAD_CAST
+ "concat(/interface/vlan/interface/@name, '.', /interface/vlan/@tag)",
+ context);
+ ERR_NOMEM(obj == NULL, ncf);
+ ERR_COND_BAIL(xmlStrlen(obj->stringval) == 0, ncf, EINTERNAL);
+ assert(obj->type == XPATH_STRING);
+
+ xmlNodePtr iface;
+ iface = xmlDocGetRootElement(ncf_xml);
+ ERR_COND_BAIL(iface == NULL, ncf, EINTERNAL);
+ xmlSetProp(iface, BAD_CAST "name", BAD_CAST result);
+ }
+
+ result = (char *) xmlStrdup(obj->stringval);
+ fprintf(stderr, "result %s %d", result, ncf->errcode);
+ error:
+ xmlXPathFreeObject(obj);
+ xmlXPathFreeContext(context);
return result;
}
@@ -901,7 +931,7 @@ struct netcf_if *drv_define(struct netcf *ncf, const char *xml_str) {
rng_validate(ncf, ncf_xml);
ERR_BAIL(ncf);
- name = device_name_from_xml(ncf_xml);
+ name = device_name_from_xml(ncf, ncf_xml);
ERR_COND_BAIL(name == NULL, ncf, EINTERNAL);
rm_all_interfaces(ncf, ncf_xml);
--
1.6.2.5
14 years, 7 months
Enslave bond to a bridge
by David Lutterkort
Somehow, enslaving a bond to a bridge has slipped through the cracks. With
this series of patches, that's now possible. As an example, you can define a
bond and enslave it into a bridge with the following XML:
<interface type="bridge" name="br0">
<start mode="onboot"/>
<mtu size="1500"/>
<bridge stp="off">
<interface type="ethernet" name="eth2"/>
<interface type="bond" name="bond0">
<bond mode="active-backup">
<miimon freq="100" updelay="10" carrier="ioctl"/>
<interface type="ethernet" name="eth1"/>
<interface type="ethernet" name="eth0"/>
</bond>
</interface>
</bridge>
</interface>
David
14 years, 7 months
[PATCH] Use an explicit PREFIX from the initscripts
by David Lutterkort
Even though it's not documented, initscripts allows setting the address
prefix with PREFIX.
* data/xml/initscripts-put.xsl: use explicit PREFIX if it is present,
otherwise calculate prefix from NETMASK
---
data/xml/initscripts-put.xsl | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/data/xml/initscripts-put.xsl b/data/xml/initscripts-put.xsl
index 886a265..0f73f50 100644
--- a/data/xml/initscripts-put.xsl
+++ b/data/xml/initscripts-put.xsl
@@ -171,9 +171,14 @@
</xsl:when>
<xsl:when test="$uses_static">
<ip address="{node[@label = 'IPADDR']/@value}">
- <xsl:if test="node[@label = 'NETMASK']">
- <xsl:attribute name="prefix"><xsl:value-of select="ipcalc:prefix(node[@label = 'NETMASK']/@value)"/></xsl:attribute>
- </xsl:if>
+ <xsl:choose>
+ <xsl:when test="node[@label = 'PREFIX']">
+ <xsl:attribute name="prefix"><xsl:value-of select="node[@label = 'PREFIX']/@value"/></xsl:attribute>
+ </xsl:when>
+ <xsl:when test="node[@label = 'NETMASK']">
+ <xsl:attribute name="prefix"><xsl:value-of select="ipcalc:prefix(node[@label = 'NETMASK']/@value)"/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
</ip>
<xsl:if test="node[@label = 'GATEWAY']">
<route gateway="{node[@label = 'GATEWAY']/@value}"/>
--
1.6.2.5
14 years, 7 months