diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eea3882 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/netcf-0.2.8.tar.gz diff --git a/.netcf.metadata b/.netcf.metadata new file mode 100644 index 0000000..4bdc534 --- /dev/null +++ b/.netcf.metadata @@ -0,0 +1 @@ +98f0780c4bee429fbbfb3ced1629944cc5c6f2b6 SOURCES/netcf-0.2.8.tar.gz diff --git a/SOURCES/netcf-Fix-memory-leak-in-aug_match_mac.patch b/SOURCES/netcf-Fix-memory-leak-in-aug_match_mac.patch new file mode 100644 index 0000000..c015518 --- /dev/null +++ b/SOURCES/netcf-Fix-memory-leak-in-aug_match_mac.patch @@ -0,0 +1,32 @@ +From 26866552d648bded38e9c97112f97c5ab114887c Mon Sep 17 00:00:00 2001 +From: Laine Stump +Date: Mon, 17 Sep 2018 10:00:50 -0400 +Subject: [PATCH 1/7] Fix memory leak in aug_match_mac() + +mac_lower has memory allocated to it, but it was only freed in case of +an error. + +Signed-off-by: Laine Stump +(cherry picked from commit 478da0f8f31252be2e9e96430a8e56d9b28642ed) + +Resolves: https://bugzilla.redhat.com/1602628 +Signed-off-by: Laine Stump +--- + src/dutil_linux.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/dutil_linux.c b/src/dutil_linux.c +index 022eed0..3a75f16 100644 +--- a/src/dutil_linux.c ++++ b/src/dutil_linux.c +@@ -424,6 +424,7 @@ int aug_match_mac(struct netcf *ncf, const char *mac, char ***matches) { + (*matches)[i] = n; + } + ++ FREE(mac_lower); + return nmatches; + + error: +-- +2.18.1 + diff --git a/SOURCES/netcf-Make-the-empty-body-of-for-loops-more-obvious.patch b/SOURCES/netcf-Make-the-empty-body-of-for-loops-more-obvious.patch new file mode 100644 index 0000000..f0b1c7a --- /dev/null +++ b/SOURCES/netcf-Make-the-empty-body-of-for-loops-more-obvious.patch @@ -0,0 +1,43 @@ +From 531f40824a76754962285f1996894e9e6db2f410 Mon Sep 17 00:00:00 2001 +From: Laine Stump +Date: Mon, 17 Sep 2018 10:05:15 -0400 +Subject: [PATCH 3/7] Make the empty body of for loops more obvious + +parseline() was skipping over non-option commandline args with 3 for +loops that had empty bodies signified by semicolons at the end of the +for() line (twice) or with a body comprised completely of a nested +for() that had an empty body. Coverity didn't like this. Put braces +around all three loop bodies to make the intent more clear. + +Signed-off-by: Laine Stump +(cherry picked from commit ef9971b64d8224d1626177978227c7009812f275) + +Resolves: https://bugzilla.redhat.com/1602628 +Signed-off-by: Laine Stump +--- + src/ncftool.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/ncftool.c b/src/ncftool.c +index 7a1db5b..7baf06a 100644 +--- a/src/ncftool.c ++++ b/src/ncftool.c +@@ -653,9 +653,12 @@ static int parseline(struct command *cmd, char *line) { + } + for (def = cmd->def->opts; + def->name != NULL && !opt_def_is_arg(def); +- def++); +- for (int i=0; i < curarg; i++) +- for (; def->name != NULL && !opt_def_is_arg(def); def++); ++ def++) { ++ } ++ for (int i=0; i < curarg; i++) { ++ for (; def->name != NULL && !opt_def_is_arg(def); def++) { ++ } ++ } + struct command_opt *opt = + make_command_opt(cmd, def); + opt->string = tok; +-- +2.18.1 + diff --git a/SOURCES/netcf-Properly-classify-bond-devices-with-no-slaves.patch b/SOURCES/netcf-Properly-classify-bond-devices-with-no-slaves.patch new file mode 100644 index 0000000..35f057e --- /dev/null +++ b/SOURCES/netcf-Properly-classify-bond-devices-with-no-slaves.patch @@ -0,0 +1,35 @@ +From f3ec5157c7fc97e31c7b48e3a56da268de7e4216 Mon Sep 17 00:00:00 2001 +From: Laine Stump +Date: Tue, 13 Oct 2015 14:42:35 -0400 +Subject: [PATCH 2/2] Properly classify bond devices with no slaves + +Although initscripts only considers an interface to be a bond if it +has slaves, there are times when setting up a bond, or testing, when a +bond may not have any slaves (yet) but does have a BONDING_OPTS +attribute. Previously in those situations netcf would identify the +interface as a plain ethernet. This patch makes the check more +inclusive - now any interface with slaves *or* with a BONDING_OPTS +attribute is considered to be a bond. + +This patch was inspired by an earlier patch sent by Lubomir Rintel +which looked for BONDING_OPTS *instead of* looking for slaves. +--- + data/xml/redhat-put.xsl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/data/xml/redhat-put.xsl b/data/xml/redhat-put.xsl +index ed56c66..89145e5 100644 +--- a/data/xml/redhat-put.xsl ++++ b/data/xml/redhat-put.xsl +@@ -135,7 +135,7 @@ + + + ++ match="tree[count(node[@label = 'BONDING_OPTS']) or (node[@label = 'DEVICE'][@value = //tree/node[@label = 'MASTER']/@value])][count(node[@label = 'BRIDGE']) = 0]"> + + + +-- +2.4.3 + diff --git a/SOURCES/netcf-call-aug_load-at-most-once-per-second.patch b/SOURCES/netcf-call-aug_load-at-most-once-per-second.patch new file mode 100644 index 0000000..ba09b0c --- /dev/null +++ b/SOURCES/netcf-call-aug_load-at-most-once-per-second.patch @@ -0,0 +1,85 @@ +From 9b5f4eb57af28a604cd7ac8b2c1be9e49f0b517d Mon Sep 17 00:00:00 2001 +From: Laine Stump +Date: Mon, 28 Sep 2015 17:11:11 -0400 +Subject: [PATCH] call aug_load() at most once per second + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1268384 + +Previously, netcf would call aug_load() at the start of each public +API call, and rely on augeas quickly determining if the files needed +to be reread based on checking the mtime of all files. With a large +number of files (i.e. several hundred ifcfg files) just checking the +mtime of all files ends up taking quite a long time; enough to turn a +simple "virsh iface-list" of 300 bridges + 300 vlans into a 22 second +ordeal. + +With this patch applied, netcf will only call aug_load() at most once +every second, resulting in runtime for virsh iface-list going down to +< 1 second. + +The trade-off is that the results of a netcf API call could be up to 1 +second out of date (but only due to changes in the config external to +netcf). Since ifcfg files change very infrequently, this is likely +acceptable. +--- + src/dutil_linux.c | 8 +++++++- + src/dutil_linux.h | 1 + + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/dutil_linux.c b/src/dutil_linux.c +index 0850593..24f4d95 100644 +--- a/src/dutil_linux.c ++++ b/src/dutil_linux.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -151,6 +152,7 @@ int remove_augeas_xfm_table(struct netcf *ncf, + */ + augeas *get_augeas(struct netcf *ncf) { + int r; ++ time_t current_time; + + if (ncf->driver->augeas == NULL) { + augeas *aug; +@@ -186,9 +188,12 @@ augeas *get_augeas(struct netcf *ncf) { + } + ncf->driver->copy_augeas_xfm = 0; + ncf->driver->load_augeas = 1; ++ ncf->driver->load_augeas_time = 0; + } + +- if (ncf->driver->load_augeas) { ++ current_time = time(NULL); ++ if (ncf->driver->load_augeas && ++ ncf->driver->load_augeas_time != current_time) { + augeas *aug = ncf->driver->augeas; + + r = aug_load(aug); +@@ -207,6 +212,7 @@ augeas *get_augeas(struct netcf *ncf) { + } + ERR_THROW(r > 0, ncf, EOTHER, "errors in loading some config files"); + ncf->driver->load_augeas = 0; ++ ncf->driver->load_augeas_time = current_time; + } + return ncf->driver->augeas; + error: +diff --git a/src/dutil_linux.h b/src/dutil_linux.h +index a06a15c..75ac631 100644 +--- a/src/dutil_linux.h ++++ b/src/dutil_linux.h +@@ -41,6 +41,7 @@ struct driver { + struct nl_sock *nl_sock; + struct nl_cache *link_cache; + struct nl_cache *addr_cache; ++ time_t load_augeas_time; + unsigned int load_augeas : 1; + unsigned int copy_augeas_xfm : 1; + unsigned int augeas_xfm_num_tables; +-- +2.4.3 + diff --git a/SOURCES/netcf-linux-include-bond-element-for-bonds-with-no-slaves.patch b/SOURCES/netcf-linux-include-bond-element-for-bonds-with-no-slaves.patch new file mode 100644 index 0000000..1508342 --- /dev/null +++ b/SOURCES/netcf-linux-include-bond-element-for-bonds-with-no-slaves.patch @@ -0,0 +1,56 @@ +From cfe1eb87f7f152ab5d6456ef8ecd7aab38d376fa Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Wed, 27 May 2015 19:30:25 +0200 +Subject: [PATCH 1/2] linux: include element for bonds with no slaves + +The missing element makes libvirt sad: + + $ ncftool dumpxml --live nm-bond + + + + + + + + + $ virsh iface-dumpxml nm-bond + error: XML error: bond interface misses the bond element + +This is analogous what was done in d32a464c (Always add element to +bridge if, even if no physdev is attached) for bridges. +--- + src/dutil_linux.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/dutil_linux.c b/src/dutil_linux.c +index 24f4d95..022eed0 100644 +--- a/src/dutil_linux.c ++++ b/src/dutil_linux.c +@@ -1055,9 +1055,6 @@ static void add_bond_info_cb(struct nl_object *obj, + || rtnl_link_get_master(iflink) != cb_data->master_ifindex) + return; + +- cb_data->bond = xml_node(cb_data->doc, cb_data->root, "bond"); +- ERR_NOMEM(cb_data->bond == NULL, ncf); +- + /* XXX - if we learn where to get bridge "mode" property, set it here */ + + /* XXX - need to add node like one of these: +@@ -1089,7 +1086,13 @@ static void add_bond_info(struct netcf *ncf, + if (ifindex == RTNL_LINK_NOT_FOUND) + return; + ++ cb_data.bond = xml_node(doc, root, "bond"); ++ ERR_NOMEM(cb_data.bond == NULL, ncf); ++ + nl_cache_foreach(ncf->driver->link_cache, add_bond_info_cb, &cb_data); ++ ++error: ++ return; + } + + +-- +2.4.3 + diff --git a/SOURCES/netcf-optimize-aug_match-query-for-all-ifcfg-files-related.patch b/SOURCES/netcf-optimize-aug_match-query-for-all-ifcfg-files-related.patch new file mode 100644 index 0000000..b69938e --- /dev/null +++ b/SOURCES/netcf-optimize-aug_match-query-for-all-ifcfg-files-related.patch @@ -0,0 +1,114 @@ +From 396e4e0698d9fb542f2eb8b32790a069e1c0df61 Mon Sep 17 00:00:00 2001 +From: Laine Stump +Date: Wed, 7 Oct 2015 13:49:45 -0400 +Subject: [PATCH] optimize aug_match() query for all ifcfg files related to an + interface + +This resolves: + + https://bugzilla.redhat.com/show_bug.cgi?id=1271341 (Fedora) + https://bugzilla.redhat.com/show_bug.cgi?id=1269613 (RHEL7) + +The original augeas search term used by netcf to find, for example, all the +ifcfg files associated with device "br1" was: + + "/files/etc/sysconfig/network-scripts/*[ " + "DEVICE = 'br1' or BRIDGE = 'br1' or MASTER = 'br1' or MASTER = " + "../*[BRIDGE = 'br1']/DEVICE ]/DEVICE" + +This is *extremely* inefficient - on a test host with 514 host +bridges, each with an attached vlan interface, a dumpxml of all +toplevel interfaces took 6m40s (*after* installing an augeas that +included augeas upstream commits a659f09a, 41e989ca, and 23d5e480 +which were all pushed after the augeas-1.4.0 release). + +In these two messages: + + https://www.redhat.com/archives/augeas-devel/2015-October/msg00003.html + https://www.redhat.com/archives/augeas-devel/2015-October/msg00004.html + +David Lutterkort suggested changing the search term to: + + "(/files/etc/sysconfig/network-scripts/*[(DEVICE|BRIDGE|MASTER) = 'br1']" + "|/files/etc/sysconfig/network-scripts/*[MASTER]" + "[MASTER = ../*[BRIDGE = 'br1']/DEVICE ])/DEVICE + +That's what this patch does. Testing shows that it is functionally +equivalent, and reduces the dumpxml time in the previously described +test from 6m40s down to 17 seconds. +--- + src/drv_redhat.c | 44 ++++++++++++++++++++++++++++++++++---------- + 1 file changed, 34 insertions(+), 10 deletions(-) + +diff --git a/src/drv_redhat.c b/src/drv_redhat.c +index 4935f98..092ef5c 100644 +--- a/src/drv_redhat.c ++++ b/src/drv_redhat.c +@@ -88,6 +88,38 @@ static const struct augeas_xfm_table augeas_xfm_common = + { .size = ARRAY_CARDINALITY(augeas_xfm_common_pv), + .pv = augeas_xfm_common_pv }; + ++/* aug_all_related_ifcfgs() - return the count of (and optionally a list ++ * of, if matches != NULL) the paths for all ifcfg files that are ++ * related to the interface "name". ++ */ ++static ++int aug_all_related_ifcfgs(struct netcf *ncf, char ***matches, const char *name) { ++ int nmatches; ++ ++ /* this includes the ifcfg files for: ++ * ++ * 1) the named interface itself (DEVICE=$name) ++ * ++ * 2) any interface naming $name as a bridge it is attached to ++ * (BRIDGE=$name) ++ * ++ * 3) any interface naming $name as the master of a bond it is ++ * enslaved to (MASTER=$name) ++ * ++ * 4) any interface with a MASTER, where the device named as ++ * MASTER contains a BRIDGE=$name *and* DEVICE=$itself (thus ++ * catching ethernet devices that are enslaved to a bond that ++ * is attached to a bridge). ++ */ ++ nmatches = aug_fmt_match(ncf, matches, ++ "(%s[(DEVICE|BRIDGE|MASTER) = '%s']" ++ "|%s[MASTER][MASTER = ../*[BRIDGE = '%s']/DEVICE " ++ "])/DEVICE", ++ ifcfg_path, name, ifcfg_path, name); ++ return nmatches; ++ ++} ++ + /* Entries in a ifcfg file that tell us that the interface + * is not a toplevel interface + */ +@@ -108,12 +140,7 @@ static int is_slave(struct netcf *ncf, const char *intf) { + static bool has_ifcfg_file(struct netcf *ncf, const char *name) { + int nmatches; + +- nmatches = aug_fmt_match(ncf, NULL, +- "%s[ DEVICE = '%s'" +- " or BRIDGE = '%s'" +- " or MASTER = '%s'" +- " or MASTER = ../*[BRIDGE = '%s']/DEVICE ]/DEVICE", +- ifcfg_path, name, name, name, name); ++ nmatches = aug_all_related_ifcfgs(ncf, NULL, name); + return nmatches > 0; + } + +@@ -588,10 +615,7 @@ static xmlDocPtr aug_get_xml_for_nif(struct netcf_if *nif) { + int ndevs = 0, nint = 0; + + ncf = nif->ncf; +- ndevs = aug_fmt_match(ncf, &devs, +- "%s[ DEVICE = '%s' or BRIDGE = '%s' or MASTER = '%s'" +- " or MASTER = ../*[BRIDGE = '%s']/DEVICE ]/DEVICE", +- ifcfg_path, nif->name, nif->name, nif->name, nif->name); ++ ndevs = aug_all_related_ifcfgs(ncf, &devs, nif->name); + ERR_BAIL(ncf); + + nint = uniq_ifcfg_paths(ncf, ndevs, devs, &intf); +-- +2.4.3 + diff --git a/SOURCES/netcf-remove-unused-variable-in-aug_match_mac.patch b/SOURCES/netcf-remove-unused-variable-in-aug_match_mac.patch new file mode 100644 index 0000000..f11f0f4 --- /dev/null +++ b/SOURCES/netcf-remove-unused-variable-in-aug_match_mac.patch @@ -0,0 +1,41 @@ +From 5a8c5768779a220d29eaeb31ca433cd8913ed876 Mon Sep 17 00:00:00 2001 +From: Laine Stump +Date: Mon, 17 Sep 2018 10:01:22 -0400 +Subject: [PATCH 2/7] remove unused variable in aug_match_mac() + +Apparently this wasn't caught by the compiler because it was +initialized, and that counted as a "use". + +Signed-off-by: Laine Stump +(cherry picked from commit e81812e770d4e837015d92cd7d570c3df81bda9f) + +Resolves: https://bugzilla.redhat.com/1602628 +Signed-off-by: Laine Stump +--- + src/dutil_linux.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/dutil_linux.c b/src/dutil_linux.c +index 3a75f16..ab1dd6c 100644 +--- a/src/dutil_linux.c ++++ b/src/dutil_linux.c +@@ -400,7 +400,7 @@ void free_matches(int nint, char ***intf) { + /* Returns a list of all interfaces with MAC address MAC */ + int aug_match_mac(struct netcf *ncf, const char *mac, char ***matches) { + int nmatches; +- char *path = NULL, *mac_lower = NULL; ++ char *mac_lower = NULL; + + mac_lower = strdup(mac); + ERR_NOMEM(mac_lower == NULL, ncf); +@@ -429,7 +429,6 @@ int aug_match_mac(struct netcf *ncf, const char *mac, char ***matches) { + + error: + FREE(mac_lower); +- FREE(path); + return -1; + } + +-- +2.18.1 + diff --git a/SOURCES/netcf-slience-a-false-Coverity-report.patch b/SOURCES/netcf-slience-a-false-Coverity-report.patch new file mode 100644 index 0000000..1cee1a3 --- /dev/null +++ b/SOURCES/netcf-slience-a-false-Coverity-report.patch @@ -0,0 +1,39 @@ +From 2305151c1ebae09566302fd8097ef6757a02fbcf Mon Sep 17 00:00:00 2001 +From: Laine Stump +Date: Tue, 18 Sep 2018 12:36:45 -0400 +Subject: [PATCH 4/7] slience a false Coverity report + +Coverity complains that + + unref(nif, netcf_if); + +sets nif to NULL without free'ing the memory it points to. But unref() +is a macro (defined in src/ref.h) that uses a refcount in the object +to automatically free it when there are no more pointers to it. + +Since the code is correct, we add a comment that silences the Coverity warning + +Signed-off-by: Laine Stump +(cherry picked from commit 3c4ea18fe7e1279e5c7d033978eb45d86d759de3) + +Resolves: https://bugzilla.redhat.com/1602628 +Signed-off-by: Laine Stump +--- + src/drv_redhat.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/drv_redhat.c b/src/drv_redhat.c +index 092ef5c..c073af8 100644 +--- a/src/drv_redhat.c ++++ b/src/drv_redhat.c +@@ -504,6 +504,7 @@ struct netcf_if *drv_lookup_by_name(struct netcf *ncf, const char *name) { + goto done; + + error: ++ /* coverity[overwrite_var] */ + unref(nif, netcf_if); + FREE(name_dup); + done: +-- +2.18.1 + diff --git a/SPECS/netcf.spec b/SPECS/netcf.spec new file mode 100644 index 0000000..febc2e9 --- /dev/null +++ b/SPECS/netcf.spec @@ -0,0 +1,413 @@ +Name: netcf +Version: 0.2.8 +Release: 12%{?dist}%{?extra_release} +Summary: Cross-platform network configuration library + +Group: System Environment/Libraries +License: LGPLv2+ +URL: https://fedorahosted.org/netcf/ +Source0: https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz + +# Patches +# One patch per line, in this format: +# Patch001: file1.patch +# Patch002: file2.patch +# ... +# +# The patches will automatically be put into the build source tree +# during the %prep stage (using git, which is now required for an rpm +# build) +# +Patch001: netcf-call-aug_load-at-most-once-per-second.patch +Patch002: netcf-optimize-aug_match-query-for-all-ifcfg-files-related.patch +Patch003: netcf-linux-include-bond-element-for-bonds-with-no-slaves.patch +Patch004: netcf-Properly-classify-bond-devices-with-no-slaves.patch +Patch005: netcf-Fix-memory-leak-in-aug_match_mac.patch +Patch006: netcf-remove-unused-variable-in-aug_match_mac.patch +Patch007: netcf-Make-the-empty-body-of-for-loops-more-obvious.patch +Patch008: netcf-slience-a-false-Coverity-report.patch + +# 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} + +# git is used to build a source tree with patches applied (see the +# %prep section) +BuildRequires: git + +# 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 + %define with_systemd 1 +%else + %define with_systemd 0 +%endif + +%if %{with_systemd} +BuildRequires: systemd +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%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 + +# force the --with-libnl1 option on F17/RHEL6 and earlier +%if (0%{?fedora} && 0%{?fedora} < 18) || (0%{?rhel} && 0%{?rhel} < 7) +%define with_libnl1 1 +%else +%define with_libnl1 0 +%endif + +# require libnl3 on F18/RHEL7 and later +%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7 +BuildRequires: libnl3-devel +%else +BuildRequires: libnl-devel +%endif + +Requires: %{name}-libs = %{version}-%{release} + +Provides: bundled(gnulib) + +%description +Netcf is a library used to modify the network configuration of a +system. Network configurations are expressed in a platform-independent +XML format, which netcf translates into changes to the system's +'native' network configuration files. + +%package devel +Summary: Development files for %{name} +Group: Development/Libraries +Requires: %{name}-libs = %{version}-%{release} +Requires: pkgconfig + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + +%package libs +Summary: Libraries for %{name} +Group: System Environment/Libraries + +%description libs +The libraries for %{name}. + +%prep +%setup -q + +# Patches have to be stored in a temporary file because RPM has +# a limit on the length of the result of any macro expansion; +# if the string is longer, it's silently cropped +%{lua: + tmp = os.tmpname(); + f = io.open(tmp, "w+"); + count = 0; + for i, p in ipairs(patches) do + f:write(p.."\n"); + count = count + 1; + end; + f:close(); + print("PATCHCOUNT="..count.."\n") + print("PATCHLIST="..tmp.."\n") +} + +git init -q +git config user.name rpm-build +git config user.email rpm-build +git config gc.auto 0 +git add . +git commit -q -a --author 'rpm-build ' \ + -m '%{name}-%{version} base' + +COUNT=$(grep '\.patch$' $PATCHLIST | wc -l) +if [ $COUNT -ne $PATCHCOUNT ]; then + echo "Found $COUNT patches in $PATCHLIST, expected $PATCHCOUNT" + exit 1 +fi +if [ $COUNT -gt 0 ]; then + xargs git am <$PATCHLIST || exit 1 +fi +echo "Applied $COUNT patches" +rm -f $PATCHLIST + + +%build +%if %{with_libnl1} +%define _with_libnl1 --with-libnl1 +%endif +%if %{with_systemd} + %define sysinit --with-sysinit=systemd +%else + %define sysinit --with-sysinit=initscripts +%endif + + +%if 0%{?enable_autotools} + autoreconf -if +%endif + +%configure --disable-static \ + %{?_with_libnl1} \ + %{sysinit} +make %{?_smp_mflags} + +%install +make install DESTDIR=$RPM_BUILD_ROOT SYSTEMD_UNIT_DIR=%{_unitdir} \ + INSTALL="%{__install} -p" +find $RPM_BUILD_ROOT -name '*.la' -delete + +%preun libs + +%if %{with_systemd} + %systemd_preun netcf-transaction.service +%else +if [ $1 = 0 ]; then + /sbin/chkconfig --del netcf-transaction +fi +%endif + +%post libs + +/sbin/ldconfig +%if %{with_systemd} + %systemd_post netcf-transaction.service + /bin/systemctl --no-reload enable netcf-transaction.service >/dev/null 2>&1 || : +%else +/sbin/chkconfig --add netcf-transaction +%endif + +%postun libs + +/sbin/ldconfig +%if %{with_systemd} + %systemd_postun netcf-transaction.service +%endif + +%files +%{_bindir}/ncftool +%{_mandir}/man1/ncftool.1* + +%files libs +%{_datadir}/netcf +%{_libdir}/*.so.* +%if %{with_systemd} +%{_unitdir}/netcf-transaction.service +%else +%{_sysconfdir}/rc.d/init.d/netcf-transaction +%endif +%attr(0755, root, root) %{_libexecdir}/netcf-transaction.sh +%doc AUTHORS COPYING NEWS + +%files devel +%doc +%{_includedir}/* +%{_libdir}/*.so +%{_libdir}/pkgconfig/netcf.pc + +%changelog +* Fri Aug 09 2019 Laine Stump - 0.2.8-12 +- Resolves: rhbz#1602628 + +* Fri Jun 28 2019 Danilo de Paula - 0.2.8-11 +- Rebuild all virt packages to fix RHEL's upgrade path +- Resolves: rhbz#1695587 + (Ensure modular RPM upgrade path) + +* Mon Jul 30 2018 Eric Garver - 0.2.8-10 +- Remove artificial dependency on bridge-utils. rhbz #1605333 + +* Thu Feb 08 2018 Fedora Release Engineering - 0.2.8-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Aug 03 2017 Fedora Release Engineering - 0.2.8-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 0.2.8-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - 0.2.8-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Thu Jan 12 2017 Igor Gnatenko - 0.2.8-5 +- Rebuild for readline 7.x + +* Thu Feb 04 2016 Fedora Release Engineering - 0.2.8-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Oct 14 2015 Laine Stump + - Improve performance with large number of interfaces + (Bug 1268384, Bug 1271341) + - recognize bond devices with no slaves + +* Wed Jun 17 2015 Fedora Release Engineering - 0.2.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Wed Apr 08 2015 Laine Stump - 0.2.8-1 + - rebase to netcf-0.2.8 + - Fix build on systems with newer libnl3 that doesn't + #include + +* Mon Apr 06 2015 Laine Stump - 0.2.7-1 + - rebase to netcf-0.2.7 + - resolve CVE-2014-8119 + - support multiple IPv4 addresses in interface config (redhat driver) + - allow static IPv4 config simultaneous with DHCPv4 (redhat driver) + - recognize IPADDR0/NETMASK0/PREFIX0 + - remove extra quotes from IPV6ADDR_SECONDARIES (redhat+suse drivers) + - miscellaneous systemd service fixes + - use git to apply patches in rpm specfile + - revert the 0.2.6-2 specfile patch mentioned below (now fixed properly) + +* Thu Jan 8 2015 Zbigniew Jędrzejewski-Szmek - 0.2.6-2 +- do not write to the console (#1135744) + +* Fri Aug 22 2014 Laine Stump - 0.2.6-1 + - allow interleaved elements in interface XML schema + - allow element in vlan and bond interfaces + +* Wed Aug 20 2014 Laine Stump - 0.2.5-1 + - report link state/speed in interface status + - change DHCPv6 to DHCPV6C in ifcfg files + - max vlan id is 4095, not 4096 + +* Sun Aug 17 2014 Fedora Release Engineering - 0.2.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 0.2.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Wed May 14 2014 Laine Stump - 0.2.4-1 + - wait for IFF_UP and IFF_RUNNING after calling ifup + - don't require IFF_RUNNING for bridge devices + - avoid memory leak in debian when listing interfaces + - avoid use of uninitialized data when getting mac address + (fixes https://bugzilla.redhat.com/show_bug.cgi?id=1046594 ) + - limit interface names to IFNAMSIZ-1 characters in length + - support systemd for netcf-transaction + +* Sat May 03 2014 Cole Robinson - 0.2.3-7 +- Fix reading bridge stp value (bz #1031053) + +* Thu Apr 24 2014 Tomáš Mráz - 0.2.3-6 +- Rebuild for new libgcrypt + +* Sat Aug 03 2013 Fedora Release Engineering - 0.2.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 0.2.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sun Jan 20 2013 Richard W.M. Jones - 0.2.3-3 +- Rebuild for libnl soname breakage (RHBZ#901569). + +* Fri Jan 18 2013 Daniel P. Berrange - 0.2.3-2 +- Rebuild for libnl3 soname change + +* Fri Dec 21 2012 Laine Stump - 0.2.3-1 +- Rebase to netcf-0.2.3 +- eliminate calls to nl_cache_mngt_provide(), to avoid + non-threadsafe code in libnl (and because it isn't needed + anyway) (This non-threadsafe code could lead to a segfault) +- portability fixes for FreeBSD +- fix bug when a config file has two config parameters with + identical names +- add HACKING document +- always bail immediately if get_augeas fails (doing otherwise + could lead to a segfault) + +* Sat Aug 25 2012 Laine Stump - 0.2.2-1 +- Rebase to netcf-0.2.2 +- specfile: require libnl3-devel for rpm builds on Fedora 18+ and + RHEL7+. Likewise, force libnl1 for F17- and RHEL6.x-, even if + libnl3-devel is installed. + +* Fri Aug 10 2012 Laine Stump - 0.2.1-1 +- Rebase to netcf-0.2.1 +- update gnulib to fix broken build on systems with nwer glibc (which no + longer provides gets()). +- add ncftool manpage +- interfaces are only "active" if both UP and RUNNING. +- add "bundled(gnulib)" to specfile to indicate that we use a local + copy of gnulib sources (used by Fedora/RHEL when determining the scope + of security bugs). +- Fix ipcalc_netmask, which was trimming off the last digit in + character representations of full-length netmasks (all 4 octets + having 3 chars each) +- other minor bugfixes + +* Fri Jul 20 2012 Fedora Release Engineering - 0.1.9-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri Jan 13 2012 Fedora Release Engineering - 0.1.9-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Jul 26 2011 Laine Stump - 0.1.9-1 +- Rebase to netcf-0.1.9 +- always add element to bridge, even if there is no physdev present +- don't log error if interface isn't found in kernel during status report +- allow building with C++ +- update gnulib + +* Tue Jun 21 2011 Laine Stump - 0.1.8-1 +- Rebase to netcf-0.1.8 +- new transactional change APIs: ncf_change_(begin|commit|rollback) +- add stdout/stderr to error text when an external program fails +- make error reporting of failed execs more exact/correct +- Remove unnecessary "Requires" of libxml2 and augeas from pkgconfig file + to pulling in extra packages when building an application that uses netcf. + +* Tue Feb 08 2011 Fedora Release Engineering - 0.1.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Sep 27 2010 Laine Stump - 0.1.7-1 +- New version + +* Tue Apr 20 2010 Laine Stump - 0.1.6-1 +- New version +- Remove patch n0001-src-dutil.c-add-missing-includes-for-stat.patch, + included upstream + +* Mon Feb 15 2010 David Lutterkort - 0.1.5-2 +- patch1: add missing includes for stat in dutil.c + +* Mon Nov 30 2009 David Lutterkort - 0.1.5-1 +- New version + +* Thu Nov 5 2009 David Lutterkort - 0.1.4-1 +- New version + +* Tue Oct 27 2009 David Lutterkort - 0.1.3-1 +- New version + +* Fri Sep 25 2009 David Lutterkort - 0.1.2-1 +- New Version + +* Wed Sep 16 2009 David Lutterkort - 0.1.1-1 +- Remove patch netcf-0.1.0-fix-initialization-of-libxslt.patch, + included upstream + +* Tue Sep 15 2009 Mark McLoughlin - 0.1.0-3 +- Fix libvirtd segfault caused by libxslt init issue (#523382) + +* Sat Jul 25 2009 Fedora Release Engineering - 0.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Jul 13 2009 David Lutterkort - 0.1.0-1 +- BR on augeas-0.5.2 +- Drop explicit requires for augeas-libs + +* Wed Apr 15 2009 David Lutterkort - 0.0.2-1 +- Updates acording to Fedora review + +* Fri Feb 27 2009 David Lutterkort - 0.0.1-1 +- Initial specfile