diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-08-12 17:52:51 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-08-12 17:52:52 +1000 |
commit | 40c42076ebd362dc69210cccea101ac80b6d4bd4 (patch) | |
tree | 01336076f45eb008f00940a5df86b5970b8d92d0 /Documentation | |
parent | 10fec20ef5eec1c91913baec1225400f0d02df40 (diff) | |
download | linux-stable-40c42076ebd362dc69210cccea101ac80b6d4bd4.tar.gz linux-stable-40c42076ebd362dc69210cccea101ac80b6d4bd4.tar.bz2 linux-stable-40c42076ebd362dc69210cccea101ac80b6d4bd4.zip |
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')
-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) err(1, "Bringing interface %s up", tapif); } -static void get_mac(int fd, const char *tapif, unsigned char hwaddr[6]) -{ - struct ifreq ifr; - - memset(&ifr, 0, sizeof(ifr)); - strcpy(ifr.ifr_name, tapif); - - /* SIOC stands for Socket I/O Control. G means Get (vs S for Set - * above). IF means Interface, and HWADDR is hardware address. - * Simple! */ - if (ioctl(fd, SIOCGIFHWADDR, &ifr) != 0) - err(1, "getting hw address for %s", tapif); - memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, 6); -} - static int get_tun_device(char tapif[IFNAMSIZ]) { struct ifreq ifr; @@ -1531,11 +1516,8 @@ static void setup_tun_net(char *arg) p = strchr(arg, ':'); if (p) { str2mac(p+1, conf.mac); + add_feature(dev, VIRTIO_NET_F_MAC); *p = '\0'; - } else { - p = arg + strlen(arg); - /* None supplied; query the randomly assigned mac. */ - get_mac(ipfd, tapif, conf.mac); } /* arg is now either an IP address or a bridge name */ @@ -1547,13 +1529,10 @@ static void setup_tun_net(char *arg) /* Set up the tun device. */ configure_device(ipfd, tapif, ip); - /* Tell Guest what MAC address to use. */ - add_feature(dev, VIRTIO_NET_F_MAC); add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY); /* Expect Guest to handle everything except UFO */ add_feature(dev, VIRTIO_NET_F_CSUM); add_feature(dev, VIRTIO_NET_F_GUEST_CSUM); - add_feature(dev, VIRTIO_NET_F_MAC); add_feature(dev, VIRTIO_NET_F_GUEST_TSO4); add_feature(dev, VIRTIO_NET_F_GUEST_TSO6); add_feature(dev, VIRTIO_NET_F_GUEST_ECN); |