Bug 13559 - [systemd] only start smb when network interfaces are up
Summary: [systemd] only start smb when network interfaces are up
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other (show other bugs)
Version: 4.19.4
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Björn Jacke
QA Contact: Samba QA Contact
: 7060 (view as bug list)
Depends on:
Reported: 2018-08-03 12:33 UTC by Oleksandr Natalenko
Modified: 2024-03-20 11:50 UTC (History)
4 users (show)

See Also:

patch for 4.9 (1.36 KB, patch)
2018-08-07 09:08 UTC, Andreas Schneider
ab: review+
patch for 4.8 (1.36 KB, patch)
2018-08-07 09:09 UTC, Andreas Schneider
ab: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Oleksandr Natalenko 2018-08-03 12:33:43 UTC
For smb, if the smb.conf contains explicit bindings to the network interfaces, the service must wait till network interfaces are up, otherwise the service won't be operational.

The 0e571054a61e commit and the BZ 13184 have fixed this for nmb and samba, so do exactly the same here, for smb.
Comment 1 Oleksandr Natalenko 2018-08-03 12:36:45 UTC
Submission: https://lists.samba.org/archive/samba-technical/2018-August/129509.html
Comment 2 Andreas Schneider 2018-08-07 09:08:58 UTC
Created attachment 14396 [details]
patch for 4.9
Comment 3 Andreas Schneider 2018-08-07 09:09:57 UTC
Created attachment 14397 [details]
patch for 4.8
Comment 4 Alexander Bokovoy 2018-08-07 13:06:02 UTC
Comment on attachment 14397 [details]
patch for 4.8

Comment 5 Alexander Bokovoy 2018-08-07 13:06:35 UTC
Comment on attachment 14396 [details]
patch for 4.9

Comment 6 Andreas Schneider 2018-08-07 13:47:50 UTC
Karolin, please add the patches to the relevant branches. Thanks!
Comment 7 Karolin Seeger 2018-08-13 10:50:28 UTC
(In reply to Andreas Schneider from comment #6)
Pushed to autobuild-v4-{9,8}-test.
Comment 8 Karolin Seeger 2018-08-14 11:17:53 UTC
(In reply to Karolin Seeger from comment #7)
Pushed to both branches.
Closing out bug report.

Comment 9 Björn Jacke 2024-01-10 23:24:54 UTC
adding the network-online.target is not enough. For example the case where IPv6 addresses are auto-generated through RAs will come up after network-online.target was reached.

I think this should be solved by using IP_FREEBIND socket option or IP_BINDANY or IP_NONLOCALOK on *BSD systems. This will allow binding to addresses that are not (yet) configured locally. We could use those socket options by default in case that "bind interfaces only" is enabled.
Comment 10 Björn Jacke 2024-01-11 09:45:37 UTC
see also https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/ :

"If you write a server: if you want to listen on other, explicitly configured addresses, consider using the IP_FREEBIND sockopt functionality of the Linux kernel. This allows your code to bind to an address even if it is not actually (yet or ever) configured locally. This also makes your code robust towards network configuration changes."
Comment 11 Björn Jacke 2024-01-11 14:21:23 UTC
*** Bug 7060 has been marked as a duplicate of this bug. ***