diff options
author | Andreas Kling <kling@serenityos.org> | 2021-04-30 12:26:25 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-30 15:27:41 +0200 |
commit | 71a10eb8e79d2fad2359c39ce314b9b92a5221bf (patch) | |
tree | 562bdf56dda06d98bb1b072226c8931910c2fbf7 /Kernel/Net/IPv4Socket.h | |
parent | 8f8fbf3487a9e28902ab9525c7c14195010a3f99 (diff) | |
download | serenity-71a10eb8e79d2fad2359c39ce314b9b92a5221bf.zip |
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.
Diffstat (limited to 'Kernel/Net/IPv4Socket.h')
-rw-r--r-- | Kernel/Net/IPv4Socket.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Net/IPv4Socket.h b/Kernel/Net/IPv4Socket.h index 78342a0389..4333e04df8 100644 --- a/Kernel/Net/IPv4Socket.h +++ b/Kernel/Net/IPv4Socket.h @@ -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; |