> I needed a hardware MAC address filtering. What I really love is the stack trace of reasoning, that's very
pedagogical, and that you either worked out lots of things from first
principles or felt the need to explain them is if from naive
perspective. Also, while impractical for real world networking I don't think this
is just idle play. What with backdoors turning up in over-complex
network network chips you may find a more serious readership/project
motive in the future.
I do wonder how many exploits are hidden in modern day silicon, i mean we find exploits almost daily in code of a few thousand lines of code, meanwhile we've got microchips that are basically the equivalent of billions of lines of code in hardcoded silicon
So this is for an all-custom computer, which is rather more impressive on its own (to say nothing of "So I made a C compiler."), but now I'm curious what the minimal implementation of an ethernet card for a "normal" PC would be. I suspect a lot of it would be very similar, up to that you could do checksums on the PC's CPU (probably just baked into the driver). It'd need to be attached - either bare serial or more usefully USB? And then you'd either need to write a "real" driver for it or else plumb through to userspace and do it there. For similar things I've eyeballed having the device implement https://en.wikipedia.org/wiki/USB_communications_device_clas... so it "just works" without needing to do your own driver, but I don't think that would play nice with things like doing all the checksums host-side. Or... while searching for that, I stumbled across https://en.wikipedia.org/wiki/Ethernet_over_USB , which maybe suggests that you can just build an adaptor that translates the physical connection to USB and then let the computer magically handle all the rest for you? Dunno, over my head.
USB is arguably much more complicated than 10base2 internet, which pre-dates it by a long way. In fact, if you're trying to use either PCIe or USB to connect to a 10base2 ethernet network, either of those will be far more work than the Ethernet side.
You might be able to persuade a FTDI-style USB device to bit-bang 10base2 Ethernet for you. You'd implement a "PHY" side which translates the wire traffic to a clean bitstream and aligns the frame start and then just have the PC handle all of it in software for you.
Oh, good point. I guess it depends on your usecase. I was thinking from the angle of not trusting premade network cards but trusting your USB chips.... which now that you point out, is also not a given. Maybe bare serial (just a wire per tx/rx), but it suddenly occurs to me that I don't know how that's actually connected to the CPU, and I think that approaching this from a security angle is a quick road to madness. OTOH... connecting a microcontroller to serial probably is the simplest option and as an engineering exercise is perfectly reasonable, if not exactly fast, but hey it's not like this was ever going to be performant.
> Maybe bare serial (just a wire per tx/rx), but it suddenly occurs to me that I don't know how that's actually connected to the CPU
In practice today, if you have a DB9 serial port, that goes into the section of the chipset which is concerned with all the "legacy" interfaces, which ultimately turns up on the PCIe bus like everything else. > I think that approaching this from a security angle is a quick road to madness Yes.
Ironically, USB SS is more implementable than USB HS without a dedicated PHY. USB SS's PHY is just standard CML differential signaling used for almost all modern high-speed protocols like PCIe or SATA (but with an LFPS extension for link negotiation), most FPGAs already have built-in support for it. Meanwhile USB HS's PHY is a completely non-standard one: it's LVDS-like but the signals are not fully differential, it's half-duplex and needs bus arbitration, etc - only USB HS PHYs speak this odd language.
not being pedantic, just rounding out the record, ISA's follow-on, EISA, had already been around a while and was already sunsetting 30 years ago because PCI had already been invented. VESA also was ending its brief flash of glory.
Funnily enough modern machines have ISA in form of LPC bus used for few of the common peripherals (TPM) that can be used in ISA-compatible mode, and you can get LPC to ISA adapters.
Implementing NICs in FPGAs (typically with PCIe attachment) is super common.
Regarding USB: CDC-NCM isn't hard to implement in any MCU but implementing a USB HS PHY basically requires ASIC hardware. If you use a $0.30 USB HS ULPI PHY, one could implement USB CDC-NCM in an FPGA pretty easily.
Towards the end is a link to a C compiler built for this project. https://github.com/imihajlow/ccpu-cc. Seems to have a linker and a libc as well. I have no real understanding of how complicated the hardware design part is but casually throwing a C compiler together is great.
Super impresssive! I would absolutely love to work on such projects and admire the passion and countless hours that went into understanding and then building the system.
Retirement is not something desirable for me, so maybe that's when I'll spend my time on hardware and software projects like this.
Lack of motivation to work on more technical stuff after having done the same all day at work? Mental exhaustion? Wanting to spend the remaining free time with loved ones instead?
I’ve found it empowering to say “this is fascinating to me, and I would enjoy spending significant time diving into it, but I choose not to prioritize that right now.”
This works much better for me than simply griping that “I don’t have time to X”. It acknowledges that I COULD make time for X, but it isn’t worth the current cost.
Yeah, same here: after a day of staring at code on a screen, it's hard to get motivated to look at more code at home. I'd rather watch a movie with my family.
Comments (84) 24 threads
> I needed a hardware MAC address filtering.
What I really love is the stack trace of reasoning, that's very pedagogical, and that you either worked out lots of things from first principles or felt the need to explain them is if from naive perspective.
Also, while impractical for real world networking I don't think this is just idle play. What with backdoors turning up in over-complex network network chips you may find a more serious readership/project motive in the future.
You might be able to persuade a FTDI-style USB device to bit-bang 10base2 Ethernet for you. You'd implement a "PHY" side which translates the wire traffic to a clean bitstream and aligns the frame start and then just have the PC handle all of it in software for you.
In practice today, if you have a DB9 serial port, that goes into the section of the chipset which is concerned with all the "legacy" interfaces, which ultimately turns up on the PCIe bus like everything else.
> I think that approaching this from a security angle is a quick road to madness
Yes.
Regarding USB: CDC-NCM isn't hard to implement in any MCU but implementing a USB HS PHY basically requires ASIC hardware.
If you use a $0.30 USB HS ULPI PHY, one could implement USB CDC-NCM in an FPGA pretty easily.
Retirement is not something desirable for me, so maybe that's when I'll spend my time on hardware and software projects like this.
This works much better for me than simply griping that “I don’t have time to X”. It acknowledges that I COULD make time for X, but it isn’t worth the current cost.
Continue this thread — 1 reply
All comments shown.
Couldn't load more comments. Check your connection and try again.