Skip to content

ne2k: forces mac address translation even when machine loaded from state#1562

Open
internet-exploder wants to merge 1 commit into
copy:masterfrom
internet-exploder:ne2k-macaddr-fix
Open

ne2k: forces mac address translation even when machine loaded from state#1562
internet-exploder wants to merge 1 commit into
copy:masterfrom
internet-exploder:ne2k-macaddr-fix

Conversation

@internet-exploder
Copy link
Copy Markdown

hey man great software, thank you. I've noticed when I'm loading win2k from state, then detected mac addr outside of the vm is different from what it really is inside the VM.

I was checking like this:

emu.v86.cpu.devices.net.mac
emu.v86.cpu.devices.net.mac_address_in_state

they were both different from what was inside win2k vm loaded from a state.

This PR forces any mac to be translated.

@copy
Copy link
Copy Markdown
Owner

copy commented May 18, 2026

they were both different from what was inside win2k vm loaded from a state.

I cannot reproduce this, can you explain how to reproduce it and what is being fixed by this?

@internet-exploder
Copy link
Copy Markdown
Author

  1. regular win2k image (I installed using qemu, then made it "Standard PC" type)
  2. ne2k with mac addr translation enabled when creating vm with v86
  3. save state of the machine (snapshot thing)
  4. boot machine from state -> check mac addr that being set up for interface outside of the vm, check mac addr inside vm (it would be the same from previous boot, because now we are loading from state), but the "outside" interface mac would be different this time.

Actually the way I caught this: I made custom relay server which responds to DHCP requests and logs new mac addresses and their leases to stdout, and booting from same state in different browsers was giving same mac address to the relay side, which was not what I wanted.

So I figured out when mac addr translation is enabled it seems to rewrite a known mac addr to randomly generated one, however "known" mac addr picked from outside ne2k interface was wrong (in guest vm it was old mac from the snapshot state).

The solution I've found is to forcefully rewrite any mac address that comes out of the VM.

In theory that may be not very good if we're running router or nested vm, but in that case people won't be using mac addr translation feature anyway!

A bit more clarification: in my initial post I mention

emu.v86.cpu.devices.net.mac
emu.v86.cpu.devices.net.mac_address_in_state

emu is emulation instance, I made it global like so: window.emu = new V86(...). Then put those two lines into inspector js console and it shows those macs.

Inside the VM I do "ipconfig /all" to see mac addr which was different from both of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants