Hello community, here is the log from the commit of package netcf for openSUSE:Factory checked in at Fri Jun 10 09:33:42 CEST 2011.
-------- --- netcf/netcf.changes 2011-03-31 14:44:43.000000000 +0200 +++ /mounts/work_src_done/STABLE/netcf/netcf.changes 2011-06-07 22:48:41.000000000 +0200 @@ -1,0 +2,18 @@ +Tue Jun 7 20:38:19 UTC 2011 - [email protected] + +- added fix such that netcf will be more liberal in + what it accepts for syntax from udev - 11.3 update + to 11.4 would cause a problem if old version of + persistent-net.rules was preserved on an upgrade + (related to bug 689282) +- added fix so that netcf will ignore augeas parse + errors that it does not care about - the upgrade + of augeas, which contained lens parse errors, caused + netcf to assume the loading of its own lenses failed, + this fixes the log spamming in bug 689282 +- added fix such that netcf will be more liberal in + what it accepts for syntax from persistent-net.rules + and will only change it in very limited cases(user + actually specifies a mac address change) + +------------------------------------------------------------------- calling whatdependson for head-i586 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ netcf.spec ++++++ --- /var/tmp/diff_new_pack.Ybsz8f/_old 2011-06-10 09:32:52.000000000 +0200 +++ /var/tmp/diff_new_pack.Ybsz8f/_new 2011-06-10 09:32:52.000000000 +0200 @@ -19,7 +19,7 @@ Name: netcf Version: 0.1.6 -Release: 5 +Release: 7 Summary: Cross-platform network configuration library Group: Productivity/Networking/System @@ -85,12 +85,7 @@ %build %configure --disable-static -%if 0%{?suse_version} >= 1130 -make CFLAGS="-DOS113" %{?_smp_mflags} -%else -cp data/lenses/persist_net_rules-pre-os113.aug data/lenses/persist_net_rules.aug make %{?_smp_mflags} -%endif %install rm -rf $RPM_BUILD_ROOT ++++++ netcf-suse.patch ++++++ --- /var/tmp/diff_new_pack.Ybsz8f/_old 2011-06-10 09:32:52.000000000 +0200 +++ /var/tmp/diff_new_pack.Ybsz8f/_new 2011-06-10 09:32:52.000000000 +0200 @@ -1,7 +1,5 @@ From:Patrick Mullaney <[email protected]> -From: root <root@novy.(none)> - netcf: Suse backend for netcf These changes address basic ethernet physical interface configuration. @@ -10,14 +8,11 @@ Signed-off-by: Patrick Mullaney <[email protected]> --- - Makefile.am | 2 - data/xml/initscripts-get.xsl | 51 +++- - data/xml/initscripts-put.xsl | 7 - - src/Makefile.am | 1 - src/drv_initscripts.c | 570 ++++++++++++++++++++++++++---------------- - src/dutil.c | 32 ++ - src/dutil.h | 3 - 7 files changed, 432 insertions(+), 234 deletions(-) + src/Makefile.am | 1 + src/drv_initscripts.c | 537 ++++++++++++++++++++++++++++++------------------- + src/dutil.c | 44 +++- + src/dutil.h | 3 + 4 files changed, 361 insertions(+), 224 deletions(-) diff --git a/Makefile.am b/Makefile.am @@ -171,7 +166,7 @@ </xsl:template> diff --git a/data/xml/initscripts-put.xsl b/data/xml/initscripts-put.xsl -index 267d9cd..1b5145a 100644 +index 267d9cd..b117d02 100644 --- a/data/xml/initscripts-put.xsl +++ b/data/xml/initscripts-put.xsl @@ -140,12 +140,15 @@ @@ -192,6 +187,15 @@ <xsl:otherwise> <start mode='none'/> </xsl:otherwise> +@@ -159,7 +162,7 @@ + </xsl:template> + + <xsl:template name="mtu"> +- <xsl:if test="node[@label='MTU']"> ++ <xsl:if test="node[@label='MTU'][@value != '']"> + <mtu size="{node[@label='MTU']/@value}"/> + </xsl:if> + </xsl:template> diff --git a/src/Makefile.am b/src/Makefile.am index 9d8a3d7..daa54d9 100644 --- a/src/Makefile.am @@ -205,7 +209,7 @@ ncftool_SOURCES = ncftool.c ncftool_LDADD = libnetcf.la $(READLINE_LIBS) $(GNULIB) diff --git a/src/drv_initscripts.c b/src/drv_initscripts.c -index d5bbd44..1878875 100644 +index d5bbd44..2759f9f 100644 --- a/src/drv_initscripts.c +++ b/src/drv_initscripts.c @@ -1,6 +1,7 @@ @@ -229,17 +233,18 @@ */ #include <config.h> -@@ -30,6 +34,9 @@ +@@ -30,6 +34,10 @@ #include <stdbool.h> #include <string.h> #include <unistd.h> ++#include <ctype.h> +#include <sys/types.h> +#include <dirent.h> + #include "safe-alloc.h" #include "ref.h" -@@ -47,18 +54,44 @@ +@@ -47,18 +55,44 @@ #include <libexslt/exslt.h> @@ -288,7 +293,7 @@ { "/augeas/load/Ifcfg/excl[1]", "*~" }, { "/augeas/load/Ifcfg/excl[2]", "*.bak" }, { "/augeas/load/Ifcfg/excl[3]", "*.orig" }, -@@ -108,13 +141,14 @@ static const char *const prog_rc_d_iptables = "/etc/init.d/iptables"; +@@ -108,13 +142,14 @@ static const char *const prog_rc_d_iptables = "/etc/init.d/iptables"; * is not a toplevel interface */ static const char *const subif_paths[] = { @@ -305,7 +310,7 @@ if (r != 0) return r; } -@@ -122,14 +156,23 @@ static int is_slave(struct netcf *ncf, const char *intf) { +@@ -122,14 +157,23 @@ static int is_slave(struct netcf *ncf, const char *intf) { } static bool has_ifcfg_file(struct netcf *ncf, const char *name) { @@ -336,7 +341,7 @@ return nmatches > 0; } -@@ -139,76 +182,114 @@ static int cmpstrp(const void *p1, const void *p2) { +@@ -139,76 +183,114 @@ static int cmpstrp(const void *p1, const void *p2) { return strcmp(s1, s2); } @@ -476,12 +481,12 @@ - - if (ndevs == 0) - return NULL; +- +- qsort(devs, ndevs, sizeof(*devs), cmpstrp); + nmatches = aug_fmt_match(ncf, &matches, "%s/%s/*[ NAME = '%s']", + aug_files, udev_netrule_path, name); + ERR_COND_BAIL(nmatches < 0 , ncf, EOTHER); -- qsort(devs, ndevs, sizeof(*devs), cmpstrp); -- - char *path = devs[ndevs - 1]; - devs[ndevs - 1] = NULL; - @@ -506,7 +511,7 @@ } /* Find the path to the ifcfg file that has the configuration for -@@ -218,14 +299,13 @@ static char *find_ifcfg_path_by_device(struct netcf *ncf, const char *name) { +@@ -218,14 +300,13 @@ static char *find_ifcfg_path_by_device(struct netcf *ncf, const char *name) { static char *find_ifcfg_path(struct netcf *ncf, const char *name) { struct augeas *aug = NULL; char *path = NULL; @@ -522,7 +527,7 @@ ERR_NOMEM(r < 0, ncf); nmatches = aug_match(aug, path, NULL); -@@ -234,98 +314,10 @@ static char *find_ifcfg_path(struct netcf *ncf, const char *name) { +@@ -234,98 +315,10 @@ static char *find_ifcfg_path(struct netcf *ncf, const char *name) { if (nmatches == 1) return path; @@ -558,7 +563,7 @@ - int r; - int ndevnames = 0; - const char **devnames = NULL; - +- - aug = get_augeas(ncf); - ERR_BAIL(ncf); - @@ -591,7 +596,7 @@ - - FREE(devnames); - return ndevnames; -- + - error: - FREE(devnames); - free_matches(ndevnames, intf); @@ -622,7 +627,7 @@ } static int list_interfaces(struct netcf *ncf, char ***intf) { -@@ -335,8 +327,8 @@ static int list_interfaces(struct netcf *ncf, char ***intf) { +@@ -335,8 +328,8 @@ static int list_interfaces(struct netcf *ncf, char ***intf) { aug = get_augeas(ncf); ERR_BAIL(ncf); @@ -633,14 +638,6 @@ ERR_BAIL(ncf); result = nint; -@@ -491,6 +483,7 @@ int drv_init(struct netcf *ncf) { - goto error; - - // FIXME: Check for errors -+ - xsltInit(); - exsltStrRegister(); - ncf->driver->get = parse_stylesheet(ncf, "initscripts-get.xsl"); @@ -498,8 +491,10 @@ int drv_init(struct netcf *ncf) { ncf->driver->rng = rng_parse(ncf, "interface.rng"); ERR_BAIL(ncf); @@ -782,10 +779,10 @@ xmlNodePtr forest; char *path = NULL, *lpath = NULL, *label = NULL, *value = NULL; + char *device = NULL, *mac = NULL, *gateway = NULL; -+ char **rules = NULL; ++ const char *val = NULL; struct augeas *aug = NULL; - int result = -1; -+ int result = -1, nrules = 0, ethphysical = 0; ++ int result = -1, ethphysical = 0; + int toplevel = 1; int r; @@ -799,7 +796,7 @@ /* This is a little drastic, since it clears out the file entirely */ r = aug_rm(aug, path); ERR_THROW(r < 0, ncf, EINTERNAL, "aug_rm of '%s' failed", path); -@@ -697,23 +706,154 @@ static int aug_put_xml(struct netcf *ncf, xmlDocPtr xml) { +@@ -697,23 +706,137 @@ static int aug_put_xml(struct netcf *ncf, xmlDocPtr xml) { label = xml_prop(node, "label"); value = xml_prop(node, "value"); /* We should mark the toplevel interface from the XSLT */ @@ -808,14 +805,6 @@ toplevel = 0; } - r = xasprintf(&lpath, "%s/%s", path, label); -- ERR_NOMEM(r < 0, ncf); -- -- r = aug_set(aug, lpath, value); -- ERR_THROW(r < 0, ncf, EOTHER, -- "aug_set of '%s' failed", lpath); -- FREE(lpath); -- xmlFree(label); -- xmlFree(value); + if (STREQ(label, "DEVICE")) { + device = value; + if(!strchr(value, '.') && !strncmp("eth", value, strlen("eth"))) @@ -824,11 +813,9 @@ + } else if(STREQ(label, "HWADDR")) { + mac = value; + xmlFree(label); -+ //continue; + } else if(STREQ(label, "GATEWAY")) { + gateway = value; + xmlFree(label); -+ //continue; + } else { + r = xasprintf(&lpath, "%s/%s", path, label); + ERR_NOMEM(r < 0, ncf); @@ -840,14 +827,14 @@ + xmlFree(label); + xmlFree(value); + } - label = value = NULL; - } - xmlFree(path); - path = NULL; - } ++ label = value = NULL; ++ } ++ xmlFree(path); ++ path = NULL; ++ } + if( device && !mac && ethphysical && toplevel ){ + mac = malloc(20); -+ if( if_hwaddr(ncf, device, mac, 20) ){ ++ if( if_hwaddr(ncf, device, (unsigned char *)mac, 20) ){ + free(mac); + mac = NULL; + } @@ -885,86 +872,77 @@ + FREE(lpath); + } + if( device && mac && ethphysical && toplevel ) { ++ char *pmac=NULL; + + r = xasprintf(&lpath, "%s%s/%s/%s", aug_files, -+ udev_netrule_path, device, "SUBSYSTEM"); -+ ERR_NOMEM(r < 0, ncf); -+ -+ r = aug_set(aug, lpath, "net"); -+ ERR_THROW(r < 0, ncf, EOTHER, -+ "aug_set of '%s' failed", lpath); -+ -+ FREE(lpath); -+ -+ r = xasprintf(&lpath, "%s%s/%s/%s", aug_files, -+ udev_netrule_path, device, "ACTION"); ++ udev_netrule_path, device, "ATTR{address}"); + ERR_NOMEM(r < 0, ncf); + -+ r = aug_set(aug, lpath, "add"); -+ ERR_THROW(r < 0, ncf, EOTHER, -+ "aug_set of '%s' failed", lpath); ++ r = aug_get(aug, lpath, &val); + + FREE(lpath); + -+ r = xasprintf(&lpath, "%s%s/%s/%s", aug_files, -+ udev_netrule_path, device, "DRIVERS"); -+ ERR_NOMEM(r < 0, ncf); ++ for(pmac = mac;*pmac!= '\0';++pmac) ++ *pmac = tolower(*pmac); + -+ r = aug_set(aug, lpath, "?*"); -+ ERR_THROW(r < 0, ncf, EOTHER, -+ "aug_set of '%s' failed", lpath); ++ if ( strncmp(val, mac, strlen(mac)) ) { + -+ FREE(lpath); ++ val = NULL; /* don't free val returned from aug_get */ + -+ r = xasprintf(&lpath, "%s%s/%s/%s", aug_files, -+ udev_netrule_path, device, "ATTR{address}"); -+ ERR_NOMEM(r < 0, ncf); -+ -+ r = aug_set(aug, lpath, mac); -+ ERR_THROW(r < 0, ncf, EOTHER, -+ "aug_set of '%s' failed", lpath); -+ -+ FREE(lpath); -+ -+#ifdef OS113 -+ r = xasprintf(&lpath, "%s%s/%s/%s", aug_files, -+ udev_netrule_path, device, "ATTR{dev_id}"); -+ ERR_NOMEM(r < 0, ncf); ++ r = xasprintf(&lpath, "%s%s/%s/%s", aug_files, ++ udev_netrule_path, device, "SUBSYSTEM"); ++ ERR_NOMEM(r < 0, ncf); + -+ r = aug_set(aug, lpath, "0x0"); -+ ERR_THROW(r < 0, ncf, EOTHER, ++ r = aug_set(aug, lpath, "net"); ++ ERR_THROW(r < 0, ncf, EOTHER, + "aug_set of '%s' failed", lpath); + -+ FREE(lpath); -+#endif ++ FREE(lpath); + + r = xasprintf(&lpath, "%s%s/%s/%s", aug_files, -+ udev_netrule_path, device, "ATTR{type}"); ++ udev_netrule_path, device, "ACTION"); + ERR_NOMEM(r < 0, ncf); + -+ r = aug_set(aug, lpath, "1"); ++ r = aug_set(aug, lpath, "add"); + ERR_THROW(r < 0, ncf, EOTHER, + "aug_set of '%s' failed", lpath); + + FREE(lpath); + + r = xasprintf(&lpath, "%s%s/%s/%s", aug_files, -+ udev_netrule_path, device, "KERNEL"); ++ udev_netrule_path, device, "DRIVERS"); + ERR_NOMEM(r < 0, ncf); + -+ r = aug_set(aug, lpath, "eth*"); ++ r = aug_set(aug, lpath, "?*"); + ERR_THROW(r < 0, ncf, EOTHER, + "aug_set of '%s' failed", lpath); + + FREE(lpath); -+ } ++ ++ r = xasprintf(&lpath, "%s%s/%s/%s", aug_files, ++ udev_netrule_path, device, "ATTR{address}"); + ERR_NOMEM(r < 0, ncf); + +- r = aug_set(aug, lpath, value); ++ r = aug_set(aug, lpath, mac); + ERR_THROW(r < 0, ncf, EOTHER, + "aug_set of '%s' failed", lpath); ++ + FREE(lpath); +- xmlFree(label); +- xmlFree(value); +- label = value = NULL; + } +- xmlFree(path); +- path = NULL; + } + xmlFree(device); + xmlFree(mac); + xmlFree(gateway); result = 0; error: xmlFree(label); -@@ -728,24 +868,17 @@ static int aug_put_xml(struct netcf *ncf, xmlDocPtr xml) { +@@ -728,24 +851,17 @@ static int aug_put_xml(struct netcf *ncf, xmlDocPtr xml) { */ static xmlDocPtr aug_get_xml_for_nif(struct netcf_if *nif) { struct netcf *ncf; @@ -979,12 +957,12 @@ - "%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); -- ERR_BAIL(ncf); -- -- nint = uniq_ifcfg_paths(ncf, ndevs, devs, &intf); + nint = find_ifcfg_file_by_name(ncf, nif->name, &intf); ERR_BAIL(ncf); +- nint = uniq_ifcfg_paths(ncf, ndevs, devs, &intf); +- ERR_BAIL(ncf); +- - aug_xml = aug_get_xml(ncf, nint, intf); + aug_xml = aug_get_xml(nif, nint, intf); @@ -993,7 +971,7 @@ free_matches(nint, &intf); return aug_xml; } -@@ -871,7 +1004,7 @@ static bool is_bond(struct netcf *ncf, const char *name) { +@@ -871,7 +987,7 @@ static bool is_bond(struct netcf *ncf, const char *name) { int nmatches = 0; nmatches = aug_fmt_match(ncf, NULL, @@ -1002,7 +980,7 @@ return nmatches > 0; } -@@ -880,8 +1013,8 @@ static bool is_bridge(struct netcf *ncf, const char *name) { +@@ -880,8 +996,8 @@ static bool is_bridge(struct netcf *ncf, const char *name) { int nmatches = 0; nmatches = aug_fmt_match(ncf, NULL, @@ -1013,16 +991,7 @@ return nmatches > 0; } -@@ -917,21 +1050,32 @@ static int bridge_slaves(struct netcf *ncf, const char *name, char ***slaves) { - static void rm_interface(struct netcf *ncf, const char *name) { - int r; - char *path = NULL; -+ char **rules = NULL; - struct augeas *aug = NULL; -+ int nrules = 0; - - aug = get_augeas(ncf); - ERR_BAIL(ncf); +@@ -924,14 +1040,13 @@ static void rm_interface(struct netcf *ncf, const char *name) { /* The last or clause catches slaves of a bond that are enslaved to * a bridge NAME */ @@ -1037,24 +1006,33 @@ r = aug_rm(aug, path); ERR_COND_BAIL(r < 0, ncf, EOTHER); + -+ nrules = aug_fmt_match(ncf, &rules, "%s/%s/%s", -+ aug_files, udev_netrule_path, name); -+ ERR_COND_BAIL(nrules < 0, ncf, EINTERNAL); -+ -+ while(nrules > 0) { -+ nrules--; -+ r = aug_rm(aug, rules[nrules]); -+ } -+ free_matches(nrules, &rules); -+ error: FREE(path); } diff --git a/src/dutil.c b/src/dutil.c -index 2a6eaa0..05ec95a 100644 +index 2a6eaa0..e52ca3a 100644 --- a/src/dutil.c +++ b/src/dutil.c -@@ -547,6 +547,38 @@ int netlink_close(struct netcf *ncf) { +@@ -175,18 +175,6 @@ struct augeas *get_augeas(struct netcf *ncf) { + r = aug_load(aug); + ERR_THROW(r < 0, ncf, EOTHER, "failed to load config files"); + +- /* FIXME: we need to produce _much_ better diagnostics here - need +- * to analyze what came back in /augeas//error; ultimately, we need +- * to understand whether this is harmless or a real error. For real +- * errors, we need to return an error. +- */ +- r = aug_match(aug, "/augeas//error", NULL); +- if (r > 0 && NCF_DEBUG(ncf)) { +- fprintf(stderr, "warning: augeas initialization had errors\n"); +- fprintf(stderr, "please file a bug with the following lines in the bug report:\n"); +- aug_print(aug, stderr, "/augeas//error"); +- } +- ERR_THROW(r > 0, ncf, EOTHER, "errors in loading some config files"); + ncf->driver->load_augeas = 0; + } + return ncf->driver->augeas; +@@ -547,6 +535,38 @@ int netlink_close(struct netcf *ncf) { return 0; } ++++++ persist_net_rules.patch ++++++ --- /var/tmp/diff_new_pack.Ybsz8f/_old 2011-06-10 09:32:52.000000000 +0200 +++ /var/tmp/diff_new_pack.Ybsz8f/_new 2011-06-10 09:32:52.000000000 +0200 @@ -1,73 +1,16 @@ From:Patrick Mullaney <[email protected]> -From: <> - netcf: augeas lens for persistent net rules Signed-off-by: Patrick Mullaney <[email protected]> --- - data/lenses/persist_net_rules-pre-os113.aug | 45 ++++++++++++++++++++++++++ - data/lenses/persist_net_rules.aug | 46 +++++++++++++++++++++++++++ - 2 files changed, 91 insertions(+), 0 deletions(-) - create mode 100644 data/lenses/persist_net_rules-pre-os113.aug - create mode 100644 data/lenses/persist_net_rules.aug + 0 files changed, 0 insertions(+), 0 deletions(-) -diff --git a/data/lenses/persist_net_rules-pre-os113.aug b/data/lenses/persist_net_rules-pre-os113.aug -new file mode 100644 -index 0000000..0acb3b1 ---- /dev/null -+++ b/data/lenses/persist_net_rules-pre-os113.aug -@@ -0,0 +1,45 @@ -+(* -+Module: Persist_Net_Rules -+ Parses /etc/udev/rules.d/70-persistent-net.rules -+*) -+module Persist_Net_Rules = -+autoload xfm -+ -+let comment = Util.comment -+let empty = Util.empty -+let eol = Util.eol | Util.comment -+ -+(* A separator is either whitespace or \ followed by newline *) -+let sep_ch = /[ \t]|\\\\\n/ -+(* Anything that's not a separator is part of a token *) -+let tok_ch = /[^ \t\n#\\",]|\\\\[^ \t\n]/ -+let optok_ch = /==/ -+let optok = del optok_ch "==" -+let eq_optok_ch = /=/ -+let eq_optok = del eq_optok_ch "=" -+let indent = Util.del_opt_ws "" -+let comma_ch = /,/ -+let commatok (n:string) = indent . del n n . indent -+ -+let token = store tok_ch+ -+let key_token = key /[a-z0-9]/+ -+let quote_ch = /"/ -+let quote = del quote_ch "\"" -+ -+let name_arg (n:string) = Util.del_str n . indent . eq_optok . indent . quote . key_token . quote -+let arg (n:string) = [ label n . Util.del_str n . indent . optok . indent . quote . token . quote ] -+ -+let entry = [ arg "SUBSYSTEM" . commatok "," . -+ arg "ACTION" . commatok "," . -+ arg "DRIVERS" . commatok "," . -+ arg "ATTR{address}" . commatok "," . -+ arg "ATTR{type}" . commatok "," . -+ arg "KERNEL" . commatok "," . -+ name_arg "NAME" . eol ] -+ -+let lns = (comment|empty|entry)* -+ -+let filter = incl "/etc/udev/rules.d/70-persistent-net.rules" . -+ Util.stdexcl -+ -+let xfm = transform lns filter diff --git a/data/lenses/persist_net_rules.aug b/data/lenses/persist_net_rules.aug new file mode 100644 -index 0000000..d875904 +index 0000000..6ff1080 --- /dev/null +++ b/data/lenses/persist_net_rules.aug @@ -0,0 +1,46 @@ @@ -106,9 +49,9 @@ + arg "ACTION" . commatok "," . + arg "DRIVERS" . commatok "," . + arg "ATTR{address}" . commatok "," . -+ arg "ATTR{dev_id}" . commatok "," . -+ arg "ATTR{type}" . commatok "," . -+ arg "KERNEL" . commatok "," . ++ ( arg "ATTR{dev_id}" . commatok "," | ++ arg "ATTR{type}" . commatok "," | ++ arg "KERNEL" . commatok "," )* . + name_arg "NAME" . eol ] + +let lns = (comment|empty|entry)* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
