From 582faeb461aa0dd01b55bf6c9b1433532fc927d3 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 2 Aug 2017 13:41:18 +0100 Subject: [PATCH] modprobe.d: ship drop-in to set bonding max_bonds to 0 (#6448) This allows networkd to correctly manage bond0 using networkd, when requested by the user. Fixes #5971 #6184 --- NEWS | 11 +++++++++++ README | 9 ++++----- meson.build | 4 ++++ modprobe.d/systemd.conf | 14 ++++++++++++++ 4 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 modprobe.d/systemd.conf diff --git a/NEWS b/NEWS index d56b7a6f27..199b020d8b 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,16 @@ systemd System and Service Manager +CHANGES WITH 235: + + * modprobe.d drop-in is now shipped by default that sets bonding module + option max_bonds=0. This overrides the kernel default, to avoid + conflicts and ambigiuty as to whether or not bond0 should be managed + by networkd or not. This resolves multiple bugs of bond0 properties + not being applied, when bond0 is configured with + networkd. Distributors may choose to not package this, however in + that case users will be prevented from correctly managing bond0 + interface using networkd. + CHANGES WITH 234: * Meson is now supported as build system in addition to Automake. It is diff --git a/README b/README index 5ae581e338..bf010f8acf 100644 --- a/README +++ b/README @@ -110,11 +110,10 @@ REQUIREMENTS: It's a good idea to disable the implicit creation of networking bonding devices by the kernel networking bonding module, so that the automatically created "bond0" interface doesn't conflict with any such - device created by systemd-networkd (or other tools). Please make sure - that the kernel module bonding.ko is shipped with max_bonds=0 set by - default. Ideally there would be a kernel compile-time option for this, - but there currently isn't. The next best thing is to make this change - through a modprobe.d drop-in. + device created by systemd-networkd (or other tools). Ideally there + would be a kernel compile-time option for this, but there currently + isn't. The next best thing is to make this change through a modprobe.d + drop-in. This is shipped by default, see modprobe.d/systemd.conf. Note that kernel auditing is broken when used with systemd's container code. When using systemd in conjunction with diff --git a/meson.build b/meson.build index f73729d392..8dd3381c65 100644 --- a/meson.build +++ b/meson.build @@ -81,6 +81,7 @@ polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor varlogdir = join_paths(localstatedir, 'log') xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d') rpmmacrosdir = get_option('rpmmacrosdir') +modprobedir = join_paths(rootlibdir, 'modprobe.d') # Our own paths pkgdatadir = join_paths(datadir, 'systemd') @@ -2307,6 +2308,8 @@ install_data('xorg/50-systemd-user.sh', install_dir : xinitrcdir) install_data('system-preset/90-systemd.preset', install_dir : systempresetdir) +install_data('modprobe.d/systemd.conf', + install_dir : modprobedir) install_data('README', 'NEWS', 'CODING_STYLE', @@ -2393,6 +2396,7 @@ status = [ 'PAM modules dir: @0@'.format(pamlibdir), 'PAM configuration dir: @0@'.format(pamconfdir), 'RPM macros dir: @0@'.format(rpmmacrosdir), + 'modprobe.d dir: @0@'.format(modprobedir), 'D-Bus policy dir: @0@'.format(dbuspolicydir), 'D-Bus session dir: @0@'.format(dbussessionservicedir), 'D-Bus system dir: @0@'.format(dbussystemservicedir), diff --git a/modprobe.d/systemd.conf b/modprobe.d/systemd.conf new file mode 100644 index 0000000000..d32f3ce3ea --- /dev/null +++ b/modprobe.d/systemd.conf @@ -0,0 +1,14 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# When bonding module is loaded, it creates bond0 by default due to max_bonds +# option default value 1. This interferes with the network configuration +# management / networkd, as it is not possible to detect whether this bond0 was +# intentionally configured by the user, or should be managed by +# networkd/NM/etc. Therefore disable bond0 creation. + +options bonding max_bonds=0