Merge branch 'master' into dhcp-merge
authorDan Winship <danw@redhat.com>
Wed, 19 Nov 2014 17:02:00 +0000 (12:02 -0500)
committerDan Winship <danw@redhat.com>
Wed, 19 Nov 2014 17:02:00 +0000 (12:02 -0500)
Conflicts:
src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c
src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-lease.c
src/dhcp-manager/systemd-dhcp/src/shared/fileio.c
src/dhcp-manager/systemd-dhcp/src/shared/util.c
src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp-client.h
src/dhcp-manager/systemd-dhcp/src/systemd/sd-dhcp-lease.h

12 files changed:
1  2 
src/dhcp-manager/systemd-dhcp/src/libsystemd-network/dhcp6-option.c
src/dhcp-manager/systemd-dhcp/src/libsystemd-network/network-internal.c
src/dhcp-manager/systemd-dhcp/src/libsystemd-network/network-internal.h
src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-client.c
src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp-lease.c
src/dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp6-client.c
src/dhcp-manager/systemd-dhcp/src/shared/fileio.c
src/dhcp-manager/systemd-dhcp/src/shared/in-addr-util.c
src/dhcp-manager/systemd-dhcp/src/shared/strv.c
src/dhcp-manager/systemd-dhcp/src/shared/utf8.c
src/dhcp-manager/systemd-dhcp/src/shared/util.c
src/dhcp-manager/systemd-dhcp/src/shared/util.h

@@@ -25,8 -27,9 +27,9 @@@
  #include <netinet/in.h>
  #include <stdbool.h>
  
+ #if 0 /* NM_IGNORED */
  #include "udev.h"
 -#include "condition-util.h"
 +#include "condition.h"
  
  bool net_match_config(const struct ether_addr *match_mac,
                        const char *match_path,
  
  #include "util.h"
  #include "list.h"
+ #if 0 /* NM_IGNORED */
  #include "mkdir.h"
+ #endif
  #include "fileio.h"
 +#include "unaligned.h"
  #include "in-addr-util.h"
  
  #include "dhcp-protocol.h"
    along with systemd; If not, see <http://www.gnu.org/licenses/>.
  ***/
  
+ #include "config.h"
  #include <unistd.h>
 -#include <sys/sendfile.h>
 -#include "fileio.h"
 +
  #include "util.h"
  #include "strv.h"
  #include "utf8.h"
@@@ -2526,48 -2489,12 +2551,49 @@@ char* dirname_malloc(const char *path) 
  
          return dir;
  }
+ #endif
  
  int dev_urandom(void *p, size_t n) {
 -        _cleanup_close_ int fd = -1;
 +        static int have_syscall = -1;
 +        int r, fd;
          ssize_t k;
  
 +        /* Gathers some randomness from the kernel. This call will
 +         * never block, and will always return some data from the
 +         * kernel, regardless if the random pool is fully initialized
 +         * or not. It thus makes no guarantee for the quality of the
 +         * returned entropy, but is good enough for or usual usecases
 +         * of seeding the hash functions for hashtable */
 +
 +        /* Use the getrandom() syscall unless we know we don't have
 +         * it, or when the requested size is too large for it. */
 +        if (have_syscall != 0 || (size_t) (int) n != n) {
 +                r = getrandom(p, n, GRND_NONBLOCK);
 +                if (r == (int) n) {
 +                        have_syscall = true;
 +                        return 0;
 +                }
 +
 +                if (r < 0) {
 +                        if (errno == ENOSYS)
 +                                /* we lack the syscall, continue with
 +                                 * reading from /dev/urandom */
 +                                have_syscall = false;
 +                        else if (errno == EAGAIN)
 +                                /* not enough entropy for now. Let's
 +                                 * remember to use the syscall the
 +                                 * next time, again, but also read
 +                                 * from /dev/urandom for now, which
 +                                 * doesn't care about the current
 +                                 * amount of entropy.  */
 +                                have_syscall = true;
 +                        else
 +                                return -errno;
 +                } else
 +                        /* too short read? */
 +                        return -EIO;
 +        }
 +
          fd = open("/dev/urandom", O_RDONLY|O_CLOEXEC|O_NOCTTY);
          if (fd < 0)
                  return errno == ENOENT ? -ENOSYS : -errno;