qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@suse.de>
To: pavel@pavlinux.ru, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Random MAC address option
Date: Tue, 27 Jan 2009 11:05:07 +0100	[thread overview]
Message-ID: <497EDC53.1050608@suse.de> (raw)
In-Reply-To: <200901270313.26331.pavel@pavlinux.ru>

Pavel Vasilyev schrieb:
> Index: Makefile.target
> ===================================================================
> --- Makefile.target	(revision 6463)
> +++ Makefile.target	(working copy)
> @@ -580,7 +580,8 @@
>  OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
>  OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
>  OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
> -CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
> +CPPFLAGS += 
> +#-DHAS_AUDIO -DHAS_AUDIO_CHOICE
>  endif
>  ifeq ($(TARGET_BASE_ARCH), ppc)
>  CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
> Index: net.c
> ===================================================================
> --- net.c	(revision 6463)
> +++ net.c	(working copy)
> @@ -122,6 +122,24 @@
>  
>  static VLANState *first_vlan;
>  
> +unsigned long int random_mac_seed(void) {
> +
> +    unsigned long int seed = 0;
> +    int fd;
> +
> +    fd = open("/dev/urandom", O_RDONLY);

How is that supposed to work on Windows? And what's wrong with rand()?

> +    if (fd == -1) {
> +        perror("open");
> +        return 0;
> +    }
> +    if (read(fd, &seed, sizeof (seed)) < 0) {
> +        perror("read");
> +        seed = 0;
> +    }
> +    if (close(fd))
> +        perror("close");
> +    return seed;
> +}
>  /***********************************************************/
>  /* network device redirectors */
>  
> @@ -160,7 +178,7 @@
>      long int offset;
>  
>      errno = 0;
> -    offset = strtol(p, &last_char, 0);    
> +    offset = strtol(p, &last_char, 0);
>      if (0 == errno && '\0' == *last_char &&
>              offset >= 0 && offset <= 0xFFFFFF) {
>          macaddr[3] = (offset & 0xFF0000) >> 16;
> @@ -179,7 +197,7 @@
>                  p++;
>              }
>          }
> -        return 0;    
> +        return 0;
>      }
>  
>      return -1;

I don't think these whitespace changes should be there.

Kevin

  parent reply	other threads:[~2009-01-27  9:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-27  0:13 [Qemu-devel] [PATCH] Random MAC address option Pavel Vasilyev
2009-01-27  0:34 ` [Qemu-devel] [PATCH] Replace strcmp() by strncmp() Pavel Vasilyev
2009-01-27  9:28   ` [Qemu-devel] " Jan Kiszka
2009-01-27 20:49     ` Pavel Vasilyev
2009-01-27 21:20     ` Pavel Vasilyev
2009-01-27  0:57 ` [Qemu-devel] [PATCH] Random MAC address option malc
2009-01-27 10:05 ` Kevin Wolf [this message]
2009-01-27 10:15 ` Riku Voipio
2009-01-27 10:25   ` Daniel P. Berrange
2009-01-27 14:28     ` Ian Jackson
2009-01-27 20:51   ` Pavel Vasilyev
2009-01-27 16:33 ` Paul Brook
2009-01-27 16:47   ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=497EDC53.1050608@suse.de \
    --to=kwolf@suse.de \
    --cc=pavel@pavlinux.ru \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).