mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:07:45 +00:00
DHCPClient: Resend DHCP packets when we don't receive an answer
Previously we'd only only send one DHCP request for network interfaces which were up when DHCPClient started. If that packet was lost we'd never send another request for those interfaces. Also, if an interface were to appear after DHCPClient started (not that that is possible at the moment) we wouldn't send requests for that interface either.
This commit is contained in:
parent
2952c86f38
commit
c73116b2e2
3 changed files with 30 additions and 42 deletions
|
@ -21,7 +21,7 @@
|
|||
struct InterfaceDescriptor {
|
||||
String m_ifname;
|
||||
MACAddress m_mac_address;
|
||||
IPv4Address m_current_ip_address { 0, 0, 0, 0 };
|
||||
IPv4Address m_current_ip_address;
|
||||
};
|
||||
|
||||
struct DHCPv4Transaction {
|
||||
|
@ -40,7 +40,7 @@ class DHCPv4Client final : public Core::Object {
|
|||
C_OBJECT(DHCPv4Client)
|
||||
|
||||
public:
|
||||
explicit DHCPv4Client(Vector<InterfaceDescriptor> ifnames_for_immediate_discover, Vector<InterfaceDescriptor> ifnames_for_later);
|
||||
explicit DHCPv4Client();
|
||||
virtual ~DHCPv4Client() override;
|
||||
|
||||
void dhcp_discover(const InterfaceDescriptor& ifname);
|
||||
|
@ -57,13 +57,11 @@ public:
|
|||
static Result<Interfaces, String> get_discoverable_interfaces();
|
||||
|
||||
private:
|
||||
void try_discover_deferred_ifs();
|
||||
void try_discover_ifs();
|
||||
|
||||
HashMap<u32, OwnPtr<DHCPv4Transaction>> m_ongoing_transactions;
|
||||
Vector<InterfaceDescriptor> m_ifnames_for_immediate_discover;
|
||||
Vector<InterfaceDescriptor> m_ifnames_for_later;
|
||||
RefPtr<Core::UDPServer> m_server;
|
||||
RefPtr<Core::Timer> m_fail_check_timer;
|
||||
RefPtr<Core::Timer> m_check_timer;
|
||||
int m_max_timer_backoff_interval { 600000 }; // 10 minutes
|
||||
|
||||
void handle_offer(const DHCPv4Packet&, const ParsedDHCPv4Options&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue