提交 7ae13660 编写于 作者: D Daniel P. Berrange

Don't set MAC on TAP devs. Pass TAP device name to QEMU

上级 88851917
Fri Mar 14 16:38:34 EDT 2008 Daniel P. Berrange <berrange@redhat.com>
* src/bridge.c, src/bridge.h: Don't set MAC address on TAP
device.
* src/qemu_conf.c: Pass ifname= param along with TAP file
handle for Xenner
Fri Mar 14 16:55:34 CET 2008 Daniel Veillard <veillard@redhat.com> Fri Mar 14 16:55:34 CET 2008 Daniel Veillard <veillard@redhat.com>
* po/*: updated translations * po/*: updated translations
......
...@@ -313,7 +313,6 @@ brDeleteInterface(brControl *ctl ATTRIBUTE_UNUSED, ...@@ -313,7 +313,6 @@ brDeleteInterface(brControl *ctl ATTRIBUTE_UNUSED,
int int
brAddTap(brControl *ctl, brAddTap(brControl *ctl,
const char *bridge, const char *bridge,
unsigned char *macaddr,
char *ifname, char *ifname,
int maxlen, int maxlen,
int *tapfd) int *tapfd)
...@@ -357,18 +356,6 @@ brAddTap(brControl *ctl, ...@@ -357,18 +356,6 @@ brAddTap(brControl *ctl,
} }
if (ioctl(fd, TUNSETIFF, &try) == 0) { if (ioctl(fd, TUNSETIFF, &try) == 0) {
struct ifreq addr;
memset(&addr, 0, sizeof(addr));
memcpy(addr.ifr_hwaddr.sa_data, macaddr, 6);
addr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
/* Device actually starts in 'UP' state, but it
* needs to be down to set the MAC addr
*/
if ((errno = brSetInterfaceUp(ctl, try.ifr_name, 0)))
goto error;
if (ioctl(fd, SIOCSIFHWADDR, &addr) != 0)
goto error;
if ((errno = brAddInterface(ctl, bridge, try.ifr_name))) if ((errno = brAddInterface(ctl, bridge, try.ifr_name)))
goto error; goto error;
if ((errno = brSetInterfaceUp(ctl, try.ifr_name, 1))) if ((errno = brSetInterfaceUp(ctl, try.ifr_name, 1)))
......
...@@ -62,7 +62,6 @@ int brDeleteInterface (brControl *ctl, ...@@ -62,7 +62,6 @@ int brDeleteInterface (brControl *ctl,
int brAddTap (brControl *ctl, int brAddTap (brControl *ctl,
const char *bridge, const char *bridge,
unsigned char *mac,
char *ifname, char *ifname,
int maxlen, int maxlen,
int *tapfd); int *tapfd);
......
...@@ -1175,7 +1175,7 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn, ...@@ -1175,7 +1175,7 @@ static struct qemud_vm_def *qemudParseXML(virConnectPtr conn,
obj = xmlXPathEval(BAD_CAST "string(/domain/os/type[1])", ctxt); obj = xmlXPathEval(BAD_CAST "string(/domain/os/type[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) || if ((obj == NULL) || (obj->type != XPATH_STRING) ||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) { (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
qemudReportError(conn, NULL, NULL, VIR_ERR_OS_TYPE, NULL); qemudReportError(conn, NULL, NULL, VIR_ERR_OS_TYPE, "no OS type");
goto error; goto error;
} }
if (!virCapabilitiesSupportsGuestOSType(driver->caps, (const char*)obj->stringval)) { if (!virCapabilitiesSupportsGuestOSType(driver->caps, (const char*)obj->stringval)) {
...@@ -1540,7 +1540,6 @@ qemudNetworkIfaceConnect(virConnectPtr conn, ...@@ -1540,7 +1540,6 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
} }
if ((err = brAddTap(driver->brctl, brname, if ((err = brAddTap(driver->brctl, brname,
net->mac,
ifname, BR_IFNAME_MAXLEN, &tapfd))) { ifname, BR_IFNAME_MAXLEN, &tapfd))) {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Failed to add tap interface '%s' to bridge '%s' : %s", "Failed to add tap interface '%s' to bridge '%s' : %s",
...@@ -1548,7 +1547,9 @@ qemudNetworkIfaceConnect(virConnectPtr conn, ...@@ -1548,7 +1547,9 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
goto error; goto error;
} }
snprintf(tapfdstr, sizeof(tapfdstr), "tap,fd=%d,script=,vlan=%d", tapfd, vlan); snprintf(tapfdstr, sizeof(tapfdstr),
"tap,fd=%d,script=,vlan=%d,ifname=%s",
tapfd, vlan, ifname);
if (!(retval = strdup(tapfdstr))) if (!(retval = strdup(tapfdstr)))
goto no_memory; goto no_memory;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册