diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-08-12 18:52:51 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-08-12 03:52:52 -0400 |
commit | 40c42076ebd362dc69210cccea101ac80b6d4bd4 (patch) | |
tree | 01336076f45eb008f00940a5df86b5970b8d92d0 /Documentation/lguest/lguest.c | |
parent | 10fec20ef5eec1c91913baec1225400f0d02df40 (diff) |
lguest: don't set MAC address for guest unless specified
This shows up when trying to bridge:
tap0: received packet with own address as source address
As Max Krasnyansky points out, there's no reason to give the guest the
same mac address as the TUN device.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Max Krasnyansky <maxk@qualcomm.com>
Diffstat (limited to 'Documentation/lguest/lguest.c')
-rw-r--r-- | Documentation/lguest/lguest.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index b88b0ea54e90..655414821edc 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
@@ -1447,21 +1447,6 @@ static void configure_device(int fd, const char *tapif, u32 ipaddr) | |||
1447 | err(1, "Bringing interface %s up", tapif); | 1447 | err(1, "Bringing interface %s up", tapif); |
1448 | } | 1448 | } |
1449 | 1449 | ||
1450 | static void get_mac(int fd, const char *tapif, unsigned char hwaddr[6]) | ||
1451 | { | ||
1452 | struct ifreq ifr; | ||
1453 | |||
1454 | memset(&ifr, 0, sizeof(ifr)); | ||
1455 | strcpy(ifr.ifr_name, tapif); | ||
1456 | |||
1457 | /* SIOC stands for Socket I/O Control. G means Get (vs S for Set | ||
1458 | * above). IF means Interface, and HWADDR is hardware address. | ||
1459 | * Simple! */ | ||
1460 | if (ioctl(fd, SIOCGIFHWADDR, &ifr) != 0) | ||
1461 | err(1, "getting hw address for %s", tapif); | ||
1462 | memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, 6); | ||
1463 | } | ||
1464 | |||
1465 | static int get_tun_device(char tapif[IFNAMSIZ]) | 1450 | static int get_tun_device(char tapif[IFNAMSIZ]) |
1466 | { | 1451 | { |
1467 | struct ifreq ifr; | 1452 | struct ifreq ifr; |
@@ -1531,11 +1516,8 @@ static void setup_tun_net(char *arg) | |||
1531 | p = strchr(arg, ':'); | 1516 | p = strchr(arg, ':'); |
1532 | if (p) { | 1517 | if (p) { |
1533 | str2mac(p+1, conf.mac); | 1518 | str2mac(p+1, conf.mac); |
1519 | add_feature(dev, VIRTIO_NET_F_MAC); | ||
1534 | *p = '\0'; | 1520 | *p = '\0'; |
1535 | } else { | ||
1536 | p = arg + strlen(arg); | ||
1537 | /* None supplied; query the randomly assigned mac. */ | ||
1538 | get_mac(ipfd, tapif, conf.mac); | ||
1539 | } | 1521 | } |
1540 | 1522 | ||
1541 | /* arg is now either an IP address or a bridge name */ | 1523 | /* arg is now either an IP address or a bridge name */ |
@@ -1547,13 +1529,10 @@ static void setup_tun_net(char *arg) | |||
1547 | /* Set up the tun device. */ | 1529 | /* Set up the tun device. */ |
1548 | configure_device(ipfd, tapif, ip); | 1530 | configure_device(ipfd, tapif, ip); |
1549 | 1531 | ||
1550 | /* Tell Guest what MAC address to use. */ | ||
1551 | add_feature(dev, VIRTIO_NET_F_MAC); | ||
1552 | add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY); | 1532 | add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY); |
1553 | /* Expect Guest to handle everything except UFO */ | 1533 | /* Expect Guest to handle everything except UFO */ |
1554 | add_feature(dev, VIRTIO_NET_F_CSUM); | 1534 | add_feature(dev, VIRTIO_NET_F_CSUM); |
1555 | add_feature(dev, VIRTIO_NET_F_GUEST_CSUM); | 1535 | add_feature(dev, VIRTIO_NET_F_GUEST_CSUM); |
1556 | add_feature(dev, VIRTIO_NET_F_MAC); | ||
1557 | add_feature(dev, VIRTIO_NET_F_GUEST_TSO4); | 1536 | add_feature(dev, VIRTIO_NET_F_GUEST_TSO4); |
1558 | add_feature(dev, VIRTIO_NET_F_GUEST_TSO6); | 1537 | add_feature(dev, VIRTIO_NET_F_GUEST_TSO6); |
1559 | add_feature(dev, VIRTIO_NET_F_GUEST_ECN); | 1538 | add_feature(dev, VIRTIO_NET_F_GUEST_ECN); |