Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
netcontrol
0001-virsh-iface-list-not-working-as-expected-b...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-virsh-iface-list-not-working-as-expected-bsc-1029201.patch of Package netcontrol
From 9653faeead3d1a851c3cb2f20af353a629ee01a7 Mon Sep 17 00:00:00 2001 From: Nikola Pajkovsky <npajkovsky@suse.de> Date: Mon, 10 Jul 2017 11:52:09 +0100 References: bsc#1029201 Upstream: merged Subject: [PATCH] virsh iface-list not working as expected (bsc#1029201) commit f1592239fc68afd254e207ec833964b9c672db85 Author: Marius Tomaschewski <mt@suse.de> Date: Mon Jul 10 10:40:10 2017 +0200 filter inactive configs by iftype, not by arp-type commit 45271cb4fe11aa3415535247f480614af9472c5a Author: Marius Tomaschewski <mt@suse.de> Date: Mon Jul 10 10:29:25 2017 +0200 call regular ifstatus, do not try to shorten in read diff --git a/src/backend-suse.c b/src/backend-suse.c index 7e76a24..5e5e811 100644 --- a/src/backend-suse.c +++ b/src/backend-suse.c @@ -138,7 +138,7 @@ static int __suse_config_read_routes(nc_route_array_t *routes, const char *file, const char *ifname); static int __suse_system_read_state(nc_interface_t *ifp); -static int __suse_ifstatus(nc_interface_t *ifp, unsigned *status); + #define _SYSCONFIG_NETWORK_DIR "/etc/sysconfig/network" #define _CONFIG_GLOBAL "config" @@ -2109,7 +2109,6 @@ __suse_config_read_ifcfg(nc_handle_t *nh, nc_interface_t *ifp, nc_sysconfig_t *s __suse_ifcfg_bootproto_set(ifp, "static"); } - __suse_ifstatus(ifp, &ifp->ifflags); /* __suse_config_load_sysctls(nh, ifp, &sysctl); __suse_adjust_ipv6_autoconf(ifp, &sysctl); @@ -2528,8 +2527,6 @@ __suse_system_read_state(nc_interface_t *ifp) /* TODO: double check use of 'none' */ __nc_discover_bootproto(ifp); - __suse_ifstatus(ifp, &ifp->ifflags); - if(nc_sysfs_netif_get_string(ifp->name, "address", &value) < 0) { nc_warn("failed to read hwaddr from sysfs"); } else if(value && nc_string_len(value)) { @@ -2540,60 +2537,6 @@ __suse_system_read_state(nc_interface_t *ifp) return ret; } -int -__suse_ifstatus(nc_interface_t *ifp, unsigned *status) -{ - char if_file[PATH_MAX + 1] = {'\0'}; - nc_sysconfig_t *sc; - nc_var_t *v; -#if 0 - char *operstate = NULL; -#endif - - if(!ifp || !ifp->name || !status) - return -1; - - /* for now ... */ - - *status &= ~NC_IFF_NETWORK_UP; - -#if 0 /* Hmm... ifstatus usually check UP flag, not operstate... - * It is very expensive to call ifstatus in every refresh - * [~ every 3 secs with active virt-manager] ... - * - * => ncf_if_status for true ifstatus call. - */ - if(nc_sysfs_netif_get_string(ifp->name, "operstate", &operstate) == 0) { - if(nc_string_eq(operstate, "down") || - nc_string_eq(operstate, "lowerlayerdown")) { - nc_string_free(&operstate); - return 0; - } - nc_string_free(&operstate); - } -#endif - - snprintf(if_file, sizeof(if_file), "/dev/.sysconfig/network/if-%s", ifp->name); - sc = nc_sysconfig_read(if_file); - if(sc) { - if(NC_ADDRCONF_TEST(ifp->ipv4.addrconf, NC_ADDRCONF_DHCP)) { - v = nc_sysconfig_get(sc, "dhcp4_state"); - if(v && (nc_string_eq(v->value, "complete") || - nc_string_eq(v->value, "new") || - nc_string_eq(v->value, "up"))) { - *status |= NC_IFF_NETWORK_UP; - } - } else { - v = nc_sysconfig_get(sc, "status"); - if(v && nc_string_eq(v->value, "connected")) { - *status |= NC_IFF_NETWORK_UP; - } - } - nc_sysconfig_free(sc); - } - return 0; -} - void nc_ifcfg_trace_dump(const nc_sysconfig_t *sc) { diff --git a/src/netcf-xml.c b/src/netcf-xml.c index 02c6538..c4d938b 100644 --- a/src/netcf-xml.c +++ b/src/netcf-xml.c @@ -131,25 +131,31 @@ __get_iftype_name(unsigned int type) } static unsigned int -__map_iftype_to_netcf(unsigned int type) +__map_iftype_to_netcf(const nc_interface_t *ifp, unsigned int strict) { - switch(type) { + switch(ifp ? ifp->type : NC_IFTYPE_UNKNOWN) { + case NC_IFTYPE_ETHERNET: case NC_IFTYPE_BRIDGE: - case NC_IFTYPE_BOND: case NC_IFTYPE_VLAN: - return type; - break; + return ifp->type; + + case NC_IFTYPE_BOND: + if (strict && ifp->bonding && + ifp->bonding->slave_type != NC_IFTYPE_ETHERNET) + break; + return ifp->type; - case NC_IFTYPE_ETHERNET: case NC_IFTYPE_LOOPBACK: /* as netcf does ... */ case NC_IFTYPE_TOKENRING: - case NC_IFTYPE_INFINIBAND: /* hmm... for now */ + case NC_IFTYPE_INFINIBAND: + if (strict) + break; case NC_IFTYPE_DUMMY: case NC_IFTYPE_TAP: return NC_IFTYPE_ETHERNET; - break; + default: - break; + break; } return NC_IFTYPE_UNKNOWN; } @@ -244,10 +250,10 @@ __nc_netcf_supported_inteface( nc_syntax_t *syntax, if(!syntax || !handle || !ifp || !ifp->name) return -1; - if(syntax->strict && ifp->arp_type != ARPHRD_ETHER) + if(syntax->strict && ifp->ifindex && ifp->arp_type != ARPHRD_ETHER) return 1; - if(__map_iftype_to_netcf(ifp->type) == NC_IFTYPE_UNKNOWN) + if(__map_iftype_to_netcf(ifp, syntax->strict) == NC_IFTYPE_UNKNOWN) return 1; if(ifp->startmode == NC_STARTMODE_NFSROOT || @@ -356,7 +362,7 @@ __netcf_xml_from_interface( nc_syntax_t *syntax, return NULL; assert(ifp && ifp->name); - type = __map_iftype_to_netcf(ifp->type); + type = __map_iftype_to_netcf(ifp, syntax->strict); if(type == NC_IFTYPE_UNKNOWN) return NULL; diff --git a/src/netcf.c b/src/netcf.c index a3a78f9..33a0499 100644 --- a/src/netcf.c +++ b/src/netcf.c @@ -718,6 +718,7 @@ __ncf_list_interfaces(struct netcf *ncf, unsigned int flags, state = NETCF_IFACE_INACTIVE; cur = nc_interface_by_name(ncf->system.handle, ifp->name); if(cur) { + nc_interface_status(ncf->system.handle, cur); if(nc_interface_network_is_up(cur)) state = NETCF_IFACE_ACTIVE; } -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor