Netdev List
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>
Subject: [PATCH] Ensure local assignment bit on tun device MAC addr
Date: Sat, 31 Mar 2007 10:49:12 +1000	[thread overview]
Message-ID: <1175302152.12230.414.camel@localhost.localdomain> (raw)

This becomes especially important after the tun patch sitting in the -mm
tree is applied, but it works standalone.  Please apply.  (See netdev
posting Message-Id: <200703270550.l2R5o0Mh008378@shell0.pdx.osdl.net>)

==
The effect of this bug was made worse by Brian Braunstein's patch to keep
net_device.dev_addr and tun.dev_addr in sync.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff -r fd8c40f4f533 drivers/net/tun.c
--- a/drivers/net/tun.c	Fri Mar 30 17:02:19 2007 +1000
+++ b/drivers/net/tun.c	Sat Mar 31 10:30:47 2007 +1000
@@ -507,9 +507,7 @@ static int tun_set_iff(struct file *file
 		tun->flags = flags;
 		/* Be promiscuous by default to maintain previous behaviour. */
 		tun->if_flags = IFF_PROMISC;
-		/* Generate random Ethernet address. */
-		*(u16 *)tun->dev_addr = htons(0x00FF);
-		get_random_bytes(tun->dev_addr + sizeof(u16), 4);
+		random_ether_addr(tun->dev_addr);
 		memset(tun->chr_filter, 0, sizeof tun->chr_filter);
 
 		tun_net_init(dev);



             reply	other threads:[~2007-03-31  0:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-31  0:49 Rusty Russell [this message]
2007-03-31  1:03 ` [PATCH] Ensure local assignment bit on tun device MAC addr James Morris

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=1175302152.12230.414.camel@localhost.localdomain \
    --to=rusty@rustcorp.com.au \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.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