Networking (part 1: Ethernet)
Hi,
Long time ago I mentioned that I was working on networking. The best way to continue from now on is to get my code into CVS ASAP. That way other people (and quite some people showed their interest) can work on this.
Here is the first batch of code. This code adds support for managing the frames and adds Ethernet interfaces and basis support. One bonus is an actual "driver" that uses the TAP device in linux.
Please do NOT look at the code, it will not be applied like this (thus no ChangeLog entry). It is not pretty. I didn't take any time to clean it up. Instead of that, I hope you will look at the interfaces and comment on that. If I do not get negative feedback on that, I'll clean up and try to commit this soon, so I can send the other code.
Other code that is left is for IPv4, ARP and UDP. And perhaps some other stuff I forgot about :-).
Anyways... This code adds support for "memstacks". The name is not that great, but I'll try to explain what it is. Frames usually consist of a lot of headers, stacked on each other. This code makes it possible to push a header (IPv4 on UDP, Ethernet on IPv4, etc) on top of what is already there. This makes it easier to handle the memory for the data passed around. The goals were to keep it easy to manage the data and to keep memstack.c small and simple.
Ethernet.c uses these memstacks. Please have a look at ethernet.h for the headers and tap.c for an actual implementation.
Please do not start working on this until I committed this code and the UDP/IPv4 code. The reason for this is that if you do that, it would be more time consuming for me to get everything in place. And doing that is top priority for me so as many people as possible can work on this.
Thanks,
Marco
Index: conf/i386-pc.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.82
i386-pc.rmk +2 -1
@@ -108,7 +108,8 @@ grub_emu_SOURCES = commands/boot.c comma partmap/acorn.c partmap/gpt.c \ util/console.c util/grub-emu.c util/misc.c \ util/biosdisk.c util/getroot.c \ - util/i386/pc/misc.c grub_emu_init.c + util/i386/pc/misc.c grub_emu_init.c \ + network/memstack.c network/ethernet.c util/tap.c grub_emu_LDFLAGS = $(LIBCURSES)
Index: include/grub/ethernet.h
===================================================================
RCS file: include/grub/ethernet.h
grub/ethernet.h new file +102 -0
102 lines not on this page · raw message
Index: include/grub/memstack.h
===================================================================
RCS file: include/grub/memstack.h
grub/memstack.h new file +67 -0
67 lines not on this page · raw message
Index: network/ethernet.c
===================================================================
RCS file: network/ethernet.c
ethernet.c new file +161 -0
161 lines not on this page · raw message
Index: network/memstack.c
===================================================================
RCS file: network/memstack.c
memstack.c new file +164 -0
164 lines not on this page · raw message
Index: util/tap.c
===================================================================
RCS file: util/tap.c
tap.c new file +167 -0
167 lines not on this page · raw message