Skip to content

Conversation

@rpluem
Copy link
Collaborator

@rpluem rpluem commented Feb 10, 2025

Merge r1511033, r1528032, r1608686, r1608694, r1608703, r1899784, r1838271, r1916312, r1916344 from trunk

@rpluem rpluem changed the title Merge r1511033, r1528032, r1608686, r1608694, r1608703, r1899784, r1916312, r1916344 from trunk Merge r1511033, r1528032, r1608686, r1608694, r1608703, r1838271, r1899784, r1916312, r1916344 from trunk Feb 10, 2025
@notroj
Copy link
Collaborator

notroj commented Feb 14, 2025

Thank you very much indeed for doing this @rpluem !

pquerna and others added 10 commits June 3, 2025 17:36
  autoconf warnings; define HAVE_SYSTEMD rather than using CPPFLAGS.

* server/listen.c: Use HAVE_SYSTEMD for systemd #define.

* modules/arch/unix/config5.m4: Update systemd headers check.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1528032 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit f6f568d)
activation, fix addrlen in getsockname() call.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1608686 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit 3d6f0d2)
…ds(),

drop the support for "Listen systemd" and use standard Listen syntax instead.

This allows using the same configuration file with or without socket activation
and allows setting protocol when using socket activation.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1608703 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit 4eff9ee)
Until this change httpd was linking libsystemd to the main httpd binary. If you want to run lightweight version of httpd in container, sometimes you just want to install
httpd binary with as little dependencies as possible to make container small in size and do not pull uncencessary dependencies and libraries.

This change will move all systemd library calls from listen.c to mod_systemd module and remove systemd linking from the main httpd bin.
Fixed mixed declaration and wrongly declared variable.

Submitted by: Luboš Uhliarik <luhliari redhat.com>

Github: closes apache#312

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899784 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit db0631e)
…ning.

ap_find_systemd_socket() and ap_systemd_listen_fds() are already declared in
"ap_listen.h", so just include them.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916312 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit e343347)
context at startup, since this may vary when httpd is started via
systemd vs being started directly.

* modules/arch/unix/mod_systemd.c (systemd_post_config):
  Do nothing for the pre-config iteration.
  Log the SELinux context if available.

* modules/arch/unix/config5.m4: Detect libselinux.

Have at least one CI job build mod_systemd.

Github: closes apache#422

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916344 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit 9b17700)
Remove some dead code. Updating 'last' is pointless here.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1838271 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit e9d215e)
alloc_listener initializes more fields in the created ap_listen_rec structure
than alloc_systemd_listener as it has more data to add to this structure.
Ensure that all fields of the ap_listen_rec structure are initialized at
least with 0 as later code using this structure depends on this.

Submitted by: jailletc36

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1926091 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit 32ebb6b)
@rpluem rpluem force-pushed the 1511033_1528032_1608686_1608694_1608703_1899784_1916312_1916344 branch from d2c5f66 to 9434236 Compare June 3, 2025 15:36
asfgit pushed a commit that referenced this pull request Jun 4, 2025
…16312, r1916344, r1838271, r1926091 from trunk:

Add support for systemd socket activation to listener sockets.


* configure.in: Simplify/fix systemd detection: move later to fix
  autoconf warnings; define HAVE_SYSTEMD rather than using CPPFLAGS.

* server/listen.c: Use HAVE_SYSTEMD for systemd #define.

* modules/arch/unix/config5.m4: Update systemd headers check.


* server/listen.c: duplicate sockets correctly when using systemd socket
activation, fix addrlen in getsockname() call.



Follow up r1608686, pass process to alloc_systemd_listener.


* server/listen.c: detect systemd socket activation using sd_listen_fds(),
drop the support for "Listen systemd" and use standard Listen syntax instead.

This allows using the same configuration file with or without socket activation
and allows setting protocol when using socket activation.



Remove libsystemd dependency from main httpd binary

Until this change httpd was linking libsystemd to the main httpd binary. If you want to run lightweight version of httpd in container, sometimes you just want to install
httpd binary with as little dependencies as possible to make container small in size and do not pull uncencessary dependencies and libraries.

This change will move all systemd library calls from listen.c to mod_systemd module and remove systemd linking from the main httpd bin.
Fixed mixed declaration and wrongly declared variable.

Submitted by: Luboš Uhliarik <luhliari redhat.com>



mod_systemd: Axe APR_OPTIONAL_FN redeclarations to avoid compiler warning.

ap_find_systemd_socket() and ap_systemd_listen_fds() are already declared in
"ap_listen.h", so just include them.



mod_systemd: if SELinux is available and enabled, log the SELinux
context at startup, since this may vary when httpd is started via
systemd vs being started directly.

* modules/arch/unix/mod_systemd.c (systemd_post_config):
  Do nothing for the pre-config iteration.
  Log the SELinux context if available.

* modules/arch/unix/config5.m4: Detect libselinux.

Have at least one CI job build mod_systemd.



Fix a cppcheck warning.

Remove some dead code. Updating 'last' is pointless here.

Ensure that ALL fields of the ap_listen_rec structure are initialized

alloc_listener initializes more fields in the created ap_listen_rec structure
than alloc_systemd_listener as it has more data to add to this structure.
Ensure that all fields of the ap_listen_rec structure are initialized at
least with 0 as later code using this structure depends on this.



Reviewed by: rpluem, jorton, ylavic

Github: closes #515


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1926113 13f79535-47bb-0310-9956-ffa450edef68
@rpluem
Copy link
Collaborator Author

rpluem commented Jun 4, 2025

Backported

@rpluem rpluem closed this Jun 4, 2025
@rpluem rpluem deleted the 1511033_1528032_1608686_1608694_1608703_1899784_1916312_1916344 branch June 4, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants