1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:17:36 +00:00

Kernel: Implement IP multicast support

An IP socket can now join a multicast group by using the
IP_ADD_MEMBERSHIP sockopt, which will cause it to start receiving
packets sent to the multicast address, even though this address does
not belong to this host.
This commit is contained in:
Sergey Bugaev 2021-05-04 14:42:47 +03:00 committed by Andreas Kling
parent b9c367e13b
commit 78459b92d5
5 changed files with 77 additions and 7 deletions

View file

@ -54,6 +54,8 @@ public:
u16 peer_port() const { return m_peer_port; }
void set_peer_port(u16 port) { m_peer_port = port; }
const Vector<IPv4Address>& multicast_memberships() const { return m_multicast_memberships; }
IPv4SocketTuple tuple() const { return IPv4SocketTuple(m_local_address, m_local_port, m_peer_address, m_peer_port); }
String absolute_path(const FileDescription& description) const override;
@ -96,6 +98,9 @@ private:
IPv4Address m_local_address;
IPv4Address m_peer_address;
Vector<IPv4Address> m_multicast_memberships;
bool m_multicast_loop { true };
struct ReceivedPacket {
IPv4Address peer_address;
u16 peer_port;