Hello community, here is the log from the commit of package wicked for openSUSE:Factory checked in at 2014-07-21 10:34:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/wicked (Old) and /work/SRC/openSUSE:Factory/.wicked.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "wicked" Changes: -------- --- /work/SRC/openSUSE:Factory/wicked/wicked.changes 2014-07-15 16:26:05.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.wicked.new/wicked.changes 2014-07-21 10:34:51.000000000 +0200 @@ -1,0 +2,12 @@ +Fri Jul 18 10:16:12 UTC 2014 - [email protected] + +- version 0.5.35 +- dhcp4: fix routes with gateway on other network than IP address + and use address class based netmask if it is missed (bnc#887586) +- route,address: check also gw address to set scope correctly and + omit sending a broadcast when equal to IP address (bnc#887586) +- ethtool: fix to set link speed, duplex and port options +- iflist: fix link type detection for tap devices (bnc#887564) +- ifup/reload: status reporting and complex device hierarchy fixes + +------------------------------------------------------------------- Old: ---- wicked-0.5.34.tar.bz2 New: ---- wicked-0.5.35.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ wicked.spec ++++++ --- /var/tmp/diff_new_pack.p6eSZ7/_old 2014-07-21 10:34:52.000000000 +0200 +++ /var/tmp/diff_new_pack.p6eSZ7/_new 2014-07-21 10:34:52.000000000 +0200 @@ -18,7 +18,7 @@ %define release_prefix %{?snapshot:%{snapshot}}%{!?snapshot:0} Name: wicked -Version: 0.5.34 +Version: 0.5.35 Release: %{release_prefix}.0.0 Summary: Network configuration infrastructure License: GPL-2.0 ++++++ wicked-0.5.34.tar.bz2 -> wicked-0.5.35.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.5.34/ChangeLog new/wicked-0.5.35/ChangeLog --- old/wicked-0.5.34/ChangeLog 2014-07-15 09:45:59.000000000 +0200 +++ new/wicked-0.5.35/ChangeLog 2014-07-18 12:17:35.000000000 +0200 @@ -1,3 +1,155 @@ +commit c4a2cf65a55c384009eefddaef4b6571b813fe03 +Author: Marius Tomaschewski <[email protected]> +Date: Fri Jul 18 11:57:39 2014 +0200 + + version 0.5.35 + +commit 32cc7784e5054706429a827ab921015593c62b95 +Author: Marius Tomaschewski <[email protected]> +Date: Thu Jul 17 19:02:14 2014 +0200 + + dhcp4: handle prefix-len 0 in cidr to netmask + +commit 77b43df63e38c3ad889170cda7d34cd7288e101f +Author: Marius Tomaschewski <[email protected]> +Date: Thu Jul 17 18:55:14 2014 +0200 + + dhcp4: use a helper for netmask/cidr conversions + +commit baad847fb409b167b7e45e61d13f8f943bcff44b +Author: Marius Tomaschewski <[email protected]> +Date: Thu Jul 17 16:59:57 2014 +0200 + + dhcp4: use address class netmask if missed (bnc#887586) + +commit 6b7e6cdd0b036aa8b3e9db1fe567729f48427699 +Author: Pawel Wieczorkiewicz <[email protected]> +Date: Thu Jul 17 15:35:16 2014 +0200 + + ifup: generate <link-type> directly from <device> gen. + +commit 7104cad3a1ee09f87a51c8cdc006b18b93bfad32 +Author: Pawel Wieczorkiewicz <[email protected]> +Date: Thu Jul 17 14:51:29 2014 +0200 + + ifup: fix <child> subnode of <match> generation + + It should not check the w->device existance. + +commit 3861653f02e4690abaffcee6631e9acafeffb857 +Author: Karol Mroz <[email protected]> +Date: Thu Jul 17 12:07:12 2014 +0200 + + iflist: fix link type detection for tap devices + + To distinguish between tun and tap devices based on link->kind, + we need to check hwaddr.type, otherwise all tun/tap devices + show up as tun. + + fixes bnc#887564 + +commit f930bcdc8ad49dc0836b88bb447453dd7bbe3b87 +Author: Marius Tomaschewski <[email protected]> +Date: Wed Jul 16 19:36:00 2014 +0200 + + route: check gw address to set scope (bnc#887586) + + Fixed guess scope helper to also check the if route gateway + address is specified, not only if it's family is unspec to + not set device routes with universe scope. + +commit 73cb2548b2588ee971608bbe39dd4a495e48ffd1 +Author: Marius Tomaschewski <[email protected]> +Date: Wed Jul 16 19:34:32 2014 +0200 + + address: omit brd when equal to address (bnc#887586) + +commit 9fa29f5ef4bf137471b352dbeb591061262e2ad7 +Author: Marius Tomaschewski <[email protected]> +Date: Wed Jul 16 19:33:11 2014 +0200 + + dhcp4: prepend gateway device routes if needed (bnc#887586) + + When a route gateway is not on the same network as the IP + address, e.g. because the server provided us a IP/32, and + there are no matching device routes provided, prepend one. + +commit 8c93f0ee73c384cea8cf2510d4469d7604074385 +Author: Pawel Wieczorkiewicz <[email protected]> +Date: Wed Jul 16 18:25:34 2014 +0200 + + fsm: rearm child workers on pull in + +commit 3f4d984d7bead7b6fdb09b2b212cd598cad9205b +Author: Karol Mroz <[email protected]> +Date: Tue Jul 15 21:39:04 2014 +0200 + + ethernet: stylistic cleanup + +commit ff8b3b2602b63d6df00fc10e72e56a6568db6b78 +Author: Karol Mroz <[email protected]> +Date: Tue Jul 15 21:38:35 2014 +0200 + + ethernet: set ethernet nic settings + + Set link speed, duplex and port. + +commit bec8fd8bedcb57443ab543325b5a8eac46234b1c +Author: Karol Mroz <[email protected]> +Date: Tue Jul 15 21:37:30 2014 +0200 + + ethernet: fix incorrect duplex assignment + +commit c33832c23992479a96e94fa3efe779ee23c44b6e +Author: Karol Mroz <[email protected]> +Date: Tue Jul 15 21:36:41 2014 +0200 + + ethernet: add function to determine ethtool advertising + + Taken from ethtool. + +commit 42800095c75c43f094ae930aee6ecbbe0f7b3f7a +Author: Karol Mroz <[email protected]> +Date: Tue Jul 15 21:31:02 2014 +0200 + + ethernet: add advertising flags and modes from ethtool + +commit 3838b98f38134360f84d5535fc0fdc1b3f854835 +Author: Pawel Wieczorkiewicz <[email protected]> +Date: Tue Jul 15 17:52:38 2014 +0200 + + fsm: clean only the state on fail + +commit 1a4dd38253f4f423e10354cc7bf5188f82a4ec46 +Author: Pawel Wieczorkiewicz <[email protected]> +Date: Tue Jul 15 17:52:19 2014 +0200 + + fsm: Add __ni_ifworker_reset_fsm() to clean fsm object + +commit c59966161712580c8f2d71a1695b3629e337084f +Author: Pawel Wieczorkiewicz <[email protected]> +Date: Tue Jul 15 11:43:25 2014 +0200 + + ifreload: reset also pulled in children + +commit 3c7a5707160c8689dde391b250f51a412da82105 +Author: Karol Mroz <[email protected]> +Date: Tue Jul 15 12:00:54 2014 +0200 + + fsm: ensure masterdev has a config node before trying to add children + +commit bda7ee1ba82c2f0914f035395326c221065e80a4 +Author: Pawel Wieczorkiewicz <[email protected]> +Date: Tue Jul 15 11:42:59 2014 +0200 + + fsm: Do not reset fsm dep. from build hierarchy on reset + +commit 438b5e7a30e1e1c8e16e6939806de2cc231512aa +Author: Pawel Wieczorkiewicz <[email protected]> +Date: Tue Jul 15 11:42:23 2014 +0200 + + fsm: step back, after removing failed worker + commit ec2382c51e826bfdf11fcc11c5dc0bb50b260db5 Author: Marius Tomaschewski <[email protected]> Date: Tue Jul 15 09:41:33 2014 +0200 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.5.34/VERSION new/wicked-0.5.35/VERSION --- old/wicked-0.5.34/VERSION 2014-07-15 09:41:26.000000000 +0200 +++ new/wicked-0.5.35/VERSION 2014-07-18 11:57:30.000000000 +0200 @@ -1 +1 @@ -0.5.34 +0.5.35 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.5.34/client/ifreload.c new/wicked-0.5.35/client/ifreload.c --- old/wicked-0.5.34/client/ifreload.c 2014-07-15 09:41:12.000000000 +0200 +++ new/wicked-0.5.35/client/ifreload.c 2014-07-18 11:55:21.000000000 +0200 @@ -222,7 +222,7 @@ /* skip unused devices without config */ if (!ni_ifcheck_worker_config_exists(w) && !ni_ifcheck_device_configured(dev)) { - ni_info("skipping %s interface: no configuration exists and" + ni_info("skipping %s interface: no configuration exists and " "device is not configured by wicked", w->name); continue; } @@ -293,6 +293,7 @@ ni_debug_application("No interfaces to be brought down\n"); } + ni_fsm_pull_in_children(&up_marked); /* Drop deleted or apply the up range */ ni_fsm_reset_matching_workers(fsm, &up_marked, &up_range, FALSE); @@ -300,7 +301,6 @@ if (up_marked.count) { /* And trigger up */ ni_debug_application("Reloading all changed devices"); - ni_fsm_pull_in_children(&up_marked); if (ni_fsm_start_matching_workers(fsm, &up_marked)) { /* Execute the up run */ if (ni_fsm_schedule(fsm) != 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.5.34/client/ifup.c new/wicked-0.5.35/client/ifup.c --- old/wicked-0.5.34/client/ifup.c 2014-07-15 09:41:12.000000000 +0200 +++ new/wicked-0.5.35/client/ifup.c 2014-07-18 11:55:21.000000000 +0200 @@ -46,48 +46,34 @@ #include "ifup.h" static xml_node_t * -__ni_ifup_generate_match_type_dev(ni_netdev_t *dev, ni_bool_t child) +__ni_ifup_generate_match_dev(xml_node_t *node, ni_ifworker_t *w) { + ni_netdev_t *dev; const char *type; - xml_node_t *ret; - if (!dev || dev->link.type == NI_IFTYPE_UNKNOWN) + if (!node || !w || ni_string_empty(w->name)) return NULL; - if (!(type = ni_linktype_type_to_name(dev->link.type))) - return NULL; - - ret = child ? xml_node_new(NI_NANNY_IFPOLICY_MATCH_COND_CHILD, NULL) : - xml_node_new(NI_NANNY_IFPOLICY_MATCH_COND_AND, NULL); - if (!ret) - return NULL; + /* Conditional <link-type> generation */ + { + /* TODO: the type has to be from config, _not_ from device + * (dev is probably a not ready one just using our name), + * but this info is lost in translation... isn't it? + */ + if (!(dev = w->device) || !ni_string_eq(w->name, dev->name)) + goto skip; + + if (dev->link.type == NI_IFTYPE_UNKNOWN) + goto skip; + + type = ni_linktype_type_to_name(dev->link.type); + if (ni_string_empty(type)) + goto skip; - if (!xml_node_new_element(NI_NANNY_IFPOLICY_MATCH_DEV, ret, dev->name) || - !xml_node_new_element(NI_NANNY_IFPOLICY_MATCH_LINK_TYPE, ret, type)) { - xml_node_free(ret); - return NULL; - } - return ret; -} - -static xml_node_t * -__ni_ifup_generate_match_dev(xml_node_t *node, ni_ifworker_t *w, ni_bool_t child) -{ - if (!node || !w || !w->name) - return NULL; - - /* TODO: the type has to be from config, _not_ from device - * (dev is probably a not ready one just using our name), - * but this info is lost in translation... isn't it? - */ - if (w->device && ni_string_eq(w->name, w->device->name)) { - xml_node_t * ret = NULL; - - if ((ret = __ni_ifup_generate_match_type_dev(w->device, child))) { - xml_node_add_child(node, ret); - return ret; - } + if (!xml_node_new_element(NI_NANNY_IFPOLICY_MATCH_LINK_TYPE, node, type)) + return NULL; /* Error */ } +skip: return xml_node_new_element(NI_NANNY_IFPOLICY_MATCH_DEV, node, w->name); } @@ -96,34 +82,36 @@ __ni_ifup_generate_match(ni_ifworker_t *w) { xml_node_t *match; - unsigned int i; if (!(match = xml_node_new(NI_NANNY_IFPOLICY_MATCH, NULL))) - return NULL; + goto error; - if (!__ni_ifup_generate_match_dev(match, w, FALSE)) { - xml_node_free(match); - return NULL; - } + if (!__ni_ifup_generate_match_dev(match, w)) + goto error; if (w->children.count) { - xml_node_t*or; + xml_node_t *or; + unsigned int i; if (!(or = xml_node_new(NI_NANNY_IFPOLICY_MATCH_COND_OR, match))) - return NULL; + goto error; for (i = 0; i < w->children.count; i++) { ni_ifworker_t *child = w->children.data[i]; + xml_node_t *cnode; - if (!__ni_ifup_generate_match_dev(or, child, TRUE)) { - xml_node_free(match); - return NULL; - } - } + if(!(cnode = xml_node_new(NI_NANNY_IFPOLICY_MATCH_COND_CHILD, or))) + goto error; + if (!__ni_ifup_generate_match_dev(cnode, child)) + goto error; + } } return match; +error: + xml_node_free(match); + return NULL; } static ni_bool_t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.5.34/configure new/wicked-0.5.35/configure --- old/wicked-0.5.34/configure 2014-07-15 09:45:22.000000000 +0200 +++ new/wicked-0.5.35/configure 2014-07-18 12:16:56.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for wicked 0.5.34. +# Generated by GNU Autoconf 2.69 for wicked 0.5.35. # # Report bugs to <http://bugs.opensuse.org>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='wicked' PACKAGE_TARNAME='wicked' -PACKAGE_VERSION='0.5.34' -PACKAGE_STRING='wicked 0.5.34' +PACKAGE_VERSION='0.5.35' +PACKAGE_STRING='wicked 0.5.35' PACKAGE_BUGREPORT='http://bugs.opensuse.org' PACKAGE_URL='https://github.com/openSUSE/wicked' @@ -1378,7 +1378,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures wicked 0.5.34 to adapt to many kinds of systems. +\`configure' configures wicked 0.5.35 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1448,7 +1448,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of wicked 0.5.34:";; + short | recursive ) echo "Configuration of wicked 0.5.35:";; esac cat <<\_ACEOF @@ -1598,7 +1598,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -wicked configure 0.5.34 +wicked configure 0.5.35 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2197,7 +2197,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by wicked $as_me 0.5.34, which was +It was created by wicked $as_me 0.5.35, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3060,7 +3060,7 @@ # Define the identity of the package. PACKAGE='wicked' - VERSION='0.5.34' + VERSION='0.5.35' cat >>confdefs.h <<_ACEOF @@ -14784,7 +14784,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by wicked $as_me 0.5.34, which was +This file was extended by wicked $as_me 0.5.35, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14851,7 +14851,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -wicked config.status 0.5.34 +wicked config.status 0.5.35 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.5.34/dhcp4/protocol.c new/wicked-0.5.35/dhcp4/protocol.c --- old/wicked-0.5.34/dhcp4/protocol.c 2014-07-15 04:12:01.000000000 +0200 +++ new/wicked-0.5.35/dhcp4/protocol.c 2014-07-18 11:55:21.000000000 +0200 @@ -1282,6 +1282,26 @@ return guess_prefix_len(ap->sin.sin_addr); } +static inline unsigned int +guess_default_maskbits(struct in_addr addr) +{ + uint32_t prefix = ntohl(addr.s_addr); + + if (IN_CLASSA(prefix)) + return 8; + if (IN_CLASSB(prefix)) + return 16; + if (IN_CLASSC(prefix)) + return 24; + return 32; +} + +static inline in_addr_t +cidr_to_netmask(unsigned int pfxlen) +{ + return pfxlen ? htonl(~((1<<(32-pfxlen))-1)) : 0U; +} + /* * DHCP4_STATICROUTE * List of network/gateway pairs. @@ -1458,6 +1478,70 @@ return -1; } +void +ni_dhcp4_apply_routes(ni_addrconf_lease_t *lease, ni_route_array_t *routes) +{ + ni_route_array_t temp = NI_ROUTE_ARRAY_INIT; + ni_route_t *rp, *r; + ni_address_t *ap; + unsigned int i, j; + + if (!lease || !routes) + return; + + /* apply device routes first (if any) */ + for (i = 0; i < routes->count; ++i) { + if (!(rp = routes->data[i])) + continue; + if (ni_sockaddr_is_specified(&rp->nh.gateway)) + continue; + ni_route_array_append(&temp, ni_route_ref(rp)); + } + + /* now the routes with a gateway - add a + * device routes as needed / when missed */ + for (i = 0; i < routes->count; ++i) { + ni_bool_t added = FALSE; + + if (!(rp = routes->data[i])) + continue; + if (!ni_sockaddr_is_specified(&rp->nh.gateway)) + continue; + + /* just add, when gateway is on the same net as IP */ + for (ap = lease->addrs; !added && ap; ap = ap->next) { + if (!ni_address_can_reach(ap, &rp->nh.gateway)) + continue; + ni_route_array_append(&temp, ni_route_ref(rp)); + added = TRUE; + } + /* or there is a device route allowing to reach it */ + for (j = 0; !added && j < temp.count; ++j) { + if (!(r = temp.data[j])) + continue; + if (ni_sockaddr_is_specified(&r->nh.gateway)) + continue; + + if (!ni_sockaddr_prefix_match(r->prefixlen, + &r->destination, + &rp->nh.gateway)) + continue; + ni_route_array_append(&temp, ni_route_ref(rp)); + added = TRUE; + } + + /* otherwise, automatically prepend a device route */ + if (!added) { + unsigned int len = ni_af_address_length(rp->family); + r = ni_route_create(len * 8, &rp->nh.gateway, NULL, 0, NULL); + ni_route_array_append(&temp, r); + ni_route_array_append(&temp, ni_route_ref(rp)); + } + } + ni_route_tables_add_routes(&lease->routes, &temp); + ni_route_array_destroy(&temp); +} + /* * Parse a DHCP4 response. * FIXME: RFC2131 states that the server is allowed to split a DHCP4 option into @@ -1482,6 +1566,7 @@ int msg_type = -1; int use_bootserver = 1; int use_bootfile = 1; + unsigned int pfxlen; lease = ni_addrconf_lease_new(NI_ADDRCONF_DHCP, AF_INET); @@ -1744,23 +1829,47 @@ } /* Fill in any missing fields */ - if (!lease->dhcp4.netmask.s_addr) { - unsigned int pfxlen = guess_prefix_len(lease->dhcp4.address); + if (lease->dhcp4.netmask.s_addr) { + ni_sockaddr_t mask; - lease->dhcp4.netmask.s_addr = htonl(~(0xFFFFFFFF >> pfxlen)); + ni_sockaddr_set_ipv4(&mask, lease->dhcp4.netmask, 0); + if (!(pfxlen = ni_sockaddr_netmask_bits(&mask))) + pfxlen = 32; + } else { + pfxlen = guess_default_maskbits(lease->dhcp4.address); + lease->dhcp4.netmask.s_addr = cidr_to_netmask(pfxlen); + + ni_debug_verbose(NI_LOG_DEBUG1, NI_TRACE_DHCP, + "guessed netmask: %s, cidr: %u", + inet_ntoa(lease->dhcp4.netmask), pfxlen); } if (!lease->dhcp4.broadcast.s_addr) { - lease->dhcp4.broadcast.s_addr = lease->dhcp4.address.s_addr | ~lease->dhcp4.netmask.s_addr; + lease->dhcp4.broadcast.s_addr = lease->dhcp4.address.s_addr | + ~lease->dhcp4.netmask.s_addr; + } + if (lease->dhcp4.address.s_addr) { + ni_sockaddr_t local_addr; + ni_address_t *ap; + + memset(&local_addr, 0, sizeof(local_addr)); + local_addr.sin.sin_family = AF_INET; + local_addr.sin.sin_addr = lease->dhcp4.address; + ap = ni_address_new(AF_INET, pfxlen, &local_addr, &lease->addrs); + if (ap) { + memset(&ap->bcast_addr, 0, sizeof(ap->bcast_addr)); + ap->bcast_addr.sin.sin_family = AF_INET; + ap->bcast_addr.sin.sin_addr = lease->dhcp4.broadcast; + } } if (classless_routes.count) { - /* CSR and MSCSR take precedence over static routes */ - ni_route_tables_add_routes(&lease->routes, &classless_routes); + /* if CSR or MSCSR are available, ignore other routes */ + ni_dhcp4_apply_routes(lease, &classless_routes); ni_route_array_destroy(&classless_routes); } else { - ni_route_tables_add_routes(&lease->routes, &static_routes); + ni_dhcp4_apply_routes(lease, &static_routes); ni_route_array_destroy(&static_routes); - ni_route_tables_add_routes(&lease->routes, &default_routes); + ni_dhcp4_apply_routes(lease, &default_routes); ni_route_array_destroy(&default_routes); } @@ -1791,23 +1900,6 @@ lease->nis = nis; } - if (lease->dhcp4.address.s_addr) { - ni_sockaddr_t local_addr; - ni_address_t *ap; - - memset(&local_addr, 0, sizeof(local_addr)); - local_addr.sin.sin_family = AF_INET; - local_addr.sin.sin_addr = lease->dhcp4.address; - ap = ni_address_new(AF_INET, - __count_net_bits(ntohl(lease->dhcp4.netmask.s_addr)), - &local_addr, &lease->addrs); - if (ap) { - memset(&ap->bcast_addr, 0, sizeof(ap->bcast_addr)); - ap->bcast_addr.sin.sin_family = AF_INET; - ap->bcast_addr.sin.sin_addr = lease->dhcp4.broadcast; - } - } - *leasep = lease; lease = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.5.34/src/ethernet.c new/wicked-0.5.35/src/ethernet.c --- old/wicked-0.5.34/src/ethernet.c 2014-06-27 16:47:32.000000000 +0200 +++ new/wicked-0.5.35/src/ethernet.c 2014-07-18 11:55:21.000000000 +0200 @@ -15,6 +15,53 @@ #include "util_priv.h" #include "kernel.h" +#define ALL_ADVERTISED_MODES \ + (ADVERTISED_10baseT_Half | \ + ADVERTISED_10baseT_Full | \ + ADVERTISED_100baseT_Half | \ + ADVERTISED_100baseT_Full | \ + ADVERTISED_1000baseT_Half | \ + ADVERTISED_1000baseT_Full | \ + ADVERTISED_2500baseX_Full | \ + ADVERTISED_10000baseKX4_Full | \ + ADVERTISED_10000baseKR_Full | \ + ADVERTISED_10000baseR_FEC | \ + ADVERTISED_20000baseMLD2_Full | \ + ADVERTISED_20000baseKR2_Full | \ + ADVERTISED_40000baseKR4_Full | \ + ADVERTISED_40000baseCR4_Full | \ + ADVERTISED_40000baseSR4_Full | \ + ADVERTISED_40000baseLR4_Full) + +#define ALL_ADVERTISED_FLAGS \ + (ADVERTISED_10baseT_Half | \ + ADVERTISED_10baseT_Full | \ + ADVERTISED_100baseT_Half | \ + ADVERTISED_100baseT_Full | \ + ADVERTISED_1000baseT_Half | \ + ADVERTISED_1000baseT_Full | \ + ADVERTISED_Autoneg | \ + ADVERTISED_TP | \ + ADVERTISED_AUI | \ + ADVERTISED_MII | \ + ADVERTISED_FIBRE | \ + ADVERTISED_BNC | \ + ADVERTISED_10000baseT_Full | \ + ADVERTISED_Pause | \ + ADVERTISED_Asym_Pause | \ + ADVERTISED_2500baseX_Full | \ + ADVERTISED_Backplane | \ + ADVERTISED_1000baseKX_Full | \ + ADVERTISED_10000baseKX4_Full | \ + ADVERTISED_10000baseKR_Full | \ + ADVERTISED_10000baseR_FEC | \ + ADVERTISED_20000baseMLD2_Full | \ + ADVERTISED_20000baseKR2_Full | \ + ADVERTISED_40000baseKR4_Full | \ + ADVERTISED_40000baseCR4_Full | \ + ADVERTISED_40000baseSR4_Full | \ + ADVERTISED_40000baseLR4_Full) + static int __ni_system_ethernet_get(const char *, ni_ethernet_t *); static int __ni_system_ethernet_set(const char *, const ni_ethernet_t *); @@ -354,18 +401,16 @@ ether->link_speed = ethtool_cmd_speed(&ecmd); mapped = __ni_ethtool_to_wicked(__ni_ethtool_duplex_map, ecmd.duplex); - if (mapped < 0) { + if (mapped < 0) ni_warn("%s: unknown duplex setting %d", ifname, ecmd.duplex); - } else { + else ether->duplex = mapped; - } mapped = __ni_ethtool_to_wicked(__ni_ethtool_port_map, ecmd.port); - if (mapped < 0) { + if (mapped < 0) ni_warn("%s: unknown port setting %d", ifname, ecmd.port); - } else { + else ether->port_type = mapped; - } ether->autoneg_enable = (ecmd.autoneg? NI_TRISTATE_ENABLE : NI_TRISTATE_DISABLE); @@ -420,6 +465,67 @@ return __ni_system_ethernet_refresh(dev); } +/* + * Based on ecmd.speed and ecmd.duplex, determine ecmd.advertising. + */ +static void +__ni_system_ethernet_set_advertising(const char *ifname, struct ethtool_cmd *ecmd) +{ + if (!ecmd) + return; + + if (ecmd->speed == SPEED_10 && ecmd->duplex == DUPLEX_HALF) + ecmd->advertising = ADVERTISED_10baseT_Half; + else if (ecmd->speed == SPEED_10 && + ecmd->duplex == DUPLEX_FULL) + ecmd->advertising = ADVERTISED_10baseT_Full; + else if (ecmd->speed == SPEED_100 && + ecmd->duplex == DUPLEX_HALF) + ecmd->advertising = ADVERTISED_100baseT_Half; + else if (ecmd->speed == SPEED_100 && + ecmd->duplex == DUPLEX_FULL) + ecmd->advertising = ADVERTISED_100baseT_Full; + else if (ecmd->speed == SPEED_1000 && + ecmd->duplex == DUPLEX_HALF) + ecmd->advertising = ADVERTISED_1000baseT_Half; + else if (ecmd->speed == SPEED_1000 && + ecmd->duplex == DUPLEX_FULL) + ecmd->advertising = ADVERTISED_1000baseT_Full; + else if (ecmd->speed == SPEED_2500 && + ecmd->duplex == DUPLEX_FULL) + ecmd->advertising = ADVERTISED_2500baseX_Full; + else if (ecmd->speed == SPEED_10000 && + ecmd->duplex == DUPLEX_FULL) + ecmd->advertising = ADVERTISED_10000baseT_Full; + else + /* auto negotiate without forcing, + * all supported speeds will be assigned below + */ + ecmd->advertising = 0; + + if (ecmd->autoneg && ecmd->advertising == 0) { + /* Auto negotiation enabled, but with + * unspecified speed and duplex: enable all + * supported speeds and duplexes. + */ + ecmd->advertising = (ecmd->advertising & + ~ALL_ADVERTISED_MODES) | + (ALL_ADVERTISED_MODES & + ecmd->supported); + /* If driver supports unknown flags, we cannot + * be sure that we enable all link modes. + */ + if ((ecmd->supported & ALL_ADVERTISED_FLAGS) != ecmd->supported) { + ni_error("%s: Driver supports one or more unknown flags", + ifname); + } + } else if (ecmd->advertising > 0) { + /* Enable all requested modes. */ + ecmd->advertising = (ecmd->advertising & ~ALL_ADVERTISED_MODES) | + ecmd->advertising; + } +} + int __ni_system_ethernet_set(const char *ifname, const ni_ethernet_t *ether) { @@ -443,7 +549,7 @@ if (ether->duplex != NI_ETHERNET_DUPLEX_DEFAULT) { mapped = __ni_wicked_to_ethtool(__ni_ethtool_duplex_map, ether->duplex); if (mapped >= 0) - ecmd.port = mapped; + ecmd.duplex = mapped; } if (ether->port_type != NI_ETHERNET_PORT_DEFAULT) { @@ -486,5 +592,13 @@ __ni_ethtool_set_value(ifname, &__ethtool_sflags, value); } + __ni_system_ethernet_set_advertising(ifname, &ecmd); + + if (__ni_ethtool(ifname, ETHTOOL_SSET, &ecmd) < 0) { + if (errno != EOPNOTSUPP) + ni_error("%s: ETHTOOL_SSET failed: %m", ifname); + return -1; + } + return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.5.34/src/fsm.c new/wicked-0.5.35/src/fsm.c --- old/wicked-0.5.34/src/fsm.c 2014-07-15 09:41:12.000000000 +0200 +++ new/wicked-0.5.35/src/fsm.c 2014-07-18 11:55:21.000000000 +0200 @@ -139,6 +139,25 @@ w->kickstarted = FALSE; } +static void +__ni_ifworker_reset_fsm(ni_ifworker_t *w) +{ + if (!w) + return; + + if (w->fsm.action_table) { + ni_fsm_transition_t *action; + + for (action = w->fsm.action_table; action->next_state; action++) + ni_fsm_require_list_destroy(&action->require.list); + free(w->fsm.action_table); + } + w->fsm.action_table = NULL; + + ni_fsm_require_list_destroy(&w->fsm.child_state_req_list); + memset(&w->fsm, 0, sizeof(w->fsm)); +} + void ni_ifworker_reset(ni_ifworker_t *w) { @@ -166,23 +185,13 @@ ni_ifworker_array_destroy(&w->children); ni_ifworker_array_destroy(&w->lowerdev_for); - if (w->fsm.action_table) { - ni_fsm_transition_t *action; - - for (action = w->fsm.action_table; action->next_state; action++) - ni_fsm_require_list_destroy(&action->require.list); - free(w->fsm.action_table); - } - w->fsm.action_table = NULL; - w->target_state = NI_FSM_STATE_NONE; w->target_range.min = NI_FSM_STATE_NONE; w->target_range.max = __NI_FSM_STATE_MAX; ni_ifworker_cancel_timeout(w); - ni_fsm_require_list_destroy(&w->fsm.child_state_req_list); - memset(&w->fsm, 0, sizeof(w->fsm)); + __ni_ifworker_reset_fsm(w); memset(&w->device_api, 0, sizeof(w->device_api)); w->failed = FALSE; @@ -355,7 +364,7 @@ va_end(ap); ni_error("device %s failed: %s", w->name, errmsg); - memset(&w->fsm, 0, sizeof(w->fsm)); + w->fsm.state = NI_FSM_STATE_NONE; w->failed = TRUE; w->pending = FALSE; @@ -980,6 +989,11 @@ if (shared) { /* The reference allows sharing with other uses, e.g. VLANs. */ if (parent->lowerdev) { + if (xml_node_is_empty(parent->lowerdev->config.node)) { + ni_error("%s (%s): subordinate interface's lowerdev %s has no config node", + parent->name, xml_node_location(devnode), parent->lowerdev->name); + return FALSE; + } other_owner = strdup(xml_node_location(parent->lowerdev->config.node)); ni_debug_application("%s (%s): subordinate interface already has lowerdev %s (%s)", parent->name, xml_node_location(devnode), @@ -995,6 +1009,11 @@ } else { if (child->masterdev) { + if (xml_node_is_empty(child->masterdev->config.node)) { + ni_error("%s (%s): subordinate interface's master device %s has no config node", + child->name, xml_node_location(devnode), child->masterdev->name); + return FALSE; + } other_owner = strdup(xml_node_location(child->masterdev->config.node)); ni_debug_application("%s (%s): subordinate interface already has masterdev %s (%s)", child->name, xml_node_location(devnode), @@ -2182,8 +2201,11 @@ continue; } - if (ni_ifworker_array_index(array, child) < 0) + if (ni_ifworker_array_index(array, child) < 0) { + if (ni_ifworker_complete(child)) + ni_ifworker_rearm(child); ni_ifworker_array_append(array, child); + } __ni_fsm_pull_in_children(child, array); } } @@ -2300,20 +2322,7 @@ w->target_range.max = __NI_FSM_STATE_MAX; } - if (w->fsm.action_table) { - ni_fsm_transition_t *action; - - for (action = w->fsm.action_table; action->next_state; action++) - ni_fsm_require_list_destroy(&action->require.list); - free(w->fsm.action_table); - w->fsm.action_table = NULL; - } - ni_ifworker_cancel_timeout(w); - - ni_fsm_require_list_destroy(&w->fsm.child_state_req_list); - - memset(&w->fsm, 0, sizeof(w->fsm)); } } @@ -2636,6 +2645,7 @@ if (-NI_ERROR_DOCUMENT_ERROR == rv) ni_debug_application("%s: configuration failed", w->name); ni_fsm_destroy_worker(fsm, w); + i--; } continue; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.5.34/src/ifconfig.c new/wicked-0.5.35/src/ifconfig.c --- old/wicked-0.5.34/src/ifconfig.c 2014-07-15 04:12:01.000000000 +0200 +++ new/wicked-0.5.35/src/ifconfig.c 2014-07-18 11:55:21.000000000 +0200 @@ -2014,6 +2014,7 @@ } if (ap->bcast_addr.ss_family != AF_UNSPEC + && !ni_sockaddr_equal(&ap->bcast_addr, &ap->local_addr) && addattr_sockaddr(msg, IFA_BROADCAST, &ap->bcast_addr) < 0) goto nla_put_failure; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.5.34/src/iflist.c new/wicked-0.5.35/src/iflist.c --- old/wicked-0.5.34/src/iflist.c 2014-07-15 09:41:12.000000000 +0200 +++ new/wicked-0.5.35/src/iflist.c 2014-07-18 11:55:21.000000000 +0200 @@ -604,6 +604,143 @@ return retval; } +static void +__ni_process_ifinfomsg_linktype(ni_linkinfo_t *link, const char *ifname) +{ + ni_iftype_t tmp_link_type = NI_IFTYPE_UNKNOWN; + struct ethtool_drvinfo drv_info; + const char *driver = NULL; + char *path = NULL; + const char *base; + + /* Try to get linktype from kind string. */ + if (!__ni_linkinfo_kind_to_type(link->kind, &tmp_link_type)) + ni_debug_verbose(NI_LOG_DEBUG2, NI_TRACE_IFCONFIG, + "%s: unknown link-info kind: %s", ifname, link->kind); + + switch (tmp_link_type) { + case NI_IFTYPE_TUN: + /* link->kind from IFLA_LINKINFO is always 'tun' for both tun + * and tap device. Need this additional check to distinguish. + */ + if (link->hwaddr.type == ARPHRD_ETHER) + tmp_link_type = NI_IFTYPE_TAP; + break; + + case NI_IFTYPE_UNKNOWN: + switch (link->hwaddr.type) { + case ARPHRD_LOOPBACK: + tmp_link_type = NI_IFTYPE_LOOPBACK; + + break; + + case ARPHRD_ETHER: + /* We're at the very least an ethernet. */ + tmp_link_type = NI_IFTYPE_ETHERNET; + + /* + * Try to detect if this is a WLAN device. + * The official way of doing this is to check whether + * ioctl(SIOCGIWNAME) succeeds. + */ + if (__ni_wireless_get_name(ifname, NULL, 0) == 0) + tmp_link_type = NI_IFTYPE_WIRELESS; + + memset(&drv_info, 0, sizeof(drv_info)); + if (__ni_ethtool(ifname, ETHTOOL_GDRVINFO, &drv_info) >= 0) { + driver = drv_info.driver; + if (!strcmp(driver, "tun")) { + if (!strcmp(drv_info.bus_info, "tap")) + tmp_link_type = NI_IFTYPE_TAP; + else + tmp_link_type = NI_IFTYPE_TUN; + } else if (!strcmp(driver, "bridge")) { + tmp_link_type = NI_IFTYPE_BRIDGE; + } else if (!strcmp(driver, "bonding")) { + tmp_link_type = NI_IFTYPE_BOND; + } else if (!strcmp(driver, "802.1Q VLAN Support")) { + tmp_link_type = NI_IFTYPE_VLAN; + } + } + + break; + + case ARPHRD_INFINIBAND: + if (ni_sysfs_netif_exists(ifname, "parent")) + tmp_link_type = NI_IFTYPE_INFINIBAND_CHILD; + else + tmp_link_type = NI_IFTYPE_INFINIBAND; + + break; + + case ARPHRD_SLIP: + /* s390 ctc devices on ctcm + iucv? */ + if (ni_sysfs_netif_readlink(ifname, "device/subsystem", &path)) { + base = ni_basename(path); + if (ni_string_eq(base, "ccwgroup")) + tmp_link_type = NI_IFTYPE_CTCM; + else + if (ni_string_eq(base, "iucv")) + tmp_link_type = NI_IFTYPE_IUCV; + ni_string_free(&path); + } + + break; + + case ARPHRD_SIT: + tmp_link_type = NI_IFTYPE_SIT; + + break; + + case ARPHRD_IPGRE: + tmp_link_type = NI_IFTYPE_GRE; + + break; + + case ARPHRD_TUNNEL: + tmp_link_type = NI_IFTYPE_IPIP; + + break; + + case ARPHRD_TUNNEL6: + tmp_link_type = NI_IFTYPE_TUNNEL6; + + break; + + default: + break; + } + + break; + + default: + break; + } + + /* We only want to perform any assignments to link->type if it has not + * yet been touched. + */ + if (link->type == NI_IFTYPE_UNKNOWN) { + if (tmp_link_type == NI_IFTYPE_UNKNOWN) { + /* We've failed to discover a link type, leave as is. */ + ni_debug_ifconfig("%s: Failed to discover link type, arp type is 0x%x, kind %s", + ifname, link->hwaddr.type, link->kind); + } else { + /* Our link has no type yet, so let's assign. */ + ni_debug_verbose(NI_LOG_DEBUG2, NI_TRACE_IFCONFIG, + "%s: Setting interface link type to %s", + ifname, ni_linktype_type_to_name(tmp_link_type)); + link->type = tmp_link_type; + } + } else + if (link->type != tmp_link_type) { + /* We're trying to re-assign a link type, Disallow. */ + ni_error("%s: Ignoring attempt to reset existing interface link type from %s to %s", + ifname, ni_linktype_type_to_name(link->type), + ni_linktype_type_to_name(tmp_link_type)); + } +} + /* * Refresh interface link layer given a parsed RTM_NEWLINK message attrs */ @@ -612,10 +749,9 @@ struct nlattr **tb, struct nlmsghdr *h, struct ifinfomsg *ifi, ni_netconfig_t *nc) { - ni_iftype_t tmp_link_type = NI_IFTYPE_UNKNOWN; - link->hwaddr.type = link->hwpeer.type = ifi->ifi_type; link->ifflags = __ni_netdev_translate_ifflags(ifi->ifi_flags, link->ifflags); + switch (link->hwaddr.type) { case ARPHRD_LOOPBACK: link->ifflags |= NI_IFF_DEVICE_READY; @@ -747,126 +883,11 @@ ni_debug_verbose(NI_LOG_DEBUG2, NI_TRACE_IFCONFIG, "%s: extended link-info without kind", ifname); - } else - if (!__ni_linkinfo_kind_to_type(link->kind, &tmp_link_type)) { - ni_debug_verbose(NI_LOG_DEBUG2, NI_TRACE_IFCONFIG, - "%s: unknown link-info kind: %s", ifname, link->kind); - } - } - - /* If link type is still unknown, try to determine based on arp type. */ - struct ethtool_drvinfo drv_info; - const char *driver = NULL; - char *path = NULL; - const char *base; - - if (tmp_link_type == NI_IFTYPE_UNKNOWN) { - switch (link->hwaddr.type) { - case ARPHRD_LOOPBACK: - tmp_link_type = NI_IFTYPE_LOOPBACK; - - break; - - case ARPHRD_ETHER: - /* We're at the very least an ethernet. */ - tmp_link_type = NI_IFTYPE_ETHERNET; - - /* - * Try to detect if this is a WLAN device. - * The official way of doing this is to check whether - * ioctl(SIOCGIWNAME) succeeds. - */ - if (__ni_wireless_get_name(ifname, NULL, 0) == 0) - tmp_link_type = NI_IFTYPE_WIRELESS; - - memset(&drv_info, 0, sizeof(drv_info)); - if (__ni_ethtool(ifname, ETHTOOL_GDRVINFO, &drv_info) >= 0) { - driver = drv_info.driver; - if (!strcmp(driver, "tun")) { - if (!strcmp(drv_info.bus_info, "tap")) - tmp_link_type = NI_IFTYPE_TAP; - else - tmp_link_type = NI_IFTYPE_TUN; - } else if (!strcmp(driver, "bridge")) { - tmp_link_type = NI_IFTYPE_BRIDGE; - } else if (!strcmp(driver, "bonding")) { - tmp_link_type = NI_IFTYPE_BOND; - } else if (!strcmp(driver, "802.1Q VLAN Support")) { - tmp_link_type = NI_IFTYPE_VLAN; - } - } - - break; - - case ARPHRD_INFINIBAND: - if (ni_sysfs_netif_exists(ifname, "parent")) - tmp_link_type = NI_IFTYPE_INFINIBAND_CHILD; - else - tmp_link_type = NI_IFTYPE_INFINIBAND; - - break; - - case ARPHRD_SLIP: - /* s390 ctc devices on ctcm + iucv? */ - if (ni_sysfs_netif_readlink(ifname, "device/subsystem", &path)) { - base = ni_basename(path); - if (ni_string_eq(base, "ccwgroup")) - tmp_link_type = NI_IFTYPE_CTCM; - else - if (ni_string_eq(base, "iucv")) - tmp_link_type = NI_IFTYPE_IUCV; - ni_string_free(&path); - } - - break; - - case ARPHRD_SIT: - tmp_link_type = NI_IFTYPE_SIT; - - break; - - case ARPHRD_IPGRE: - tmp_link_type = NI_IFTYPE_GRE; - - break; - - case ARPHRD_TUNNEL: - tmp_link_type = NI_IFTYPE_IPIP; - - break; - - case ARPHRD_TUNNEL6: - tmp_link_type = NI_IFTYPE_TUNNEL6; - - break; - - default: - break; } } - /* We only want to perform any assignments to link->type if it has not - * yet been touched. - */ - if (link->type == NI_IFTYPE_UNKNOWN) { - if (tmp_link_type == NI_IFTYPE_UNKNOWN) { - /* We've failed to discover a link type, leave as is. */ - ni_debug_ifconfig("%s: Failed to discover link type, arp type is 0x%x, kind %s", - ifname, link->hwaddr.type, link->kind); - } else { - /* Our link has no type yet, so let's assign. */ - ni_debug_verbose(NI_LOG_DEBUG2, NI_TRACE_IFCONFIG, - "%s: Setting interface link type to %s", - ifname, ni_linktype_type_to_name(tmp_link_type)); - link->type = tmp_link_type; - } - } else - if (link->type != tmp_link_type) { - /* We're trying to re-assign a link type, Disallow. */ - ni_error("%s: Ignoring attempt to reset existing interface link type from %s to %s", - ifname, ni_linktype_type_to_name(link->type), - ni_linktype_type_to_name(tmp_link_type)); - } + /* Attempt to determine linktype. */ + __ni_process_ifinfomsg_linktype(link, ifname); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.5.34/src/route.c new/wicked-0.5.35/src/route.c --- old/wicked-0.5.34/src/route.c 2014-07-15 04:12:01.000000000 +0200 +++ new/wicked-0.5.35/src/route.c 2014-07-18 11:55:21.000000000 +0200 @@ -177,7 +177,10 @@ rp->family = af; rp->prefixlen = prefixlen; rp->destination = *dest; - rp->nh.gateway = *gw; + if (!ni_sockaddr_is_specified(gw)) + rp->nh.gateway.ss_family = af; + else + rp->nh.gateway = *gw; if (rp->destination.ss_family == AF_UNSPEC) { memset(&rp->destination, 0, sizeof(rp->destination)); rp->destination.ss_family = af; @@ -747,7 +750,7 @@ case RTN_UNICAST: case RTN_UNSPEC: - if (rp->nh.gateway.ss_family == AF_UNSPEC) + if (!ni_sockaddr_is_specified(&rp->nh.gateway)) return RT_SCOPE_LINK; default: ; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wicked-0.5.34/wicked.spec new/wicked-0.5.35/wicked.spec --- old/wicked-0.5.34/wicked.spec 2014-07-15 09:45:28.000000000 +0200 +++ new/wicked-0.5.35/wicked.spec 2014-07-18 12:17:02.000000000 +0200 @@ -18,7 +18,7 @@ %define release_prefix %{?snapshot:%{snapshot}}%{!?snapshot:0} Name: wicked -Version: 0.5.34 +Version: 0.5.35 Release: %{release_prefix}.0.0 Summary: Network configuration infrastructure License: GPL-2.0 -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
