[PATCH 0/2] Modernize gnulib
by Eric Blake
I promised to work on this a few days ago; here's the result.
Unlike libvirt, netcf does NOT automatically play nicely with
incremental changes to the gnulib submodule (I _really_ need
to push libvirt's slick solution upstream into gnulib, for
everyone to use, but that's a project for another day). So
when testing these patches, you MUST re-run ./bootstrap after
each patch.
Eric Blake (2):
maint: update to latest gnulib
maint: use gnulib's configmake instead of hard-coded names
.gnulib | 2 +-
bootstrap | 169 ++++++++++++++++++++++++++++---------------------
bootstrap.conf | 3 +-
configure.ac | 4 +-
gnulib/lib/Makefile.am | 3 +-
src/drv_debian.c | 4 +-
src/drv_redhat.c | 1 +
src/drv_suse.c | 1 +
8 files changed, 107 insertions(+), 80 deletions(-)
--
1.8.5.3
10 years, 2 months
[PATCH] add enable_autotools to specfile
by Laine Stump
Another convenience borrowed from libvirt's build files. If a
downstream distro backports a patch that modifies configure.ac or one
of the Makefile.am's, the files in the source tarball will be out of
date and will need to be regerated during the build. This can now be
easily done by simply setting enable_autotools to 1 in the specfile.
---
netcf.spec.in | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/netcf.spec.in b/netcf.spec.in
index bfd4d86..5979bd4 100644
--- a/netcf.spec.in
+++ b/netcf.spec.in
@@ -9,6 +9,11 @@ URL: https://fedorahosted.org/netcf/
Source0: https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+# Default to skipping autoreconf. Distros can change just this one
+# line (or provide a command-line override) if they backport any
+# patches that touch configure.ac or Makefile.am.
+%{!?enable_autotools:%define enable_autotools 0}
+
# Fedora 20 / RHEL-7 are where netcf first uses systemd. Although earlier
# Fedora has systemd, netcf still used sysvinit there.
%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
@@ -24,6 +29,13 @@ Requires(post): systemd-sysv
Requires(preun): systemd-units
Requires(postun): systemd-units
%endif
+%if 0%{?enable_autotools}
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: gettext-devel
+BuildRequires: libtool
+BuildRequires: /usr/bin/pod2man
+%endif
BuildRequires: readline-devel augeas-devel >= 0.5.2
BuildRequires: libxml2-devel libxslt-devel
@@ -83,6 +95,10 @@ The libraries for %{name}.
%endif
+%if 0%{?enable_autotools}
+ autoreconf -if
+%endif
+
%configure --disable-static \
%{?_with_libnl1} \
%{sysinit}
--
1.8.4.2
10 years, 2 months
[PATCH 2/2] support systemd-based netcf-transaction
by Laine Stump
https://bugzilla.redhat.com/show_bug.cgi?id=1044681
Details are in the description of PATCH 2/2 (1/2 is just a small tweak
to the specfile to deal with newer tools)
Laine Stump (2):
Fix bogus dates in specfile
support systemd-based netcf-transaction
.gitignore | 2 +
configure.ac | 56 ++++++++++++--
netcf.spec.in | 64 ++++++++++++++--
src/Makefile.am | 86 ++++++++++++++++------
src/netcf-transaction.init.in | 31 ++++++++
src/netcf-transaction.service.in | 15 ++++
...transaction.init.sh => netcf-transaction.sh.in} | 34 +++++----
7 files changed, 239 insertions(+), 49 deletions(-)
create mode 100644 src/netcf-transaction.init.in
create mode 100644 src/netcf-transaction.service.in
rename src/{netcf-transaction.init.sh => netcf-transaction.sh.in} (88%)
mode change 100755 => 100644
--
1.8.4.2
10 years, 2 months
[PATCH] maint: ignore automake test logs
by Eric Blake
On Fedora 20, with automake 1.13.4, running 'make check' leaves
behind .trs log files in tests directory.
* .gitignore: List *.trs files.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index c760b95..7f4e3ce 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@
*.pc
*.pdf
*.spec
+*.trs
*~
.deps/
.libs/
--
1.8.4.2
10 years, 2 months
[PATCH] redhat-put.xsl: transform STP value to "on/off"
by Martin Wilck
Some tools (e.g. NetworkManager) use "yes"/"no" in config files
rather than "on/off". netcf needs to transform this in order to conform
with the schema.
---
data/xml/redhat-put.xsl | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/data/xml/redhat-put.xsl b/data/xml/redhat-put.xsl
index 267d9cd..88e6d73 100644
--- a/data/xml/redhat-put.xsl
+++ b/data/xml/redhat-put.xsl
@@ -77,7 +77,17 @@
<xsl:call-template name="interface-addressing"/>
<bridge>
<xsl:if test="node[@label = 'STP']">
- <xsl:attribute name="stp"><xsl:value-of select="node[@label = 'STP']/@value"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="node[@label = 'STP']/@value = 'yes'">
+ <xsl:attribute name="stp">on</xsl:attribute>
+ </xsl:when>
+ <xsl:when test="node[@label = 'STP']/@value = 'no'">
+ <xsl:attribute name="stp">off</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="stp"><xsl:value-of select="node[@label = 'STP']/@value"/></xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:if>
<xsl:if test="node[@label = 'DELAY']">
<xsl:attribute name="delay"><xsl:value-of select="node[@label = 'DELAY']/@value"/></xsl:attribute>
--
1.8.3.1
10 years, 2 months
[PATCH] eliminate use of uninitialized data when getting mac address
by Laine Stump
https://bugzilla.redhat.com/show_bug.cgi?id=1046594
If the call to get_augeas() at the top of aug_get_mac() failed, we
would goto error and FREE(path), which would not have been
initialized. And if by some magic of fate we happened to get past
that, we would return garbage for the return code, since r was also
not initialized. This patch initializes both path and r to fix the
crash documented in Bug 1046594.
Although it doesn't directly impact the referenced bug, a quick audit
of other functions in the same file showed that defnode() had the same
problem with uninitialized "r". Beyond that, I also defensively
initialized the pointer to mac address to NULL both in aug_get_mac()
as well as two of its callers, to make future audits of the code
easier, and to shut up both valgrind and whatever static analyzers
might be run on the code.
---
src/drv_redhat.c | 4 ++--
src/drv_suse.c | 4 ++--
src/dutil_linux.c | 9 +++++----
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/drv_redhat.c b/src/drv_redhat.c
index b5b8694..e9d25cb 100644
--- a/src/drv_redhat.c
+++ b/src/drv_redhat.c
@@ -1,7 +1,7 @@
/*
* drv_redhat.c: the Red Hat distro family backend for netcf
*
- * Copyright (C) 2009-2013 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
@@ -989,7 +989,7 @@ int drv_lookup_by_mac_string(struct netcf *ncf, const char *mac,
const char *drv_mac_string(struct netcf_if *nif) {
struct netcf *ncf = nif->ncf;
- const char *mac;
+ const char *mac = NULL;
char *path = NULL;
int r;
diff --git a/src/drv_suse.c b/src/drv_suse.c
index e59d7d3..e346c27 100644
--- a/src/drv_suse.c
+++ b/src/drv_suse.c
@@ -2,7 +2,7 @@
* drv_suse.c: the suse backend for netcf
*
* Copyright (C) 2010 Novell Inc.
- * Copyright (C) 2009-2013 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
@@ -1132,7 +1132,7 @@ int drv_lookup_by_mac_string(struct netcf *ncf, const char *mac,
const char *drv_mac_string(struct netcf_if *nif) {
struct netcf *ncf = nif->ncf;
- const char *mac;
+ const char *mac = NULL;
char *path = NULL;
int r;
diff --git a/src/dutil_linux.c b/src/dutil_linux.c
index 271c515..7af741e 100644
--- a/src/dutil_linux.c
+++ b/src/dutil_linux.c
@@ -1,7 +1,7 @@
/*
* dutil_linux.c: Linux utility functions for driver backends.
*
- * Copyright (C) 2009-2012 Red Hat Inc.
+ * Copyright (C) 2009-2012, 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
@@ -221,7 +221,7 @@ int defnode(struct netcf *ncf, const char *name, const char *value,
struct augeas *aug = get_augeas(ncf);
va_list ap;
char *expr = NULL;
- int r, created;
+ int r = -1, created;
ERR_BAIL(ncf);
@@ -370,10 +370,11 @@ int aug_match_mac(struct netcf *ncf, const char *mac, char ***matches) {
/* Get the MAC address of the interface INTF */
int aug_get_mac(struct netcf *ncf, const char *intf, const char **mac) {
- int r;
- char *path;
+ int r = -1;
+ char *path = NULL;
struct augeas *aug = get_augeas(ncf);
+ *mac = NULL;
ERR_BAIL(ncf);
r = xasprintf(&path, "/files/sys/class/net/%s/address/content", intf);
--
1.8.4.2
10 years, 2 months