sysprog21 / semu

A minimalist RISC-V system emulator capable of running Linux kernel
MIT License
253 stars 47 forks source link

Consolidate network devices #64

Open chiangkd opened 2 weeks ago

chiangkd commented 2 weeks ago

This PR refactors the existing TAP-based network device implementation without affecting the current functionality. It separates network client handling to support multiple backends, allowing the use of the -netdev flag to specify the client type, defaulting to TAP if not provided. Support for other backends is yet to be implemented.

Additionally, packet transfer functions are now designed to be specific to each network client, making the system more modular and extensible for future development.

Verification of existing functionality (in privileged mode):

  1. Open TAP device and run simulator
    sudo make check
  2. Configure the IP address for tap0 and enable it on the host side:
    sudo ip addr add 192.168.10.1/24 dev tap0
    sudo ip link set tap0 up
  3. Enable eth0 and set its IP address:
    ip l set eth0 up
    ip a add 192.168.10.2/24 dev eth0