1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:38:12 +00:00

Kernel/IPv4: Propagate errors from local port allocation

Remove hacks and assumptions and make the EADDRINUSE propagate all
the way from the point of failure to the syscall layer.
This commit is contained in:
Andreas Kling 2021-04-30 12:26:25 +02:00
parent 8f8fbf3487
commit 71a10eb8e7
6 changed files with 21 additions and 21 deletions

View file

@ -70,14 +70,14 @@ protected:
IPv4Socket(int type, int protocol);
virtual const char* class_name() const override { return "IPv4Socket"; }
int allocate_local_port_if_needed();
KResultOr<u16> allocate_local_port_if_needed();
virtual KResult protocol_bind() { return KSuccess; }
virtual KResult protocol_listen() { return KSuccess; }
virtual KResultOr<size_t> protocol_receive(ReadonlyBytes /* raw_ipv4_packet */, UserOrKernelBuffer&, size_t, int) { return -ENOTIMPL; }
virtual KResultOr<size_t> protocol_send(const UserOrKernelBuffer&, size_t) { return -ENOTIMPL; }
virtual KResult protocol_connect(FileDescription&, ShouldBlock) { return KSuccess; }
virtual int protocol_allocate_local_port() { return 0; }
virtual KResultOr<u16> protocol_allocate_local_port() { return ENOPROTOOPT; }
virtual bool protocol_is_disconnected() const { return false; }
virtual void shut_down_for_reading() override;