1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:37:35 +00:00

DHCPClient: Store current IP address instead of relaying on the yiaddr

Real DHCP servers might decide to send the DHCPAck directly to the
specified ciaddr instead of as a unicast or multicast, resulting in
the ack being ignored by the network adapter when we are requesting
a new IPv4 address instead of renewing an existing lease, as the
yiaddr (and as a result the ciaddr) is set to the offered address in
that case instead of the current ip address.
This commit is contained in:
Idan Horowitz 2021-04-04 23:20:30 +03:00 committed by Andreas Kling
parent 6b360834f2
commit e8d2d73d55
2 changed files with 10 additions and 8 deletions

View file

@ -40,6 +40,7 @@
struct InterfaceDescriptor {
String m_ifname;
MACAddress m_mac_address;
IPv4Address m_current_ip_address { 0, 0, 0, 0 };
};
struct DHCPv4Transaction {
@ -61,7 +62,7 @@ public:
explicit DHCPv4Client(Vector<InterfaceDescriptor> ifnames);
virtual ~DHCPv4Client() override;
void dhcp_discover(const InterfaceDescriptor& ifname, IPv4Address previous = IPv4Address { 0, 0, 0, 0 });
void dhcp_discover(const InterfaceDescriptor& ifname);
void dhcp_request(DHCPv4Transaction& transaction, const DHCPv4Packet& packet);
void process_incoming(const DHCPv4Packet& packet);