ncftool manpage
by Serge Hallyn
I added nothing of value here, just turned the 'ncftool help' output
into a ncftool.1 manpage.
thanks,
-serge
.TH NCFTOOL 1 "December 20, 2011"
.SH NAME
ncftool \- Network configuration tool
.SH SYNOPSIS
.B ncftool [options]
.SH DESCRIPTION
ncftool is a command line utility to configure networking.
.SH OPTIONS
.TP
.B list [\-\-macs] [\-\-all] [\-\-inactive]
List the currently configured toplevel network interfaces
.br
.BR [\-\-macs]
show MAC addresses
.br
.BR [\-\-all]
show all (up & down) interfaces
.br
.BR [\-\-inactive]
show only inactive (down) interfaces
.TP
.B dumpxml [\-\-mac] [\-\-live] <name>
Dump the XML description of an interface
.br
.BR [\-\-mac]
interpret the name as MAC address
.br
.BR [\-\-life]
include information about the live interface
.br
.BR <name>
the name of the interface
.TP
.B define <xmlfile>
Define - define an interface from an XML file
.br
.BR <xmlfile>
file containing the XML description of the interface
.TP
.B undefine <iface>
Remove the configuration of an interface
.br
.BR <iface>
the name of the interface
.TP
.B ifup <iface>
Bring up an interface
.br
.BR <iface>
the name of the interface
.TP
.B ifdown <iface>
Bring down an interface
.br
.BR <iface>
the name of the interface
.TP
.B change-begin
Mark the beginning of a set of revertible network config changes
.TP
.B change-commit
Commit (makes permanent) of a set of network config changes
.TP
.B change-rollback
Rollback (revert) a set of network config changes
.TP
.B help [<command>]
List all commands or print details about one command
.br
.BR <command>
If specified, list help about the listed command. Otherwise list all commands.
.TP
.B quit
Exit the program
.TP
.SH SEE ALSO
.BR interfaces (5)
.SH AUTHOR
Serge Hallyn <serge.hallyn(a)ubuntu.com>
11 years, 7 months
[PATCH] check IFF_RUNNING before considering an interface "active"
by Laine Stump
From: Laine Stump <laine(a)redhat.com>
This is in response to:
https://bugzilla.redhat.com/show_bug.cgi?id=844578
If an interface's cable is unplugged and it is configured to use dhcp
(or if NetworkManager is running), attempts to ifup will fail, but
netcf will later report that the interface is active. This is because
netcf only checks the IFF_UP flag in the interface status.
It makes more sense for the interface to be counted as active only if
ifup has been successful, so this patch changes the if_is_active()
utility function to require both IFF_UP and IFF_RUNNING be set before
counting the interface as active.
However, if an interface is configured for a static IP address *and
NetworkManager isn't running*, ifup will succeed even when the cable
is unplugged. So again the active status of the interface is not
consistent with the result of ifup. To resolve this inconsistency,
this patch makes na additional check for if_is_active() after the
system's ifup utility successfully completes.
The result is consistency between the result of ifup and the
interface's flags in all cases.
Note that the 2nd change needed to be done separately in all three
linux drivers, because if_is_active() is a linux-specific function, so
it can't be called from the platform-agnostic netcf.c (yet each
platform's drv_if_up() is different, so they can't all call a common
util_if_up())..
---
src/drv_debian.c | 3 +++
src/drv_redhat.c | 3 +++
src/drv_suse.c | 3 +++
src/dutil_linux.c | 2 +-
4 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/drv_debian.c b/src/drv_debian.c
index dcf35eb..04953e3 100644
--- a/src/drv_debian.c
+++ b/src/drv_debian.c
@@ -1050,6 +1050,9 @@ int drv_if_up(struct netcf_if *nif) {
run1(ncf, ifup, nif->name);
ERR_BAIL(ncf);
+ ERR_THROW(!if_is_active(ncf, nif->name), ncf, EOTHER,
+ "interface %s failed to become active - "
+ "possible disconnected cable.", nif->name);
result = 0;
error:
return result;
diff --git a/src/drv_redhat.c b/src/drv_redhat.c
index 9bdcef0..06ad42a 100644
--- a/src/drv_redhat.c
+++ b/src/drv_redhat.c
@@ -1031,6 +1031,9 @@ int drv_if_up(struct netcf_if *nif) {
}
run1(ncf, ifup, nif->name);
ERR_BAIL(ncf);
+ ERR_THROW(!if_is_active(ncf, nif->name), ncf, EOTHER,
+ "interface %s failed to become active - "
+ "possible disconnected cable.", nif->name);
result = 0;
error:
free_matches(nslaves, &slaves);
diff --git a/src/drv_suse.c b/src/drv_suse.c
index 02f4ee4..7b3aa20 100644
--- a/src/drv_suse.c
+++ b/src/drv_suse.c
@@ -1174,6 +1174,9 @@ int drv_if_up(struct netcf_if *nif) {
}
run1(ncf, ifup, nif->name);
ERR_BAIL(ncf);
+ ERR_THROW(!if_is_active(ncf, nif->name), ncf, EOTHER,
+ "interface %s failed to become active - "
+ "possible disconnected cable.", nif->name);
result = 0;
error:
free_matches(nslaves, &slaves);
diff --git a/src/dutil_linux.c b/src/dutil_linux.c
index bf6d13f..3cefb9e 100644
--- a/src/dutil_linux.c
+++ b/src/dutil_linux.c
@@ -692,7 +692,7 @@ int if_is_active(struct netcf *ncf, const char *intf) {
if (ioctl(ncf->driver->ioctl_fd, SIOCGIFFLAGS, &ifr)) {
return 0;
}
- return ((ifr.ifr_flags & IFF_UP) == IFF_UP);
+ return ((ifr.ifr_flags & (IFF_UP|IFF_RUNNING)) == (IFF_UP|IFF_RUNNING));
}
netcf_if_type_t if_type(struct netcf *ncf, const char *intf) {
--
1.7.7.6
11 years, 8 months
ANNOUNCE: netcf-0.2.0
by Laine Stump
After a very long wait, I'm happy to announce the release of netcf 0.2.0
The big news in this release is support for the following platforms:
debian/Ubuntu (Dan Berrange, Serge Hallyn)
Suse (Dan Berrange, still experimental)
MS Windows (Adam Stokes, partially complete)
Aside from this, another important improvement is support for libnl-3 (which has a slightly different API from libl-1) (Serge Hallyn, Thomas Graf)
There were also a few minor bugfixes.
Thanks to everybody who contributed to this release!
Tarball:https://fedorahosted.org/released/netcf/netcf-0.2.0.tar.gz
GPG signature[1]:
https://fedorahosted.org/released/netcf/netcf-0.2.0.tar.gz.sig
An RPM for Fedora Rawhide will be available "soon".
Laine
[1] To verify the signature, first download both the .sig file and the
corresponding tarball. Then, run a command like this:
gpg --verify netcf-0.2.0.tar.gz.sig
If that command fails because you don't have the required public key,
then run this command to import it:
gpg --keyserver keys.gnupg.net --recv-keys 62D11E4C
and rerun the `gpg --verify' command.
11 years, 8 months
fix mistyped PATH_SEPARATOR in configure.ac
by Serge Hallyn
Otherwise configure doesn't find /sbin/ifdown (by default) on debian.
Signed-off-by: Serge E. Hallyn <serge.hallyn(a)ubuntu.com>
---
netcf-0.2.0/configure.ac | 4 ++--
netcf-0.2.0/configure | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
Index: netcf-0.2.0/configure.ac
===================================================================
--- netcf-0.2.0.orig/configure.ac 2012-07-20 19:58:29.000000000 +0000
+++ netcf-0.2.0/configure.ac 2012-07-23 16:58:10.000000000 +0000
@@ -143,13 +143,13 @@
if test "x$with_driver" = "xdebian"; then
dnl Check for ifup and ifdown in debian
- AC_PATH_PROG(IFDOWN, ifdown, false, $PATH$PATHSEPARATOR/sbin)
+ AC_PATH_PROG(IFDOWN, ifdown, false, $PATH$PATH_SEPARATOR/sbin)
if test "$IFDOWN" = "false"; then
AC_MSG_ERROR([ifdown not found])
fi
AC_DEFINE_UNQUOTED([IFDOWN], "$IFDOWN", [path to ifdown binary])
- AC_PATH_PROG(IFUP, ifup, false, $PATH$PATHSEPARATOR/sbin)
+ AC_PATH_PROG(IFUP, ifup, false, $PATH$PATH_SEPARATOR/sbin)
if test "$IFUP" = "false"; then
AC_MSG_ERROR([ifup not found])
fi
Index: netcf-0.2.0/configure
===================================================================
--- netcf-0.2.0.orig/configure 2012-07-20 20:00:48.000000000 +0000
+++ netcf-0.2.0/configure 2012-07-23 17:04:23.000000000 +0000
@@ -28368,7 +28368,7 @@
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATHSEPARATOR/sbin
+for as_dir in $PATH$PATH_SEPARATOR/sbin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
@@ -28418,7 +28418,7 @@
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATHSEPARATOR/sbin
+for as_dir in $PATH$PATH_SEPARATOR/sbin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
11 years, 8 months
netcf patches for debian (v2)
by Serge E. Hallyn
Hi,
Thanks Eric and Laine for your earlier comments. Here is a small
set of 3 cleaner patches which are enough to make netcf build on
debian. (patches on top of git head). I will try my hand at
the autoconf magic needed for libnl support next.
thanks,
-serge
11 years, 8 months