diff --git a/plugins/ipam/dhcp/daemon.go b/plugins/ipam/dhcp/daemon.go index 962264d4..f1bceeab 100644 --- a/plugins/ipam/dhcp/daemon.go +++ b/plugins/ipam/dhcp/daemon.go @@ -33,8 +33,6 @@ import ( "github.com/coreos/go-systemd/v22/activation" ) -const listenFdsStart = 3 - var errNoMoreTries = errors.New("no more tries") type DHCP struct { @@ -54,8 +52,15 @@ func newDHCP(clientTimeout, clientResendMax time.Duration) *DHCP { } } +// TODO: current client ID is too long. At least the container ID should not be used directly. +// A seperate issue is necessary to ensure no breaking change is affecting other users. func generateClientID(containerID string, netName string, ifName string) string { - return containerID + "/" + netName + "/" + ifName + clientID := containerID + "/" + netName + "/" + ifName + // defined in RFC 2132, length size can not be larger than 1 octet. So we truncate 254 to make everyone happy. + if len(clientID) > 254 { + clientID = clientID[0:254] + } + return clientID } // Allocate acquires an IP from a DHCP server for a specified container.