I am now able to send a raw packet, and capture the packet with qemu's "-net dump" command
Code: Select all
char * str = "aaaaaaaaaa";
ethernet_send_packet(mac_addr, str, strlen(str), 0x0021);
qemu's dump:
0000000: d4c3 b2a1 0200 0400 0000 0000 0000 0000 ................
0000010: 0000 0100 0100 0000 66cb 5958 195c 0500 ........f.YX.\..
0000020: 1800 0000 1800 0000 1234 5678 1234 1234 .........4Vx.4.4
0000030: 5678 1234 2100 6161 6161 6161 6161 6161 Vx.4!.aaaaaaaaaa
These are the steps I used to setup the tap device
1 add this to the /etc/network/interface
Code: Select all
auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_stp off
bridge_maxwait 0
bridge_fd 0
3 sudo qemu-system-i386 -kernel os_kernel -net nic,model=rtl8139,macaddr=12:34:56:78:12:34 -net dump,file=traffic.pcap -netdev tap,id=br0 -device rtl8139,netdev=br0
So, when I send a packet from my os to itself(by mac address), tcpdump -i br0 did not capture anything.
Also, the rtl8139 interrupt did fire when the packet was sent, but it never fire again(it should, because the packet was sent to itself)
Did I do something wrong here?
Is the rtl8139 supposed to recognize the format of my ethernet packet and send it to the destination?