summaryrefslogtreecommitdiff
path: root/Kernel/Net
AgeCommit message (Collapse)Author
2020-08-05Kernel: Suppress remaining unobserved KResult return codesBrian Gianforcaro
These are all cases where there is no clear and easy fix, I've left FIXME bread crumbs so that these can hopefully be fixed over time.
2020-08-05Kernel: Switch IPv4Socket receive queue to SinglyLinkedListWithCount<T>Brian Gianforcaro
Avoid walking the packet queue, instead use a linked list with a count.
2020-08-04Kernel: Make File::write() and File::read() return KResultOr<size_t>Andreas Kling
Instead of returning a ssize_t where negative values mean error, we now return KResultOr<size_t> and use the error state to report errors exclusively.
2020-08-03Kernel: Consolidate timeout logicTom
Allow passing in an optional timeout to Thread::block and move the timeout check out of Thread::Blocker. This way all Blockers implicitly support timeouts and don't need to implement it themselves. Do however allow them to override timeouts (e.g. for sockets).
2020-07-31Kernel: Remove SmapDisabler in sys$setsockopt()Andreas Kling
2020-07-31Kernel: Remove SmapDisabler in sys$ioctl()Andreas Kling
Use copy_{to,from}_user() in the various File::ioctl() implementations instead of disabling SMAP wholesale in sys$ioctl(). This patch does not port IPv4Socket::ioctl() to those API's since that will be more involved. That function now creates a local SmapDisabler.
2020-07-28Net: Fix IPv4 fragmentation not working for larger payloadsAndreas Kling
We were masking the fragment offset bits incorrectly in the IPv4 header sent out with fragments. This worked up to ~32KB but after that, things would get very confused. :^)
2020-07-28Kernel: Use AK::Span a bunch in the network adapter codeAndreas Kling
2020-07-07Kernel: Fix checking BlockResultTom
We now have BlockResult::WokeNormally and BlockResult::NotBlocked, both of which indicate no error. We can no longer just check for BlockResult::WokeNormally and assume anything else must be an interruption.
2020-07-06Kernel: Require a reason to be passed to Thread::wait_onTom
The Lock class still permits no reason, but for everything else require a reason to be passed to Thread::wait_on. This makes it easier to diagnose why a Thread is in Queued state.
2020-07-01Kernel: Turn Thread::current and Process::current into functionsTom
This allows us to query the current thread and process on a per processor basis
2020-06-25Kernel: Harvest randomness from various driversPeter Elliott
Random now gets entropy from the following drivers: - KeyboardDevice - PATAChannel - PS2MouseDevice - E1000NetworkAdapter - RTL8139NetworkAdapter Of these devices, PS2MouseDevice and PATAChannel provide the vast majority of the entropy.
2020-06-25Kernel: Minor cleanups in sendfd/recvfdAndreas Kling
Applying some nice suggestions by @bugaevc. :^)
2020-06-24Kernel+LibC: Add sys$recvfd() and sys$sendfd() for fd passingAndreas Kling
These new syscalls allow you to send and receive file descriptors over a local domain socket. This will enable various privilege separation techniques and other good stuff. :^)
2020-06-02Kernel: Allow File::close() to failSergey Bugaev
And pass the result through to sys$close() return value. Fixes https://github.com/SerenityOS/serenity/issues/427
2020-05-29Kernel: Pass a FileDescription to File::chmod() and File::chown()Sergey Bugaev
We're going to make use of it in the next commit. But the idea is we want to know how this File (more specifically, InodeFile) was opened in order to decide how chown()/chmod() should behave, in particular whether it should be allowed or not. Note that many other File operations, such as read(), write(), and ioctl(), already require the caller to pass a FileDescription.
2020-05-23Kernel: Use a FlatPtr for the "argument" to ioctl()Andreas Kling
Since it's often used to pass pointers, it should really be a FlatPtr.
2020-05-16Kernel: Absorb LibBareMetal back into the kernelAndreas Kling
This was supposed to be the foundation for some kind of pre-kernel environment, but nobody is working on it right now, so let's move everything back into the kernel and remove all the confusion.
2020-05-16Kernel: Remove dubious use of "volatile" in E1000 adapter driverAndreas Kling
2020-04-28Kernel: Be a little more defensive when indexing E1000 Rx/Tx buffersAndreas Kling
2020-04-28Kernel: Add Region helpers for accessing underlying physical pagesAndreas Kling
Since a Region is basically a view into a potentially larger VMObject, it was always necessary to include the Region starting offset when accessing its underlying physical pages. Until now, you had to do that manually, but this patch adds a simple Region::physical_page() for read-only access and a physical_page_slot() when you want a mutable reference to the RefPtr<PhysicalPage> itself. A lot of code is simplified by making use of this.
2020-04-18Kernel: Use shared locking mode in some placesSergey Bugaev
The notable piece of code that remains to be converted is Ext2FS.
2020-04-11Kernel: Instantiate network adapters in their own detect() methodsLiav A
This commit is one step forward for pluggable driver modules. Instead of creating instances of network adapter classes, we let their detect() methods to figure out if there are existing devices to initialize.
2020-04-10Kernel: Add explicit offset parameter to File::read etcConrad Pankoff
2020-04-09Kernel: Move NetworkTask startup into NetworkTask::spawn()Andreas Kling
2020-04-08Kernel: Remove an unnecessary layer of indirection in the PCI codeAndreas Kling
The PCI access layer was composed of a bunch of virtual functions that did nothing but call other virtual functions. The first layer was never overridden so there was no need for them to be virtual. This patch removes the indirection and moves logic from PCI::Access down into the various PCI::get_foo() helpers that were the sole users.
2020-04-06Kernel/Net: make setsockopt pretend it understands SO_KEEPALIVE.Xiao NuoFu
2020-04-05Kernel: Add the SO_BINDTODEVICE socket optionAnotherTest
This patch adds a way for a socket to ask to be routed through a specific interface. Currently, this option only applies to sending, however, it should also apply to receiving...somehow :^)
2020-04-05Kernel+AK: Separate out MACAddress and move it into AKAnotherTest
2020-04-04Kernel: Do not reject broadcast UDP packets right awayAnotherTest
This patch relaxes how we think about UDP packets being "for us" a bit; the proper way to handle this would be to also check if the matched socket has SO_BROADCAST set, but we don't have that :)
2020-04-02Kernel: Send Fragmented IPv4 packets if payload size > mtuAnotherTest
This adds IPv4 fragmentation, so now we can send huuuuuuge packets properly.
2020-03-24Kernel: Limit IRQ rate within E1000 network adapterLiav A
This is not a complete fix, since spurious IRQs under heavy loads can still occur. However, this fix limits the amount of spurious IRQs. It is encouraged to provide a better fix in the future, probably something that takes into account handling of PCI level-triggered interrupts.
2020-03-24Kernel: Enable IRQs before sending commands to the E1000 adapterLiav A
This change prevents a race condition, in which case we send a command and we are losing an interrupt.
2020-03-22Kernel: Run clang-format on filesShannon Booth
Let's rip off the band-aid
2020-03-19Kernel: Use a const reference to RegisterState in IRQ handlingLiav A
2020-03-15Userland: ifconfig can change the IP address of the default gatewaymarprok
ioctl can now perform a request for a specific route and change the address of it's default gateway.
2020-03-11Userland: Set the mask of a network adapter with ifconfig (#1388)Marios Prokopakis
A new IP address or a new network mask can be specified in the command line arguments of ifconfig to replace the old values of a given network adapter. Additionally, more information is being printed for each adapter.
2020-03-09PCI: Enable LogStream output for addressesLiav A
2020-03-08Kernel: Ensure RTL8139NetworkAdapter uses virtual memory correctlyLiav A
2020-03-08Kernel: Ensure E1000NetworkAdapter uses virtual memory correctlyLiav A
2020-03-08AK: Add global FlatPtr typedef. It's u32 or u64, based on sizeof(void*)Andreas Kling
Use this instead of uintptr_t throughout the codebase. This makes it possible to pass a FlatPtr to something that has u32 and u64 overloads.
2020-03-07IPv4: Keep IPv4 socket locked during receive operationsAndreas Kling
We unlock/relock around blocking, but outside of that we now keep the socket locked. This fixes an intermittent ASSERT(m_can_read) failure.
2020-03-06Kernel: Change HandlerPurpose to HandlerTypeLiav A
Also, GenericInterruptHandler class requires to implement two new methods.
2020-03-02Kernel: Use klog() instead of kprintf()Liav A
Also, duplicate data in dbg() and klog() calls were removed. In addition, leakage of virtual address to kernel log is prevented. This is done by replacing kprintf() calls to dbg() calls with the leaked data instead. Also, other kprintf() calls were replaced with klog().
2020-03-02Kernel: Use IOAddress class in Network adapters' driversLiav A
Also, kprintf() calls were replaced with klog() calls.
2020-03-01Kernel: Remove some unnecessary .characters() when doing dbg()<<StringAndreas Kling
2020-02-27E1000NetworkAdapter: Use dbg() instead of dbgprintf()Liav A
2020-02-27LoopbackAdapter: Use dbg() instead of dbgprintf()Liav A
2020-02-27IPv4Socket: Use dbg() instead of dbgprintf()Liav A
2020-02-25AK: Make Vector use size_t for its size and capacityAndreas Kling