Bug 1373390 - NIC can't release IP when vm shutdown & can't get IP by dhcp when its MAC changed
Summary: NIC can't release IP when vm shutdown & can't get IP by dhcp when its MAC cha...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ovmf
Version: 7.3
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Laszlo Ersek
QA Contact: aihua liang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-06 07:28 UTC by aihua liang
Modified: 2016-09-09 03:30 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-06 14:56:20 UTC
Target Upstream Version:


Attachments (Terms of Use)
DHCP-Discovery-No-Responde (5.54 KB, application/octet-stream)
2016-09-09 03:30 UTC, aihua liang
no flags Details

Description aihua liang 2016-09-06 07:28:35 UTC
Description of problem:
 NIC can't release IP when vm shutdown & can't get IP by DHCP when its MAC changed.

Version-Release number of selected component (if applicable):
  Kernel version:3.10.0-504.el7.x86_64
  qemu-kvm-rhev version:qemu-kvm-rhev-2.6.0-22.el7.x86_64
  OVMF version:OVMF-20160608-3.git988715a.el7.noarch

How reproducible:
 100%

Steps to Reproduce:
1.
 1.1 Start UEFI Shell by cmds:
 /usr/libexec/qemu-kvm -name rhel7 \
-machine q35,accel=kvm,usb=off,vmport=off \
-cpu SandyBridge \
-m 8192 \
-realtime mlock=off \
-smp 6 \
-uuid 1534fa42-4818-4493-9f67-eee5ba758385 \
-no-user-config -nodefaults \
-chardev socket,id=qmp_id_catch_monitor,path=/var/tmp/test1,server,nowait \
-mon chardev=qmp_id_catch_monitor,id=monitor,mode=control \
-no-hpet \
-boot menu=on,splash-time=12000 \
-vga qxl \
-monitor stdio \
-vnc 0:2 \
-netdev tap,id=hostnet1 \
-device virtio-net-pci,netdev=hostnet1,id=net1,mac=90:54:00:49:b2:5f \
-spice ipv4,port=5000,disable-ticketing \
-enable-kvm \
-global ICH9-LPC.disable_s3=0 \
-drive file=/usr/share/OVMF/OVMF_CODE.secboot.fd,if=pflash,format=raw,readonly=on \
-drive file=/usr/share/OVMF/OVMF_Client_VARS.fd,if=pflash,format=raw \
-device ahci,id=ahci \
-global driver=cfi.pflash01,property=secure,value=on \
-cdrom /usr/share/OVMF/UefiShell.iso \
-chardev socket,id=ovmf_log,path=/var/tmp/ovmf_log,server,nowait \
-device isa-debugcon,chardev=ovmf_log,iobase=0x402 \
-smbios type=1,manufacturer=aihualiang \

  1.2 In UEFI Shell,check eth0 ip by "ifconfig -l"
    ----IP: 0.0.0.0 displayed.

  1.3 Set eth0 get ip by dhcp "ifconfig -s eth0 dhcp",then check it.
    ----IP:10.66.x.x displayed.

2. Shutdown vm,then start it, check eth0 ip in UEFI Shell.
    Actual Result:
          IP:10.66.x.x displayed.
    Expected Result:
          IP:0.0.0.0 displayed.
    Log info:
[root@dhcp-8-210 home]# nc -U /var/tmp/ovmf_log
InstallProtocolInterface: 41D94CD2-35B6-455A-8258-D4E51334AADD 7E635120
InstallProtocolInterface: 3AD9DF29-4501-478D-B1F8-7F7FE70E50F3 7E635E38
InstallProtocolInterface: F4B427BB-BA21-4F16-BC4E-43E416AB619C 7E634EB0
InstallProtocolInterface: F4B427BB-BA21-4F16-BC4E-43E416AB619C 7E6365B0
[Bds]BdsWait(8)..Zzzz...
[Bds]BdsWait(7)..Zzzz...
[Bds]BdsWait(6)..Zzzz...
[Bds]BdsWait(5)..Zzzz...
[Bds]BdsWait(4)..Zzzz...
[Bds]BmHotkeyCallback: 0000:000D
[Bds]Continue key pressed!
[Bds]Exit the waiting!
[Bds]Stop Hotkey Service!
[Bds]UnregisterKeyNotify: 000C/0000 Success
[Bds]UnregisterKeyNotify: 0017/0000 Success
[Bds]UnregisterKeyNotify: 0000/000D Success
SmmInstallProtocolInterface: 6E057ECF-FA99-4F39-95BC-59F9921D17E4 0
MemoryAttributesTable:
  Version              - 0x00000001
  NumberOfEntries      - 0x0000001F
  DescriptorSize       - 0x00000030
Entry (0x7E633028)
  Type              - 0x6
  PhysicalStart     - 0x000000007E4E8000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000005
  Attribute         - 0x8000000000004000
Entry (0x7E633058)
  Type              - 0x5
  PhysicalStart     - 0x000000007E4ED000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000001
  Attribute         - 0x8000000000004000
Entry (0x7E633088)
  Type              - 0x5
  PhysicalStart     - 0x000000007E4EE000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000007
  Attribute         - 0x8000000000020000
Entry (0x7E6330B8)
  Type              - 0x5
  PhysicalStart     - 0x000000007E4F5000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000002
  Attribute         - 0x8000000000004000
Entry (0x7E6330E8)
  Type              - 0x6
  PhysicalStart     - 0x000000007E4F7000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000005
  Attribute         - 0x8000000000004000
Entry (0x7E633118)
  Type              - 0x5
  PhysicalStart     - 0x000000007E4FC000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000001
  Attribute         - 0x8000000000004000
Entry (0x7E633148)
  Type              - 0x5
  PhysicalStart     - 0x000000007E4FD000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000005
  Attribute         - 0x8000000000020000
Entry (0x7E633178)
  Type              - 0x5
  PhysicalStart     - 0x000000007E502000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000002
  Attribute         - 0x8000000000004000
Entry (0x7E6331A8)
  Type              - 0x6
  PhysicalStart     - 0x000000007E524000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000005
  Attribute         - 0x8000000000004000
Entry (0x7E6331D8)
  Type              - 0x5
  PhysicalStart     - 0x000000007E529000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000001
  Attribute         - 0x8000000000004000
Entry (0x7E633208)
  Type              - 0x5
  PhysicalStart     - 0x000000007E52A000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x000000000000000A
  Attribute         - 0x8000000000020000
Entry (0x7E633238)
  Type              - 0x5
  PhysicalStart     - 0x000000007E534000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000002
  Attribute         - 0x8000000000004000
Entry (0x7E633268)
  Type              - 0x6
  PhysicalStart     - 0x000000007E536000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000003
  Attribute         - 0x8000000000004000
Entry (0x7E633298)
  Type              - 0x5
  PhysicalStart     - 0x000000007E539000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000001
  Attribute         - 0x8000000000004000
Entry (0x7E6332C8)
  Type              - 0x5
  PhysicalStart     - 0x000000007E53A000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000009
  Attribute         - 0x8000000000020000
Entry (0x7E6332F8)
  Type              - 0x5
  PhysicalStart     - 0x000000007E543000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000002
  Attribute         - 0x8000000000004000
Entry (0x7E633328)
  Type              - 0x5
  PhysicalStart     - 0x000000007E59D000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000001
  Attribute         - 0x8000000000004000
Entry (0x7E633358)
  Type              - 0x5
  PhysicalStart     - 0x000000007E59E000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x000000000000000D
  Attribute         - 0x8000000000020000
Entry (0x7E633388)
  Type              - 0x5
  PhysicalStart     - 0x000000007E5AB000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000002
  Attribute         - 0x8000000000004000
Entry (0x7E6333B8)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6A3000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000008
  Attribute         - 0x8000000000004000
Entry (0x7E6333E8)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6AB000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000006
  Attribute         - 0x8000000000020000
Entry (0x7E633418)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6B1000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000003
  Attribute         - 0x8000000000004000
Entry (0x7E633448)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6B4000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000006
  Attribute         - 0x8000000000020000
Entry (0x7E633478)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6BA000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000003
  Attribute         - 0x8000000000004000
Entry (0x7E6334A8)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6BD000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000007
  Attribute         - 0x8000000000020000
Entry (0x7E6334D8)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6C4000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000003
  Attribute         - 0x8000000000004000
Entry (0x7E633508)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6C7000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x000000000000000A
  Attribute         - 0x8000000000020000
Entry (0x7E633538)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6D1000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000002
  Attribute         - 0x8000000000004000
Entry (0x7E633568)
  Type              - 0x6
  PhysicalStart     - 0x000000007F6D3000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000024
  Attribute         - 0x8000000000004000
Entry (0x7E633598)
  Type              - 0x6
  PhysicalStart     - 0x000000007F7D0000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000020
  Attribute         - 0x8000000000004000
Entry (0x7E6335C8)
  Type              - 0x6
  PhysicalStart     - 0x00000000FFE00000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000200
  Attribute         - 0x8000000000004000
FatDiskIo: Cache Page OutBound occurred! 
FSOpen: Open '\EFI\BOOT\BOOTX64.EFI' Success
[Bds] DevicePath expand: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0xFFFF,0x0) -> PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0xFFFF,0x0)/CDROM(0x0,0x21,0x143C)/\EFI\BOOT\BOOTX64.EFI
InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 7E634040
Loading driver at 0x0007DD37000 EntryPoint=0x0007DD37240 Shell.efi
InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 7E9E2198
Memory  Previous  Current    Next   
 Type    Pages     Pages     Pages  
======  ========  ========  ========
  0A    00000004  00000056  0000006B
  09    00000008  00000008  00000008
  00    00000004  0000003B  00000049
  06    00000024  00000034  00000041
  05    00000030  00000064  0000007D
  03    00000180  000005E0  00000758
  04    00000F00  00001187  000015E8
[Bds]Booting UEFI QEMU DVD-ROM QM00005 
InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 7E125CA0
InstallProtocolInterface: 752F3136-4E16-4FDC-A22A-E5F46812F4CA 7E127F98
InstallProtocolInterface: 6302D008-7F9B-4F30-87AC-60C9FEF5DA4E 7DE64D40


3. Shutdown vm,change its MAC Address, then start it,repeat step1.2~1.3.
    Actual Result:
          IP:0.0.0.0 displayed.
    Expected Result:
          IP:10.66.x.x displayed.
    Log info:
[root@dhcp-8-210 home]# nc -U /var/tmp/ovmf_log
[Bds]BdsWait(10)..Zzzz...
[Bds]BdsWait(9)..Zzzz...
[Bds]BdsWait(8)..Zzzz...
[Bds]BdsWait(7)..Zzzz...
[Bds]BmHotkeyCallback: 0000:000D
[Bds]Continue key pressed!
[Bds]Exit the waiting!
[Bds]Stop Hotkey Service!
[Bds]UnregisterKeyNotify: 000C/0000 Success
[Bds]UnregisterKeyNotify: 0017/0000 Success
[Bds]UnregisterKeyNotify: 0000/000D Success
SmmInstallProtocolInterface: 6E057ECF-FA99-4F39-95BC-59F9921D17E4 0
MemoryAttributesTable:
  Version              - 0x00000001
  NumberOfEntries      - 0x0000001F
  DescriptorSize       - 0x00000030
Entry (0x7E659028)
  Type              - 0x6
  PhysicalStart     - 0x000000007E4E8000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000005
  Attribute         - 0x8000000000004000
Entry (0x7E659058)
  Type              - 0x5
  PhysicalStart     - 0x000000007E4ED000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000001
  Attribute         - 0x8000000000004000
Entry (0x7E659088)
  Type              - 0x5
  PhysicalStart     - 0x000000007E4EE000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000007
  Attribute         - 0x8000000000020000
Entry (0x7E6590B8)
  Type              - 0x5
  PhysicalStart     - 0x000000007E4F5000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000002
  Attribute         - 0x8000000000004000
Entry (0x7E6590E8)
  Type              - 0x6
  PhysicalStart     - 0x000000007E4F7000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000005
  Attribute         - 0x8000000000004000
Entry (0x7E659118)
  Type              - 0x5
  PhysicalStart     - 0x000000007E4FC000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000001
  Attribute         - 0x8000000000004000
Entry (0x7E659148)
  Type              - 0x5
  PhysicalStart     - 0x000000007E4FD000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000005
  Attribute         - 0x8000000000020000
Entry (0x7E659178)
  Type              - 0x5
  PhysicalStart     - 0x000000007E502000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000002
  Attribute         - 0x8000000000004000
Entry (0x7E6591A8)
  Type              - 0x6
  PhysicalStart     - 0x000000007E524000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000005
  Attribute         - 0x8000000000004000
Entry (0x7E6591D8)
  Type              - 0x5
  PhysicalStart     - 0x000000007E529000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000001
  Attribute         - 0x8000000000004000
Entry (0x7E659208)
  Type              - 0x5
  PhysicalStart     - 0x000000007E52A000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x000000000000000A
  Attribute         - 0x8000000000020000
Entry (0x7E659238)
  Type              - 0x5
  PhysicalStart     - 0x000000007E534000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000002
  Attribute         - 0x8000000000004000
Entry (0x7E659268)
  Type              - 0x6
  PhysicalStart     - 0x000000007E536000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000003
  Attribute         - 0x8000000000004000
Entry (0x7E659298)
  Type              - 0x5
  PhysicalStart     - 0x000000007E539000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000001
  Attribute         - 0x8000000000004000
Entry (0x7E6592C8)
  Type              - 0x5
  PhysicalStart     - 0x000000007E53A000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000009
  Attribute         - 0x8000000000020000
Entry (0x7E6592F8)
  Type              - 0x5
  PhysicalStart     - 0x000000007E543000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000002
  Attribute         - 0x8000000000004000
Entry (0x7E659328)
  Type              - 0x5
  PhysicalStart     - 0x000000007E59D000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000001
  Attribute         - 0x8000000000004000
Entry (0x7E659358)
  Type              - 0x5
  PhysicalStart     - 0x000000007E59E000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x000000000000000D
  Attribute         - 0x8000000000020000
Entry (0x7E659388)
  Type              - 0x5
  PhysicalStart     - 0x000000007E5AB000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000002
  Attribute         - 0x8000000000004000
Entry (0x7E6593B8)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6A3000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000008
  Attribute         - 0x8000000000004000
Entry (0x7E6593E8)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6AB000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000006
  Attribute         - 0x8000000000020000
Entry (0x7E659418)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6B1000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000003
  Attribute         - 0x8000000000004000
Entry (0x7E659448)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6B4000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000006
  Attribute         - 0x8000000000020000
Entry (0x7E659478)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6BA000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000003
  Attribute         - 0x8000000000004000
Entry (0x7E6594A8)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6BD000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000007
  Attribute         - 0x8000000000020000
Entry (0x7E6594D8)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6C4000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000003
  Attribute         - 0x8000000000004000
Entry (0x7E659508)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6C7000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x000000000000000A
  Attribute         - 0x8000000000020000
Entry (0x7E659538)
  Type              - 0x5
  PhysicalStart     - 0x000000007F6D1000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000002
  Attribute         - 0x8000000000004000
Entry (0x7E659568)
  Type              - 0x6
  PhysicalStart     - 0x000000007F6D3000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000024
  Attribute         - 0x8000000000004000
Entry (0x7E659598)
  Type              - 0x6
  PhysicalStart     - 0x000000007F7D0000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000020
  Attribute         - 0x8000000000004000
Entry (0x7E6595C8)
  Type              - 0x6
  PhysicalStart     - 0x00000000FFE00000
  VirtualStart      - 0x0000000000000000
  NumberOfPages     - 0x0000000000000200
  Attribute         - 0x8000000000004000
FatDiskIo: Cache Page OutBound occurred! 
FSOpen: Open '\EFI\BOOT\BOOTX64.EFI' Success
[Bds] DevicePath expand: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0xFFFF,0x0) -> PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0xFFFF,0x0)/CDROM(0x0,0x21,0x143C)/\EFI\BOOT\BOOTX64.EFI
InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 7E65A040
Loading driver at 0x0007DCF5000 EntryPoint=0x0007DCF5240 Shell.efi
InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 7E9E2198
Memory  Previous  Current    Next   
 Type    Pages     Pages     Pages  
======  ========  ========  ========
  0A    00000004  00000056  0000006B
  09    00000008  00000008  00000008
  00    00000004  0000003B  00000049
  06    00000024  00000034  00000041
  05    00000030  00000064  0000007D
  03    00000180  000005E0  00000758
  04    00000F00  000011A4  0000160D
[Bds]Booting UEFI QEMU DVD-ROM QM00005 
InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 7E642220
InstallProtocolInterface: 752F3136-4E16-4FDC-A22A-E5F46812F4CA 7E642318
InstallProtocolInterface: 6302D008-7F9B-4F30-87AC-60C9FEF5DA4E 7DE22D40


4. Shutdowm vm, change its MAC Address,copy a new var file from "/usr/share/OVMF/OVMF_VARS.fd", then start vm and repeat step1.2~1.3.
    ----IP:10.66.x.x displayed.

Additional Info:
 rtl8139 & e1000 also have this problem.

Comment 2 Laszlo Ersek 2016-09-06 14:44:52 UTC
Hi,

first of all, when you say "shutdown", that is actually a forceful poweroff, regardless of
- whether you trigger it with "reset -s" in the UEFI shell,
- or use the "system_powerdown" command in the QEMU monitor,
- or click the Shut Down | Force Off button in virt-manager.

The fact is that UEFI does not support graceful shutdown, like the Linux kernel does, so it will never gracefully release an IP assigment from DHCP when you "shut it down". This is by design.

This also means the DHCP server will hang on to the lease, and hand it out again, if there is a request from the same MAC within the expiry period.

Second, from the examples given, it seems to me that everything works by design, but I agree it might be confusing. So let me explain.

The IP configuration policy (called "Ip4Config2" in edk2) can take two values, "static" and "dhcp". For any new network device in the system, the policy is "static". Once you flip it to "dhcp", it remains set as "dhcp"; the setting is stored in the variable store, and there's no user-accessible way to reset it to "static", *unless* you actually configure a static IP address.

The current policy value is listed, in most cases, by "ipconfig -l" as well.

So, let's go through your cases one by one:

* In your step 1.2 ("ifconfig -l"), your policy is most likely "static".

* Then in step 1.3 ("ifconfig -s eth0 dhcp"), you initiate the DHCP negotiation (also called DORA process: Discover, Offer, Request, Ack), but you *also* flip the policy to "dhcp". This policy is then captured in the varstore, I think.

Note that the DORA process might take quite long; for example, on my virbr0 (local to my laptop) network, it can easily take 5-10 seconds. During this interval, "ipconfig -l" will display a zero IP address.

* In case 2, you boot the guest anew, with the same MAC address. In this case,
- the DHCP server already has a cached lease for the MAC,
- your policy for the NIC says "dhcp",
so the negotiation starts immediately (before you even enter the UEFI shell), and the guest gets an IP address by the time you run "ipconfig -l".

* In case 3, when you boot the guest anew, but this time with a brand new MAC address, you practically go through the full DORA process as with case 1. When you first check the IP address, it is still in progress (has not been assigned yet), which is why you see 0.0.0.0. This is entirely consistent with case 1.

Again, if you issue "ifconfig -s eth0 dhcp" explicitly, it doesn't meen that the assignment will complete immediately; the DHCP negotiation may still be running in the background. It may be running already by the time you issue the command (due to a stored "dhcp" policy for the NIC), or your explicit command might start it, but neither guarantees that DORA completes when the command returns. The "ifconfig -l" command might show you a nonzero IP address immediately, or a bit later, or much much later, or never (if the negotiation fails).

* Regarding case 4, when you kill the varstore, that does reset the policy to "static". You also change the MAC address to something new. This means you enter the full negotiation again, and the results are consistent with case 1.

To me this behavior looks fully normal. The only part that might need a bit more explanation is the

    can't get IP by dhcp when its MAC changed

part of the bug summary (that is, case 3).

However, as I explained there, seeing 0.0.0.0 with "ifconfig -l" right after boot (for a stored "dhcp" policy), or right after issuing the "ifconfig -s eth0 dhcp" command, doesn't mean anything -- the negotiation might take longer. The only way to know for sure is to use tcpdump for looking at the DHCP traffic, and/or setting the DHCP server's verbosity level to maximum, and analyzing its log.

Comment 4 Laszlo Ersek 2016-09-06 14:56:20 UTC
Based on comment 2, things seem to work as designed:

- there's no way to explicitly release an assigned IP as part of shutdown
  (there is no graceful / controlled shutdown within the firmware -- there are
  services for shutting down the platform, but they don't include cleanup
  actions)

- my take on case 3 is that it would have completed -- assuming you really did
  repeat step 1.3 (the "ifconfig -s eth0 dhcp" step) there too --, had you waited
  for 10 seconds or longer.

I'm closing this as NOTABUG. If you disagree with my analysis of case 3, then feel free to reopen the BZ, but in that case, please provide
- the configuration of your DHCP server,
- the verbose logs of your DHCP server,
- and a tcpdump packet capture.

Thanks
Laszlo

Comment 5 aihua liang 2016-09-09 03:28:33 UTC
It's a bug of DHCP Server, not our vm.

From the captured packets, we can see that when i change the last four bit of our vm mac's high byte (mac---01:23:45:67:89:ab, change '1' to any value), and enable dhcp, vm send DHCP Discovery packet, but get no response from DHCP Server.

So it keep the status: dhcp with no IP address assigned.

Attachment is the captured packet from vm when reproduce the problem.

Comment 6 aihua liang 2016-09-09 03:30:57 UTC
Created attachment 1199283 [details]
DHCP-Discovery-No-Responde


Note You need to log in before you can comment on or make changes to this bug.