Skip to contentSkip to conversation

lguest: two net bugfixes

PATCH In review Rusty Russell 2 participants 3 messages May 8, 2007

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

PATCH 1/1 lguest: two net bugfixes

1) Bridging via host is broken: we need to set "promisc" bit in MAC address published by the host so the guest sends us everything. Thanks James Morris for the report (I don't use bridging).

2) Lguest network device uses 0 to mean "noone at this slot". It used to use 0xFF, and one spot was missed. Minor: it just means we'll have a useless extra transmit for broadcast packets.

---
 Documentation/lguest/lguest.c |    2 ++
 drivers/net/lguest_net.c      |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
Documentation/lguest/lguest.c +4 -0
diff -r 999a9058a151 Documentation/lguest/lguest.c
@@ -860,6 +860,10 @@ static void setup_tun_net(const char *ar
 
 	/* We are peer 0, ie. first slot. */
 	configure_device(ipfd, ifr.ifr_name, ip, dev->mem);
+
+	/* Set "promisc" bit: we want every single packet. */
+	*((u8 *)dev->mem) |= 0x1;
+
 	close(ipfd);
 
 	verbose("device %p: tun net %u.%u.%u.%u\n",
drivers/net/lguest_net.c +1 -1
diff -r 999a9058a151 drivers/net/lguest_net.c
@@ -249,7 +249,7 @@ static int lguestnet_close(struct net_de
 	struct lguestnet_info *info = dev->priv;
 
 	/* Clear all trace: others might deliver packets, we'll ignore it. */
-	memset(&info->peer[info->me], 0xFF, sizeof(info->peer[info->me]));
+	memset(&info->peer[info->me], 0, sizeof(info->peer[info->me]));
 
 	/* Deregister sg lists. */
 	hcall(LHCALL_BIND_DMA, peer_key(info, info->me), __pa(info->dma), 0);
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Rusty Russell

1) Bridging via host is broken: we need to set "promisc" bit in MAC address published by the host so the guest sends us everything. Thanks James Morris for the report (I don't use bridging).

2) Lguest network device uses 0 to mean "noone at this slot". It used to use 0xFF, and one spot was missed. Minor: it just means we'll have a useless extra transmit for broadcast packets.

Quoted 34 lines
---
 Documentation/lguest/lguest.c |    2 ++
 drivers/net/lguest_net.c      |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff -r 999a9058a151 Documentation/lguest/lguest.c

Documentation/lguest/lguest.c +4 -0
@@ -860,6 +860,10 @@ static void setup_tun_net(const char *ar
 
 	/* We are peer 0, ie. first slot. */
 	configure_device(ipfd, ifr.ifr_name, ip, dev->mem);
+
+	/* Set "promisc" bit: we want every single packet. */
+	*((u8 *)dev->mem) |= 0x1;
+
 	close(ipfd);
 
 	verbose("device %p: tun net %u.%u.%u.%u\n",

diff -r 999a9058a151 drivers/net/lguest_net.c

drivers/net/lguest_net.c +1 -1
@@ -249,7 +249,7 @@ static int lguestnet_close(struct net_de
 	struct lguestnet_info *info = dev->priv;
 
 	/* Clear all trace: others might deliver packets, we'll ignore it. */
-	memset(&info->peer[info->me], 0xFF, sizeof(info->peer[info->me]));
+	memset(&info->peer[info->me], 0, sizeof(info->peer[info->me]));
 
 	/* Deregister sg lists. */
 	hcall(LHCALL_BIND_DMA, peer_key(info, info->me), __pa(info->dma), 0);
Signature · 2 lines
James Morris
<[email protected]>
Acked-by on v1 1/1
#2 lore raw
In reply to Rusty Russell
Quoted 9 lines · Rusty Russell

1) Bridging via host is broken: we need to set "promisc" bit in MAC address published by the host so the guest sends us everything. Thanks James Morris for the report (I don't use bridging).

2) Lguest network device uses 0 to mean "noone at this slot". It used to use 0xFF, and one spot was missed. Minor: it just means we'll have a useless extra transmit for broadcast packets.

Quoted 34 lines
---
 Documentation/lguest/lguest.c |    2 ++
 drivers/net/lguest_net.c      |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff -r 999a9058a151 Documentation/lguest/lguest.c

Documentation/lguest/lguest.c +4 -0
@@ -860,6 +860,10 @@ static void setup_tun_net(const char *ar
 
 	/* We are peer 0, ie. first slot. */
 	configure_device(ipfd, ifr.ifr_name, ip, dev->mem);
+
+	/* Set "promisc" bit: we want every single packet. */
+	*((u8 *)dev->mem) |= 0x1;
+
 	close(ipfd);
 
 	verbose("device %p: tun net %u.%u.%u.%u\n",

diff -r 999a9058a151 drivers/net/lguest_net.c

drivers/net/lguest_net.c +1 -1
@@ -249,7 +249,7 @@ static int lguestnet_close(struct net_de
 	struct lguestnet_info *info = dev->priv;
 
 	/* Clear all trace: others might deliver packets, we'll ignore it. */
-	memset(&info->peer[info->me], 0xFF, sizeof(info->peer[info->me]));
+	memset(&info->peer[info->me], 0, sizeof(info->peer[info->me]));
 
 	/* Deregister sg lists. */
 	hcall(LHCALL_BIND_DMA, peer_key(info, info->me), __pa(info->dma), 0);
Signature · 2 lines
James Morris
<[email protected]>