Bug 2010206

Summary: dhcp-server on Fedora 34 unable to use ldap backend
Product: [Fedora] Fedora Reporter: Yuriy <smoker.tabac>
Component: dhcpAssignee: Pavel Zhukov <pavel>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 34CC: jorton, pavel, pemensik
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-04 08:29:48 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:

Description Yuriy 2021-10-04 08:01:04 UTC
Description of problem:

On Fedora 31, Fedora 32, Fedora 33 and Fedora 34 dhcpd cannot start with the ldap storage backend.
Error: Cannot login into ldap server 127.0.0.1:389: Can't contact LDAP server

The cause of the problem is described at https://bugzilla.redhat.com/show_bug.cgi?id=1205168#c6
But since dhcpd is now statically linked against libirs.a, the workarounds "Environment=LD_PRELOAD=/lib64/libc.so.6" in dhcpd.service and changing linking order no longer works.

Version-Release number of selected component (if applicable):
dhcp-server-4.4.2-11.b1.fc34.x86_64
openldap-servers-2.4.57-5.fc34.x86_64

How reproducible:
always reproducible.

Steps to Reproduce:
1. Install openldap server with dhcp schema
2. install dhcp-server-4.4.2-11.b1
3. Populate openldap server with dhcp configuration
4. Configure the dhcp-server to use ldap backend

Actual results:

systemd[1]: Starting DHCPv4 Server Daemon...
dhcpd[67641]: Internet Systems Consortium DHCP Server 4.4.2b1
dhcpd[67641]: Copyright 2004-2019 Internet Systems Consortium.
dhcpd[67641]: All rights reserved.
dhcpd[67641]: For info, please visit https://www.isc.org/software/dhcp/
dhcpd[67641]: ldap_gssapi_principal is not set,GSSAPI Authentication for LDAP will not be used
dhcpd[67641]: Error: Cannot login into ldap server 127.0.0.1:389: Can't contact LDAP server

Expected results:
should use the ldap backend without error.

Additional info:
I suggest in libirs.a to use the same namespace for getaddrinfo for unix in dhcp-4.4.2b1/bind/bind-9.11.14/lib/irs/include/irs/netdb.h as it is done for win32 in dhcp-4.4.2b1/bind/bind-9.11.14/lib/irs/win32/include/irs/netdb.h.

dhcpd uses libirs.a, libdns.a, libisccfg.a, and libisc.a from bind-9.11.14. getaddrinfo is also called from libisc.a, but getaddrinfo is called from libc:
dhcp-4.4.2b1/bind/bind-9.11.14/lib/isc/unix/net.c
net.c:649:	n = getaddrinfo("127.0.0.1", NULL, &hints, &res0);
net.c:653:			      "getaddrinfo(127.0.0.1): %s", gai_strerror(n));
net.c:714:	n = getaddrinfo("::1", NULL, &hints, &res0);
net.c:718:			      "getaddrinfo(::1): %s", gai_strerror(n));

dhcp-4.4.2b1/bind/bind-9.11.14/lib/isc/unix/include/isc/netdb.h
48: #include <netdb.h>

so there is no need to touch any other code.

Its work for me:
--- bind/bind/lib/irs/include/irs/netdb.h.in.orig	2021-10-04 10:47:18.537407114 +0300
+++ bind/bind/lib/irs/include/irs/netdb.h.in	2021-10-04 10:49:25.808059723 +0300
@@ -151,6 +151,40 @@
 #define	NI_DGRAM	0x00000010
 
 /*
+ * Define to map into irs_ namespace.
+ */
+
+#define IRS_NAMESPACE
+
+#ifdef IRS_NAMESPACE
+
+/*
+ * Use our versions not the ones from the C library.
+ */
+
+#ifdef getnameinfo
+#undef getnameinfo
+#endif
+#define getnameinfo irs_getnameinfo
+
+#ifdef getaddrinfo
+#undef getaddrinfo
+#endif
+#define getaddrinfo irs_getaddrinfo
+
+#ifdef freeaddrinfo
+#undef freeaddrinfo
+#endif
+#define freeaddrinfo irs_freeaddrinfo
+
+#ifdef gai_strerror
+#undef gai_strerror
+#endif
+#define gai_strerror irs_gai_strerror
+
+#endif
+
+/*
  * Tell Emacs to use C mode on this file.
  * Local variables:
  * mode: c

Comment 1 Pavel Zhukov 2021-10-04 08:29:48 UTC

*** This bug has been marked as a duplicate of bug 1823749 ***