Bug 1555387

Summary: RFE: generate system-wide DUID for dhclient
Product: [Fedora] Fedora Reporter: Pavel Zhukov <pzhukov>
Component: dhcpAssignee: Pavel Zhukov <pzhukov>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: jpopelka, knweiss, pemensik, pzhukov, thozza, udovdh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-31 06:55:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 832712    

Description Pavel Zhukov 2018-03-14 15:17:53 UTC
Description of problem:
Currently dhclient generate duid from the interface's hardware address on first run and saves it into leases file. It's not OK in case of PPP connections because ppp interface doesn't have IANA assigned hw address so duid cannot be generated

Version-Release number of selected component (if applicable):
dhcp-client-4.3.6-18.fc29.x86_64

How reproducible:
100%

Steps to Reproduce:
1. create pppoe connection
2. ifup ppp0
3. dhclient -P -6 -d ppp0

Actual results:
# dhclient -P -6 -d ppp0
Internet Systems Consortium DHCP Client 4.3.6
Copyright 2004-2017 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on Socket/ppp0
Sending on   Socket/ppp0
xid: warning: no netdev with useable HWADDR found for seed's uniqueness enforcement
xid: rand init seed (0x5ad63ddf) built using gethostid
Cannot form default DUID from interface ppp0.
PRC: Soliciting for leases (INIT).
XMT: Forming Solicit, 0 ms elapsed.
Failure assembling a DUID.

This version of ISC DHCP is based on the release available
on ftp.isc.org. Features have been added and other changes
have been made to the base software release in order to make
it work better with this distribution.

Please report issues with this software via: 
https://bugzilla.redhat.com/

exiting.


Expected results:
duid generated from arbitrary chosen interface

Additional info:

Comment 1 Pavel Zhukov 2018-03-14 15:20:47 UTC
Workaround 1: https://bugzilla.redhat.com/show_bug.cgi?id=626514#c161

Workaround 2:
dhclient -P -6 -d <any_ethernet_iface>
Ctrl-C
dhclient -P -6 -d ppp0

Comment 2 udo 2018-03-14 15:21:17 UTC
Workaround:

killall -9 dhclient 2> /dev/null
echo 'default-duid "\000\002\000\001\017\214\227y\000@c\366\002\000";' > /var/lib/dhclient/dhclient6.leases
dhclient -6 -P ppp0 &

Comment 3 Pavel Zhukov 2018-03-14 15:51:09 UTC
Thanks. But this will save static constant duid for all machines which is not good. 
generator suggested by Steven should work better.

myhwaddr=`ip add | grep link/ether | cut -f 6 -d \ | tail -n 1 | sed s/:/\\\\\\\\x/g`
echo "default-duid \"\\x00\\x03\\x00\\x01\\x$myhwaddr\";" > $LEASEFILE

Comment 4 Pavel Zhukov 2018-03-14 15:57:38 UTC
NetworkManager uses machine-id for duid generation so it's duid-uuid  (RFC 6355 section 4). We may want to switch to it. It should bring consistency in distribution but upgrade may be problematic because of duid change. And it's systemd related feature so will be hard to get it merged upstream

Comment 5 udo 2018-03-14 15:59:22 UTC
Please bear in mind that NM is not everywhere.

Comment 6 Pavel Zhukov 2018-03-14 16:06:10 UTC
(In reply to udo from comment #5)
> Please bear in mind that NM is not everywhere.

I don't want to bring NM everywhere for sure. I'm thinking about using /etc/machine-id as source of UUID for duid-uuid generarion. 
/etc/machine-id is everywhere in Fedora nowadays.

Comment 8 Pavel Zhukov 2018-03-16 12:32:58 UTC
System Wide change template
https://fedoraproject.org/wiki/Changes/DUID_UUID

Comment 9 Jiri Popelka 2018-03-19 13:20:12 UTC
I was thinking we already use DUID-UUID by default:
https://bugzilla.redhat.com/show_bug.cgi?id=560361#c60
https://src.fedoraproject.org/rpms/dhcp/blob/master/f/dhcp-duid_uuid.patch

or is that DHCPv4 only ?

Comment 10 Pavel Zhukov 2018-03-20 08:31:00 UTC
(In reply to Jiri Popelka from comment #9)
> I was thinking we already use DUID-UUID by default:
> https://bugzilla.redhat.com/show_bug.cgi?id=560361#c60
> https://src.fedoraproject.org/rpms/dhcp/blob/master/f/dhcp-duid_uuid.patch
> 
> or is that DHCPv4 only ?

According to the code it should work for IPv6 too. Checking.

Thank you!

Comment 11 Pavel Zhukov 2019-07-31 06:55:22 UTC
The problem was not in DUID generation itself. it works as Jiri mentioned but in seed uniqueness during xid generation in case of interface without hw address. this should be mitigated now by using hw address of "underlying" interface. Closing