Skip to contentSkip to conversation

Ensure local assignment bit on tun device MAC addr

PATCH In review Rusty Russell 2 participants 2 messages Mar 31, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Ensure local assignment bit on tun device MAC addr

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: <[email protected]>)

==
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.

drivers/net/tun.c +1 -3
diff -r fd8c40f4f533 drivers/net/tun.c
@@ -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);
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Rusty Russell

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: <[email protected]>)

==
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.

Quoted 22 lines

diff -r fd8c40f4f533 drivers/net/tun.c

drivers/net/tun.c +1 -4
@@ -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);
 
 
-

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
James Morris
<[email protected]>