dhcp MySQL 超时_[Network] DHCP 协议 DORA 过程 以及 超时处理

在某个环境中,BIOS进行无线连接,经常无法从路由器上获取IP地址。

根据路由器的LOG分析,DHCP DISCOVER,OFFER后即无响应,DORA过程不全。

通过增加重试以及修复超时时间,可以从路由器获取IP地址。

DHCP DORA 过程

f842e25d3317c5201c826076b2f75ac6.png

1. DHCP Discover Message

Source IP: 0.0.0.0

Destination IP: 255.255.255.255

Source MAC: DHCP Client Machine MAC Address

Destination MAC: FF:FF:FF:FF:FF:FF

2. DHCP Offer Message

Source IP: DHCP Server IP Address

Destination IP: 255.255.255.255

Source MAC: DHCP Server Machine MAC Address

Destination MAC: DHCP client MAC Address

3. DHCP Request Message

Source IP: 0.0.0.0

Destination IP: 255.255.255.255

Source MAC: DHCP Client Machine MAC Address

Destination MAC: DHCP Server MAC Address

4. DHCP Acknowledge Message

Source IP: DHCP Server IP Address

Destination IP: 255.255.255.255

Source MAC: DHCP Server Machine MAC Address

Destination MAC: DHCP client MAC Address

UEFI中的相关代码

//edk2-vUDK2018\MdeModulePkg\Universal\Network\Dhcp4Dxe\Dhcp4Io.c

VOID

EFIAPI

DhcpOnTimerTick (

IN EFI_EVENT Event,

IN VOID *Context

)

{

...

//

// Check the retransmit timer

//

if ((DhcpSb->PacketToLive > 0) && (--DhcpSb->PacketToLive == 0)) {

//

// Select offer at each timeout if any offer received.

//

if (DhcpSb->DhcpState == Dhcp4Selecting && DhcpSb->LastOffer != NULL) {

Status = DhcpChooseOffer (DhcpSb);

if (EFI_ERROR(Status)) {

if (DhcpSb->LastOffer != NULL) {

FreePool (DhcpSb->LastOffer);

DhcpSb->LastOffer = NULL;

}

} else {

goto ON_EXIT;

}

}

if (++DhcpSb->CurRetry < DhcpSb->MaxRetries) {

//

// Still has another try

//

DhcpRetransmit (DhcpSb);

DhcpSetTransmitTimer (DhcpSb);

} else if (DHCP_CONNECTED (DhcpSb->DhcpState)) {

//

// Retransmission failed, if the DHCP request is initiated by

// user, adjust the current state according to the lease life.

// Otherwise do nothing to wait the lease to timeout

//

if (DhcpSb->ExtraRefresh != 0) {

Status = EFI_SUCCESS;

if (DhcpSb->LeaseLife < DhcpSb->T1) {

Status = DhcpSetState (DhcpSb, Dhcp4Bound, FALSE);

} else if (DhcpSb->LeaseLife < DhcpSb->T2) {

Status = DhcpSetState (DhcpSb, Dhcp4Renewing, FALSE);

} else if (DhcpSb->LeaseLife < DhcpSb->Lease) {

Status = DhcpSetState (DhcpSb, Dhcp4Rebinding, FALSE);

} else {

goto END_SESSION;

}

DhcpSb->IoStatus = EFI_TIMEOUT;

DhcpNotifyUser (DhcpSb, DHCP_NOTIFY_RENEWREBIND);

}

} else {

goto END_SESSION;

}

}

...

}

路由器 OK, NG时的Log.

*DHCP Socket Task: 13:58:47.145: 0c:7a:15:45:64:33 DHCP processing DHCP DISCOVER (1)

*DHCP Socket Task: 13:58:47.145: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX1, secs: 0, flags: 80

*DHCP Socket Task: 13:58:47.145: 0c:7a:15:45:64:33 DHCP successfully bridged packet to DS

*DHCP Socket Task: 13:58:47.147: 0c:7a:15:45:64:33 DHCP processing DHCP OFFER (2)

*DHCP Socket Task: 13:58:47.147: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX1, secs: 0, flags: 80

*DHCP Socket Task: 13:58:47.147: 0c:7a:15:45:64:33 DHCP successfully bridged packet to STA

*DHCP Socket Task: 13:58:48.017: 0c:7a:15:45:64:33 DHCP processing DHCP REQUEST (3)

*DHCP Socket Task: 13:58:48.017: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX1, secs: 0, flags: 80

*DHCP Socket Task: 13:58:48.017: 0c:7a:15:45:64:33 DHCP successfully bridged packet to DS

*DHCP Socket Task: 13:58:48.060: 0c:7a:15:45:64:33 DHCP processing DHCP ACK (5)

*DHCP Socket Task: 13:58:48.060: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX1, secs: 0, flags: 80

*DHCP Socket Task: 13:58:48.060: 0c:7a:15:45:64:33 DHCP successfully bridged packet to STA

*DHCP Socket Task: 14:03:14.128: 0c:7a:15:45:64:33 DHCP processing DHCP DISCOVER (1)

*DHCP Socket Task: 14:03:14.128: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX2, secs: 0, flags: 80

*DHCP Socket Task: 14:03:14.128: 0c:7a:15:45:64:33 DHCP successfully bridged packet to DS

*DHCP Socket Task: 14:03:14.269: 0c:7a:15:45:64:33 DHCP processing DHCP OFFER (2)

*DHCP Socket Task: 14:03:14.269: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX2, secs: 0, flags: 80

*DHCP Socket Task: 14:03:14.269: 0c:7a:15:45:64:33 DHCP successfully bridged packet to STA

*DHCP Socket Task: 14:06:15.477: 0c:7a:15:45:64:33 DHCP processing DHCP DISCOVER (1)

*DHCP Socket Task: 14:06:15.477: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX3, secs: 0, flags: 80

*DHCP Socket Task: 14:06:15.477: 0c:7a:15:45:64:33 DHCP successfully bridged packet to DS

*DHCP Socket Task: 14:06:15.546: 0c:7a:15:45:64:33 DHCP processing DHCP OFFER (2)

*DHCP Socket Task: 14:06:15.546: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX3, secs: 0, flags: 80

*DHCP Socket Task: 14:06:15.546: 0c:7a:15:45:64:33 DHCP successfully bridged packet to STA

*DHCP Socket Task: 14:10:16.014: 0c:7a:15:45:64:33 DHCP processing DHCP DISCOVER (1)

*DHCP Socket Task: 14:10:16.014: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX4, secs: 0, flags: 80

*DHCP Socket Task: 14:10:16.014: 0c:7a:15:45:64:33 DHCP successfully bridged packet to DS

*DHCP Socket Task: 14:10:16.174: 0c:7a:15:45:64:33 DHCP processing DHCP OFFER (2)

*DHCP Socket Task: 14:10:16.174: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX4, secs: 0, flags: 80

*DHCP Socket Task: 14:15:30.652: 0c:7a:15:45:64:33 DHCP processing DHCP DISCOVER (1)

*DHCP Socket Task: 14:15:30.652: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX5, secs: 0, flags: 80

*DHCP Socket Task: 14:15:30.652: 0c:7a:15:45:64:33 DHCP successfully bridged packet to DS

*DHCP Socket Task: 14:15:30.654: 0c:7a:15:45:64:33 DHCP processing DHCP OFFER (2)

*DHCP Socket Task: 14:15:30.654: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX5, secs: 0, flags: 80

*DHCP Socket Task: 14:15:30.654: 0c:7a:15:45:64:33 DHCP successfully bridged packet to STA

*DHCP Socket Task: 14:15:31.535: 0c:7a:15:45:64:33 DHCP processing DHCP REQUEST (3)

*DHCP Socket Task: 14:15:31.535: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX5, secs: 0, flags: 80

*DHCP Socket Task: 14:15:31.535: 0c:7a:15:45:64:33 DHCP successfully bridged packet to DS

*DHCP Socket Task: 14:15:31.538: 0c:7a:15:45:64:33 DHCP processing DHCP ACK (5)

*DHCP Socket Task: 14:15:31.538: 0c:7a:15:45:64:33 DHCP xid: 0xXXXXXXX5, secs: 0, flags: 80

*DHCP Socket Task: 14:15:31.538: 0c:7a:15:45:64:33 DHCP successfully bridged packet to STA

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值