Count errors during SIOCGIFFLAGS as "down"; treating them as errors
was causing us to fail at listing interfaces when an interface early
in the list failed is_active (which uses SIOCGIFFLAGS).
This also pointed out that we were missing some ERR_BAILs - even
though if_is_active threw an error, we were continuing rather than
aborting.
---
src/drv_initscripts.c | 2 ++
src/dutil.c | 1 -
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/drv_initscripts.c b/src/drv_initscripts.c
index 8e36fab..d3927f7 100644
--- a/src/drv_initscripts.c
+++ b/src/drv_initscripts.c
@@ -527,12 +527,14 @@ static int list_interface_ids(struct netcf *ncf,
aug = get_augeas(ncf);
ERR_BAIL(ncf);
nint = list_interfaces(ncf, &intf);
+ ERR_BAIL(ncf);
if (!names) {
maxnames = nint; /* if not returning list, ignore maxnames too */
}
for (result = 0; (result < nint) && (nqualified < maxnames); result++)
{
nmatches = aug_fmt_match(ncf, &matches,
"%s/%s", intf[result], id_attr);
+ ERR_BAIL(ncf);
if (nmatches > 0) {
const char *name;
int is_qualified = ((flags & (NETCF_IFACE_ACTIVE|NETCF_IFACE_INACTIVE))
diff --git a/src/dutil.c b/src/dutil.c
index 817ec6d..8604e1f 100644
--- a/src/dutil.c
+++ b/src/dutil.c
@@ -439,7 +439,6 @@ int if_is_active(struct netcf *ncf, const char *intf) {
strncpy(ifr.ifr_name, intf, sizeof(ifr.ifr_name));
ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0';
if (ioctl(ncf->driver->ioctl_fd, SIOCGIFFLAGS, &ifr)) {
- report_error(ncf, NETCF_EIOCTL, "Failed to get interface flags for %s",
intf);
return 0;
}
return ((ifr.ifr_flags & IFF_UP) == IFF_UP);
--
1.6.2.5
Show replies by date
On Mon, 2009-10-12 at 15:38 -0400, Laine Stump wrote:
Count errors during SIOCGIFFLAGS as "down"; treating them
as errors
was causing us to fail at listing interfaces when an interface early
in the list failed is_active (which uses SIOCGIFFLAGS).
This also pointed out that we were missing some ERR_BAILs - even
though if_is_active threw an error, we were continuing rather than
aborting.
ACK. Committed.