码迷,mamicode.com
首页 > 其他好文 > 详细

商业分析07_12精准运营推送

时间:2020-08-10 17:36:40      阅读:67      评论:0      收藏:0      [点我收藏+]

标签:load   code   mic   分析   lazy   BMI   mamicode   编辑   运营   

在某个环境中,BIOS进行无线连接,经常无法从路由器上获取IP地址。
根据路由器的LOG分析,DHCP DISCOVER,OFFER后即无响应,DORA过程不全。
通过增加重试以及修复超时时间,可以从路由器获取IP地址。

DHCP DORA 过程

技术图片

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.

<OK>
 *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

<NG>
 *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

<NG>
 *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

<NG>
 *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


<OK>
 *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


商业分析07_12精准运营推送

标签:load   code   mic   分析   lazy   BMI   mamicode   编辑   运营   

原文地址:https://www.cnblogs.com/pingzideping/p/13470894.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!