[netcf-devel] [PATCH 1/2] initscripts driver: move ifup/ifdown into driver
David Lutterkort
lutter at redhat.com
Fri Jul 10 02:00:44 UTC 2009
---
src/drv_initscripts.c | 19 +++++++++++++++++++
src/internal.h | 2 ++
src/netcf.c | 12 ++----------
3 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/src/drv_initscripts.c b/src/drv_initscripts.c
index d606e03..6b362e9 100644
--- a/src/drv_initscripts.c
+++ b/src/drv_initscripts.c
@@ -1079,6 +1079,25 @@ const char *drv_mac_string(struct netcf_if *nif) {
}
/*
+ * Bringing interfaces up/down
+ */
+int drv_if_up(struct netcf_if *nif) {
+ const char *const if_up_argv[] = {
+ "ifup", nif->name, NULL
+ };
+
+ return run_program(nif->ncf, if_up_argv);
+}
+
+int drv_if_down(struct netcf_if *nif) {
+ const char *const if_down_argv[] = {
+ "ifdown", nif->name, NULL
+ };
+
+ return run_program(nif->ncf, if_down_argv);
+}
+
+/*
* Test interface
*/
int drv_get_aug(struct netcf *ncf, const char *ncf_xml, char **aug_xml) {
diff --git a/src/internal.h b/src/internal.h
index d6acd55..a11648b 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -163,6 +163,8 @@ char *drv_xml_desc(struct netcf_if *);
const char *drv_mac_string(struct netcf_if *nif);
struct netcf_if *drv_define(struct netcf *ncf, const char *xml);
int drv_undefine(struct netcf_if *nif);
+int drv_if_up(struct netcf_if *nif);
+int drv_if_down(struct netcf_if *nif);
int drv_get_aug(struct netcf *, const char *ncf_xml, char **aug_xml);
int drv_put_aug(struct netcf *, const char *aug_xml, char **ncf_xml);
diff --git a/src/netcf.c b/src/netcf.c
index 6f1214d..b1a5c4e 100644
--- a/src/netcf.c
+++ b/src/netcf.c
@@ -162,24 +162,16 @@ int ncf_if_undefine(struct netcf_if *nif) {
/* Bring the interface up */
int ncf_if_up(struct netcf_if *nif) {
- const char *const if_up_argv[] = {
- "ifup", nif->name, NULL
- };
-
/* I'm a bit concerned that this assumes nif (and nif->ncf) is non-NULL) */
API_ENTRY(nif->ncf);
- return run_program(nif->ncf, if_up_argv);
+ return drv_if_up(nif);
}
/* Take it down */
int ncf_if_down(struct netcf_if *nif) {
- const char *const if_down_argv[] = {
- "ifdown", nif->name, NULL
- };
-
/* I'm a bit concerned that this assumes nif (and nif->ncf) is non-NULL) */
API_ENTRY(nif->ncf);
- return run_program(nif->ncf, if_down_argv);
+ return drv_if_down(nif);
}
/* Produce an XML description for the interface, in the same format that
--
1.6.0.6
More information about the netcf-devel
mailing list