Commit graph

71 commits

Author SHA1 Message Date
Frantisek Sumsal db6406e97e network: fix 6rd tunnel link section name
Spotted randomly when going through CI logs:

systemd-udevd[658]: /usr/lib/systemd/network/80-6rd-tunnel.link:21: Unknown section 'Network'. Ignoring.

Follow-up for 658169e6d3.
2024-01-12 21:42:04 +00:00
Yu Watanabe bc02f03561 network: fix Name= -> OriginalName= in the default .link files
Follow-up for 658169e6d3.
2024-01-11 12:20:10 +00:00
Lennart Poettering 658169e6d3 network: take explicit ownership of our own interfaces
This is a follow-up for #30786 and uses it to assign
ID_NET_MANAGED_BY=io.systemd.Network to all all network interfaces that
we consider ours to manage. This should hopefully have the effect that
other well-behaving managers won't fight for these devices.

This doesn't bother with network interfaces we match inside containers,
since udev is not available there anyway.
2024-01-10 19:56:43 +00:00
Zbigniew Jędrzejewski-Szmek 205a30fa13 meson: always install network example files
I started working on integrating this in the Fedora package and realized that
the example files should be installed regardless of the renamed files when
default-network=true is used. This is because the renamed files become part of
a different package, and we want to have the other files which are used as
documentation in the main package anyway.
2023-11-23 10:02:36 +00:00
Zbigniew Jędrzejewski-Szmek 6f4e496685
Merge pull request #29928 from yuwata/meson-default-network
meson: follow-ups for -Ddefault-network=
2023-11-14 17:33:03 +01:00
Yu Watanabe e5188e4f9b network: make 89-ethernet.network match only physical interfaces
For safety. We already add similar condition to a generated one:
c25aa6c8ac
2023-11-08 23:11:45 +09:00
Yu Watanabe f139393dd2 network: use Kind= instead of Driver=
networkd ignores errors in reading driver through ethtool. The kind of
network interface is retrieved through netlink, and networkd checks
checks many failures. So, using Kind= should be safer.

No functional change, just for safety.
2023-11-08 22:59:57 +09:00
Yu Watanabe e941da8425 meson: fix install path of example .network files
It seems that when 'rename' field is set, the path (instead of the
filename) is appended to the 'install_dir'.

Follow-up for 9b7a624267.

Fixes #29925.
2023-11-08 21:55:44 +09:00
Yu Watanabe 6256c65aad meson: /etc/systemd/network is also used by udevd 2023-11-03 12:02:51 +09:00
Yu Watanabe 9b7a624267 network: add meson option to rename .example files on install
Also this renames 80-ethernet.network.example -> 89-ethernet.network.example,
to make it have lower precedence over other default .network files for
Ethernet interfaces.

Closes #29765.
2023-11-03 11:57:46 +09:00
Yu Watanabe 71164ee9fe network: disable IPv6AcceptRA= in several default config
Also,
- drop DHCP=no, as it is the default setting,
- enable IPv6SendRA= for wifi access point,
- enable MulticastDNS= for wifi adhoc mode.
2023-11-03 11:41:52 +09:00
Yu Watanabe bae0bd0024 meson: install newly added example .network file
Follow-up for e6ba085398.
2023-11-03 11:27:18 +09:00
Lennart Poettering e6ba085398 network: add default .network file matching ID_NET_AUTO_LINK_LOCAL_ONLY=1
This is name ".network.example" for now, to match the existing
80-ethernet.network file.

I think it would make sense to actually install this by default if told
so via a meson file (and then hopefully this would happen even on
Fedora, though in a split off RPM or so). However, we aren't there yet,
hence for now, just ship the .network files as example, like the others.
2023-10-30 18:57:41 +01:00
Yu Watanabe 9289e093ae meson: use install_emptydir() and drop meson-make-symlink.sh
The script is mostly equivalent to 'mkdir -p' and 'ln -sfr'.
Let's replace it with install_emptydir() builtin function and
inline meson call.
2023-08-08 22:11:34 +01:00
Jan Janssen 17be6f2709 meson: Install missing network file 2023-01-27 17:50:27 +01:00
Zbigniew Jędrzejewski-Szmek 3fe96b6c32 network: change license of examples to MIT-0
Arguably, CC0 is just fine for examples since they are not code. But it's
easier to be consistent and just use MIT-0 for all "documentation". Thus,
the license is changed similarly code examples under man/.

Based on 'git shortlog -ns network/*' and 'git log -p', the following folks
should ack this:
  Zbigniew Jędrzejewski-Szmek
  Lennart Poettering
  Tom Gundersen
  Yu Watanabe
  Daan De Meyer
  Marc-André Lureau
2022-10-26 08:39:34 +02:00
Zbigniew Jędrzejewski-Szmek 9bd4181ef5 network: add example file that enables DHCP on ethernet links
The file has instructions how to "enable" it by symlinking into the
appropriate place. If we create a different mechanism to do enablement
later on, we can always adjust the instructions.

Closes #3998.
2022-01-12 16:05:59 +01:00
Zbigniew Jędrzejewski-Szmek 418e1f2892 network: license all config files as CC0
Same justification as the previous commit.

$ for i in network/*-*; do git blame $i;done | less
shows that those files were written by Tom Gundersen, Lennart Poettering, Yu
Watanabe, me, and Marc-André Lureau.
2022-01-12 16:05:59 +01:00
Zbigniew Jędrzejewski-Szmek ae527ed688 network: say that our example files are licensed as CC0
This matches what we have for example programs under man/, and is nice
because it allows people to copy the files as they wish without worrying
about copyright. The files are too trivial to copyright anyway.
2022-01-12 11:41:10 +01:00
Yu Watanabe e49bad0179 network: dhcp-pd: add 6rd support
Closes #19152.
2021-12-07 20:33:16 +09:00
Zbigniew Jędrzejewski-Szmek 098621aff3 licensing: add missing header to one .network file
It should have the full header because it will be installed onto
user systems like the other .network files.
2021-10-01 14:45:00 +02:00
Yu Watanabe e643c3d82d network: add 80-container-vb.network 2021-09-04 08:15:34 +09:00
Zbigniew Jędrzejewski-Szmek fce9abb227 meson: use a/b instead of join_paths(a,b)
It is nicer and shorter.
2021-07-27 19:32:35 +02:00
Lucas Magasweran b419e8776b network: examples: use wlan for Type instead of wifi 2021-05-10 11:28:52 +02:00
Yu Watanabe 6cde5b4b1c network: use IPMasquerade=both instead of yes
Follow-up for 4c72d851cd.
2021-02-24 15:01:43 +01:00
Daan De Meyer 2ec6191c38 networkd: Enable IPv6SendRA on builtin network files
RAs trigger neighbor discovery which allows users to query the
LL address of the container/VM via `ip neighbor get dev`. This is
useful as it gives users an easy way to connect to the container
without needing LLMNR or mDNS to resolve the hostname of the container
to an IP address. In practice, this allows connecting with only
networkd enabled and without resolved running in the host/container.
2021-01-06 20:00:49 +01:00
Jörg Thalheim d7aa78c32f meson: add option to skip installing to $sysconfdir
This is useful for development where overwriting files out side
the configured prefix will affect the host as well as stateless
systems such as NixOS that don't let packages install to /etc but handle
configuration on their own.

Alternative to https://github.com/systemd/systemd/pull/17501

tested with:

$ mkdir inst build && cd build
$ meson \
  -Dcreate-log-dirs=false \
  -Dsysvrcnd-path=$(realpath ../inst)/etc/rc.d \
  -Dsysvinit-path=$(realpath ../inst)/etc/init.d \
  -Drootprefix=$(realpath ../inst) \
  -Dinstall-sysconfdir=false \
  --prefix=$(realpath ../inst) ..
$ ninja install
2020-11-12 11:21:46 +01:00
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Marc-André Lureau affb59e6a2 network: add TUN/TAP vt-* network rule for VMs
VM typically use a TAP device, and work similarly to a veth device from the
host side.
2020-04-17 19:15:00 +02:00
Zbigniew Jędrzejewski-Szmek 326b1f897b Remove stray file 2020-04-06 20:45:41 +02:00
Susant Sahani 2c649ca1c9 sd-dhcp: Add support to emit and retrieve SMTP server 2020-03-28 11:21:17 +01:00
Yu Watanabe 49f5cbe924 network: set AlternativeNamesPolicy= in 99-default.link 2019-12-17 15:44:48 +09:00
Zbigniew Jędrzejewski-Szmek a9eedd3cf7 network: install wifi-adhoc.network by default, make wifi-{ap,station} examples
I think 80-wifi-adhoc.network is safe enough, since it just enables
the link-local addressing. But the other two enable DHCP in client
or server modes, and we should not do this by default.
2019-10-30 11:21:41 +01:00
Zbigniew Jędrzejewski-Szmek 1bcefad919 Merge pull request #13623 from yuwata/network-wifi-iftype 2019-10-25 14:19:06 +02:00
Yu Watanabe 15e089644c network: add default configurations for wireless interfaces 2019-10-25 16:43:24 +09:00
Yu Watanabe 84ea567eb4 udev,network: warn when .link or .network file has no [Match] section
Closes #12098.
2019-04-25 08:41:10 +02:00
Zbigniew Jędrzejewski-Szmek 3907446f02 link-config: add "keep" policy and use it by default
If "keep" policy is specified, and the interface has a name that is
NET_NAME_USER or NET_NAME_RENAMED, we stop processing rules. "keep" should
probably be specified either first or last depending on the preference.

This partially reimplements 55b6530baa, in the
sense that if the "keep" policy is not specified, and if the interface has
a NamingPolicy, it will be renamed, even if it had a name previously.
So this breaks backwards compatibility in this case, but that's more in line
with what users expect.

Closes #9006.
2019-01-17 13:56:02 +01:00
Zbigniew Jędrzejewski-Szmek 0cd41d4dff Drop my copyright headers
perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms'
git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
2018-06-14 13:03:20 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Zbigniew Jędrzejewski-Szmek 3a726fcd08 Add license headers and SPDX identifiers to meson.build files
So far I avoided adding license headers to meson files, but they are pretty
big and important and should carry license headers like everything else.
I added my own copyright, even though other people modified those files too.
But this is mostly symbolic, so I hope that's OK.
2017-11-19 19:08:15 +01:00
Zbigniew Jędrzejewski-Szmek d9215cd838 Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
Zbigniew Jędrzejewski-Szmek 349cc4a507 build-sys: use #if Y instead of #ifdef Y everywhere
The advantage is that is the name is mispellt, cpp will warn us.

$ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/"
$ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;'
$ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g'
$ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g'
+ manual changes to meson.build

squash! build-sys: use #if Y instead of #ifdef Y everywhere

v2:
- fix incorrect setting of HAVE_LIBIDN2
2017-10-04 12:09:29 +02:00
Zbigniew Jędrzejewski-Szmek 72cdb3e783 build-sys: drop automake support
v2:
- also mention m4
2017-07-18 10:04:44 -04:00
Zbigniew Jędrzejewski-Szmek 2c201c2140 meson: use booleans for conf.set and drop unecessary conditionals
Using conf.set() with a boolean argument does the right thing:
either #ifdef or #undef. This means that conf.set can be used unconditionally.

Previously I used '1' as the placeholder value, and that needs to be changed to
'true' for consistency (under meson 1 cannot be used in boolean context). All
checks need to be adjusted.
2017-05-02 16:29:11 -04:00
Zbigniew Jędrzejewski-Szmek 37efbbd821 meson: reindent all files with 8 spaces
The indentation for emacs'es meson-mode is added .dir-locals.

All files are reindented automatically, using the lasest meson-mode from git.
Indentation should now be fairly consistent.
2017-04-23 21:47:29 -04:00
Zbigniew Jędrzejewski-Szmek 9ac47f3815 meson: fix condition for installation of .in units, 99-default.link
The condition to install in_units was calculated, but not used.

99-default.link should be installed uncoditionally.
2017-04-23 21:47:28 -04:00
Michael Biebl e17e5ba9bf meson: use join_paths consistently
With -Dsplit-usr=true, we set rootprefix to /. This leads to //lib/systemd or
//lib/udev for various dir variables. Using join_paths() avoids this.
2017-04-23 21:47:28 -04:00
Zbigniew Jędrzejewski-Szmek 94e75a5409 meson: create dirs and touch /usr
This is the equivalent of $(INSTALL_DIRS) and install-touch-usr-hook.
I did not bother to create the directories into which we install files,
since they will be created anyway.

v2:
- remove bashism
2017-04-23 21:47:27 -04:00
Zbigniew Jędrzejewski-Szmek 5c23128dab meson: build systemd using meson
It's crucial that we can build systemd using VS2010!

... er, wait, no, that's not the official reason. We need to shed old systems
by requring python 3! Oh, no, it's something else. Maybe we need to throw out
345 years of knowlege accumulated in autotools? Whatever, this new thing is
cool and shiny, let's use it.

This is not complete, I'm throwing it out here for your amusement and critique.

- rules for sd-boot are missing. Those might be quite complicated.

- rules for tests are missing too. Those are probably quite simple and
  repetitive, but there's lots of them.

- it's likely that I didn't get all the conditions right, I only tested "full"
  compilation where most deps are provided and nothing is disabled.

- busname.target and all .busname units are skipped on purpose.

  Otherwise, installation into $DESTDIR has the same list of files and the
  autoconf install, except for .la files.

It'd be great if people had a careful look at all the library linking options.
I added stuff until things compiled, and in the end there's much less linking
then in the old system. But it seems that there's still a lot of unnecessary
deps.

meson has a `shared_module` statement, which sounds like something appropriate
for our nss and pam modules. Unfortunately, I couldn't get it to work. For the
nss modules, we need an .so version of '2', but `shared_module` disallows the
version argument. For the pam module, it also didn't work, I forgot the reason.

The handling of .m4 and .in and .m4.in files is rather awkward. It's likely
that this could be simplified. If make support is ever dropped, I think it'd
make sense to switch to a different templating system so that two different
languages and not required, which would make everything simpler yet.

v2:
- use get_pkgconfig_variable
- use sh not bash
- use add_project_arguments

v3:
- drop required:true and fix progs/prog typo

v4:
- use find_library('bz2')
- add TTY_GID definition
- define __SANE_USERSPACE_TYPES__
- use join_paths(prefix, ...) is used on all paths to make them all absolute

v5:
- replace all declare_dependency's with []
- add more conf.get guards around optional components

v6:
- drop -pipe, -Wall which are the default in meson
- use compiler.has_function() and compiler.has_header_symbol instead of the
  hand-rolled checks.
- fix duplication in 'liblibsystemd' library name
- use the right .sym file for pam_systemd
- rename 'compiler' to 'cc': shorter, and more idiomatic.

v7:
- use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D
- rename prefix to prefixdir, rootprefix to rootprefixdir
  ("prefix" is too common of a name and too easy to overwrite by mistake)
- wrap more stuff with conf.get('ENABLE...') == 1
- use rootprefix=='/' and rootbindir as install_dir, to fix paths under
  split-usr==true.

v8:
- use .split() also for src/coredump. Now everything is consistent ;)
- add rootlibdir option and use it on the libraries that require it

v9:
- indentation

v10:
- fix check for qrencode and libaudit

v11:
- unify handling of executable paths, provide options for all progs

  This makes the meson build behave slightly differently than the
  autoconf-based one, because we always first try to find the executable in the
  filesystem, and fall back to the default. I think different handling of
  loadkeys, setfont, and telinit was just a historical accident.

  In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs.
  In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin),
  but in Debian, those directories are not included in the path.

  C.f. https://github.com/mesonbuild/meson/issues/1576.

- call all the options 'xxx-path' for clarity.
- sort man/rules/meson.build properly so it's stable
2017-04-23 21:47:26 -04:00