summaryrefslogtreecommitdiff
path: root/sys/src/cmd
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2017-12-15 22:22:29 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2017-12-15 22:22:29 +0100
commit9fd8894fec87ccd326997b84a2be431af8764cce (patch)
treedf8bdfa139b48cefa908f208d44b1ecb326150f5 /sys/src/cmd
parent4ad70e6055093123f0611269ca7e8e201257e5db (diff)
ether: allow spoofing of source mac address for bridges; used by vmx
to implement layer 2 bridges in userspace, we disable to auto filling of the source mac address when bridge mode is enabled on the connection.
Diffstat (limited to 'sys/src/cmd')
-rw-r--r--sys/src/cmd/nusb/ether/ether.c5
-rw-r--r--sys/src/cmd/vmx/virtio.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/sys/src/cmd/nusb/ether/ether.c b/sys/src/cmd/nusb/ether/ether.c
index 5a94387ae..52481899e 100644
--- a/sys/src/cmd/nusb/ether/ether.c
+++ b/sys/src/cmd/nusb/ether/ether.c
@@ -306,6 +306,11 @@ writeconndata(Req *r)
/* copy in the ethernet packet */
memmove(b->wp, p, r->ifcall.count);
+
+ /* fill source mac address if not bridged */
+ if(!conn[NUM(r->fid->qid.path)].bridge)
+ memmove(b->wp+6, macaddr, 6);
+
b->wp += r->ifcall.count;
etheriq(b, 0);
diff --git a/sys/src/cmd/vmx/virtio.c b/sys/src/cmd/vmx/virtio.c
index 8a7a7d0b3..1dd1b5537 100644
--- a/sys/src/cmd/vmx/virtio.c
+++ b/sys/src/cmd/vmx/virtio.c
@@ -655,7 +655,10 @@ mkvionet(char *net)
}else{
fd = dial(netmkaddr("-1", net, nil), nil, nil, &cfd);
if(fd < 0) return -1;
- if(cfd >= 0) fprint(cfd, "promiscuous");
+ if(cfd >= 0) {
+ write(cfd, "promiscuous", 11);
+ write(cfd, "bridge", 6);
+ }
}
d = mkviodev(0x1000, 0x020000, 1, 3);