diff -ur netcf-0.1.7.ori//data/xml/initscripts-get.xsl netcf-0.1.7/data/xml/initscripts-get.xsl
--- netcf-0.1.7.ori//data/xml/initscripts-get.xsl 2009-10-04 08:18:41.000000000 +0200
+++ netcf-0.1.7/data/xml/initscripts-get.xsl 2010-12-08 14:54:28.891813397 +0100
@@ -47,9 +47,12 @@
- /files/etc/sysconfig/network-scripts/ifcfg-
-
-
+ /files/etc/network.d/ifcfg-
+
+
+
+
+
@@ -68,6 +71,7 @@
+
@@ -75,7 +79,11 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- /files/etc/sysconfig/network-scripts/ifcfg-
-
+ /files/etc/network.d/ifcfg-
+
@@ -153,6 +178,7 @@
+
@@ -184,14 +210,14 @@
-
+
-
-
+
+
diff -ur netcf-0.1.7.ori//data/xml/initscripts-put.xsl netcf-0.1.7/data/xml/initscripts-put.xsl
--- netcf-0.1.7.ori//data/xml/initscripts-put.xsl 2009-10-04 08:18:41.000000000 +0200
+++ netcf-0.1.7/data/xml/initscripts-put.xsl 2010-11-26 10:44:46.133757628 +0100
@@ -47,7 +47,7 @@
-
+
@@ -55,7 +55,7 @@
-
+
@@ -70,7 +70,7 @@
match="tree[node[@label = 'TYPE' and @value = 'Bridge']]">
-
+
@@ -101,17 +101,17 @@
Bond
-->
-
+
-
+
-
+
@@ -125,7 +125,7 @@
+ match="tree[node[@label = 'INTERFACE'][@value = //tree/node[@label = 'MASTER']/@value]][count(node[@label = 'BRIDGE']) = 0]">
@@ -154,7 +154,7 @@
-
+
@@ -173,7 +173,7 @@
+ select="count(node[@label = 'ADDR']) > 0"/>
@@ -186,7 +186,7 @@
-
+
diff -ur netcf-0.1.7.ori//src/drv_initscripts.c netcf-0.1.7/src/drv_initscripts.c
--- netcf-0.1.7.ori//src/drv_initscripts.c 2010-09-23 14:13:13.000000000 +0200
+++ netcf-0.1.7/src/drv_initscripts.c 2010-12-08 13:57:02.027361706 +0100
@@ -49,17 +49,20 @@
#include
static const char *const network_scripts_path =
- "/files/etc/sysconfig/network-scripts";
+ //"/files/etc/sysconfig/network-scripts";
+ "/files/etc/network.d/*";
static const char *const ifcfg_path =
- "/files/etc/sysconfig/network-scripts/*";
+ //"/files/etc/sysconfig/network-scripts/*";
+ "/files/etc/network.d/*";
/* Augeas should only load the files we are interested in */
static const struct augeas_pv augeas_xfm_common_pv[] = {
/* Ifcfg files */
{ "/augeas/load/Ifcfg/lens", "Sysconfig.lns" },
{ "/augeas/load/Ifcfg/incl",
- "/etc/sysconfig/network-scripts/ifcfg-*" },
+ "/etc/network.d/ifcfg-*" },
+ //"/etc/sysconfig/network-scripts/ifcfg-*" },
{ "/augeas/load/Ifcfg/excl[1]", "*~" },
{ "/augeas/load/Ifcfg/excl[2]", "*.bak" },
{ "/augeas/load/Ifcfg/excl[3]", "*.orig" },
@@ -107,10 +110,10 @@
int nmatches;
nmatches = aug_fmt_match(ncf, NULL,
- "%s[ DEVICE = '%s'"
+ "%s[ INTERFACE = '%s'"
" or BRIDGE = '%s'"
" or MASTER = '%s'"
- " or MASTER = ../*[BRIDGE = '%s']/DEVICE ]/DEVICE",
+ " or MASTER = ../*[BRIDGE = '%s']/INTERFACE ]/INTERFACE",
ifcfg_path, name, name, name, name);
return nmatches > 0;
}
@@ -173,7 +176,7 @@
aug = get_augeas(ncf);
ERR_BAIL(ncf);
- ndevs = aug_fmt_match(ncf, &devs, "%s[DEVICE = '%s']",
+ ndevs = aug_fmt_match(ncf, &devs, "%s[INTERFACE = '%s']",
ifcfg_path, name);
ERR_COND_BAIL(ndevs < 0, ncf, EOTHER);
@@ -296,7 +299,8 @@
int result = 0, ndevs;
char **devs = NULL;
- ndevs = aug_fmt_match(ncf, &devs, "%s/DEVICE", ifcfg_path);
+ ndevs = aug_fmt_match(ncf, &devs, "%s/INTERFACE", ifcfg_path);
+ printf("%i\n", ndevs);
ERR_COND_BAIL(ndevs < 0, ncf, EOTHER);
result = uniq_ifcfg_paths(ncf, ndevs, devs, intf);
@@ -453,11 +457,11 @@
int drv_list_interfaces(struct netcf *ncf, int maxnames, char **names,
unsigned int flags) {
- return list_interface_ids(ncf, maxnames, names, flags, "DEVICE");
+ return list_interface_ids(ncf, maxnames, names, flags, "INTERFACE");
}
int drv_num_of_interfaces(struct netcf *ncf, unsigned int flags) {
- return list_interface_ids(ncf, 0, NULL, flags, "DEVICE");
+ return list_interface_ids(ncf, 0, NULL, flags, "INTERFACE");
}
struct netcf_if *drv_lookup_by_name(struct netcf *ncf, const char *name) {
@@ -599,8 +603,8 @@
ncf = nif->ncf;
ndevs = aug_fmt_match(ncf, &devs,
- "%s[ DEVICE = '%s' or BRIDGE = '%s' or MASTER = '%s'"
- " or MASTER = ../*[BRIDGE = '%s']/DEVICE ]/DEVICE",
+ "%s[ INTERFACE = '%s' or BRIDGE = '%s' or MASTER = '%s'"
+ " or MASTER = ../*[BRIDGE = '%s']/INTERFACE ]/INTERFACE",
ifcfg_path, nif->name, nif->name, nif->name, nif->name);
ERR_BAIL(ncf);
@@ -745,7 +749,7 @@
int nmatches = 0;
nmatches = aug_fmt_match(ncf, NULL,
- "%s[ DEVICE = '%s' and TYPE = 'Bridge']",
+ "%s[ INTERFACE = '%s' and TYPE = 'Bridge']",
ifcfg_path, name);
return nmatches > 0;
}
@@ -758,7 +762,7 @@
ERR_BAIL(ncf);
nslaves = aug_fmt_match(ncf, slaves,
- "%s[ BRIDGE = '%s' ]/DEVICE", ifcfg_path, name);
+ "%s[ BRIDGE = '%s' ]/INTERFACE", ifcfg_path, name);
ERR_BAIL(ncf);
for (int i=0; i < nslaves; i++) {
char *p = (*slaves)[i];
@@ -790,8 +794,8 @@
/* The last or clause catches slaves of a bond that are enslaved to
* a bridge NAME */
r = xasprintf(&path,
- "%s[ DEVICE = '%s' or BRIDGE = '%s' or MASTER = '%s' "
- " or MASTER = ../*[BRIDGE = '%s']/DEVICE ]",
+ "%s[ INTERFACE = '%s' or BRIDGE = '%s' or MASTER = '%s' "
+ " or MASTER = ../*[BRIDGE = '%s']/INTERFACE ]",
ifcfg_path, name, name, name, name);
ERR_NOMEM(r < 0, ncf);
@@ -967,7 +971,7 @@
for (int i = 0; i < nmatches; i++) {
if (!has_ifcfg_file(ncf, matches[i]))
continue;
- r = xasprintf(&ifcfg, "%s[DEVICE = '%s']", ifcfg_path, matches[i]);
+ r = xasprintf(&ifcfg, "%s[INTERFACE = '%s']", ifcfg_path, matches[i]);
ERR_NOMEM(r < 0, ncf);
if (! is_slave(ncf, ifcfg))
@@ -1023,7 +1027,10 @@
*/
int drv_if_up(struct netcf_if *nif) {
- static const char *const ifup = "ifup";
+ //static const char *const ifup = "ifup";
+ static const char *const ifup = "netcfg";
+ static const char *const ifprefix = "ifcfg-";
+ char ifname[strlen(nif->name) + sizeof(ifprefix)];
struct netcf *ncf = nif->ncf;
char **slaves = NULL;
int nslaves = 0;
@@ -1035,11 +1042,24 @@
ERR_BAIL(ncf);
for (int i=0; i < nslaves; i++) {
- run1(ncf, ifup, slaves[i]);
+ //run1(ncf, ifup, slaves[i]);
+ const char *const argv[] = {
+ ifup, "-u", slaves[i], NULL
+ };
+
+ run_program(ncf, argv);
ERR_BAIL(ncf);
}
}
- run1(ncf, ifup, nif->name);
+ //run1(ncf, ifup, nif->name);
+ /* Interfaces name have to be equal to script under /etc/network.d */
+ strcpy(ifname, ifprefix);
+ strcat(ifname, nif->name);
+ const char *const argv[] = {
+ ifup, "-u", ifname, NULL
+ };
+
+ run_program(ncf, argv);
ERR_BAIL(ncf);
result = 0;
error:
@@ -1048,13 +1068,23 @@
}
int drv_if_down(struct netcf_if *nif) {
- static const char *const ifdown = "ifdown";
+ //static const char *const ifdown = "ifdown";
+ static const char *const ifdown = "netcfg";
+ static const char *const ifprefix = "ifcfg-";
+ char ifname[strlen(nif->name) + sizeof(ifprefix)];
struct netcf *ncf = nif->ncf;
char **slaves = NULL;
int nslaves = 0;
int result = -1;
- run1(ncf, ifdown, nif->name);
+ //run1(ncf, ifdown, nif->name);
+ strcpy(ifname, ifprefix);
+ strcat(ifname, nif->name);
+ const char *const argv[] = {
+ ifdown, "-d", ifname, NULL
+ };
+
+ run_program(ncf, argv);
ERR_BAIL(ncf);
if (is_bridge(ncf, nif->name)) {
/* Bring up bridge slaves after the bridge */
@@ -1062,7 +1092,12 @@
ERR_BAIL(ncf);
for (int i=0; i < nslaves; i++) {
- run1(ncf, ifdown, slaves[i]);
+ //run1(ncf, ifdown, slaves[i]);
+ const char *const argvs[] = {
+ ifdown, "-d", slaves[i], NULL
+ };
+
+ run_program(ncf, argvs);
ERR_BAIL(ncf);
}
}
diff -ur netcf-0.1.7.ori//tests/interface/bridge.xml~ netcf-0.1.7/tests/interface/bridge.xml~
--- netcf-0.1.7.ori//tests/interface/bridge.xml~ 2009-10-13 19:14:53.000000000 +0200
+++ netcf-0.1.7/tests/interface/bridge.xml~ 2009-10-14 05:09:05.000000000 +0200
@@ -2,10 +2,12 @@
-
+
+
+
diff -ur netcf-0.1.7.ori//tests/interface/vlan.xml~ netcf-0.1.7/tests/interface/vlan.xml~
--- netcf-0.1.7.ori//tests/interface/vlan.xml~ 2010-07-30 06:02:39.000000000 +0200
+++ netcf-0.1.7/tests/interface/vlan.xml~ 2010-09-07 18:26:22.000000000 +0200
@@ -1,9 +1,9 @@
-
+
-
+