Skip to content

DHCP Server. Flush binding after link is down? #9

@bullitmaster

Description

@bullitmaster

Do need to flush DHCP Server Context clientBinding[] after netInterface link is down?

void netProcessLinkChange(NetInterface *interface)

My config:
#define DHCP_SERVER_MAX_CLIENTS 3 // may be 1? )
RNDIS Driver

After 3 connections (USB plug unplug), the host does not receive the IP address! No free clientBinding[].

Now my decision:
add in void rndisDriverEventHandler(NetInterface *interface)

...
else {
        //Link is down
        interface->linkState = FALSE;
        //Clean DHCP clientBinding
        for(uint16_t i = 0; i< DHCP_SERVER_MAX_CLIENTS; i++){  
            memset(&interface->dhcpServerContext->clientBinding[i], 0 , sizeof(DhcpServerBinding));  
        }
...

May be use callback:error_t netAttachLinkChangeCallback(NetInterface *interface, NetLinkChangeCallback callback, void *param) ?

Best Regards,
Aleksandr (aka bullitmaster)!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions