]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #12510 from keszybz/test-directives
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 20 May 2019 23:35:10 +0000 (08:35 +0900)
committerGitHub <noreply@github.com>
Mon, 20 May 2019 23:35:10 +0000 (08:35 +0900)
test: run check-directives.sh as part of the test suite

38 files changed:
man/bootctl.xml
man/html.in [new file with mode: 0755]
man/man.in [new file with mode: 0755]
man/meson.build
man/systemd-nspawn.xml
man/systemd.mount.xml
man/systemd.network.xml
man/systemd.unit.xml
meson.build
meson_options.txt
semaphoreci/semaphore-runner.sh
src/basic/in-addr-util.c
src/basic/in-addr-util.h
src/basic/process-util.c
src/basic/process-util.h
src/boot/bootctl.c
src/core/manager.c
src/network/networkd-manager.c
src/network/networkd-ndisc.c
src/network/networkd-ndisc.h
src/network/networkd-network-gperf.gperf
src/network/networkd-network.c
src/network/networkd-network.h
src/shared/efivars.c
src/shared/json.c
sysctl.d/50-default.conf
sysctl.d/50-pid-max.conf [new file with mode: 0644]
sysctl.d/meson.build
test/TEST-32-OOMPOLICY/Makefile [moved from test/TEST-31-OOMPOLICY/Makefile with 100% similarity]
test/TEST-32-OOMPOLICY/test.sh [moved from test/TEST-31-OOMPOLICY/test.sh with 92% similarity]
test/TEST-32-OOMPOLICY/testsuite.sh [moved from test/TEST-31-OOMPOLICY/testsuite.sh with 91% similarity]
test/fuzz/fuzz-network-parser/directives.network
test/test-functions
tools/meson-vcs-tag.sh
travis-ci/managers/debian.sh
travis-ci/managers/fedora.sh
travis-ci/managers/fuzzbuzz.sh
travis-ci/managers/xenial.sh

index a80a37309c9f0022661238986afbf52ee67b684d..46b9738b148acc4a9a08752c8c2373b0a1340df5 100644 (file)
       <varlistentry>
         <term><option>-p</option></term>
         <term><option>--print-esp-path</option></term>
-        <listitem><para>This option modifies the behaviour of <command>status</command>.  Prints only the
-        path to the EFI System Partition (ESP) to standard output and exits.</para></listitem>
+        <listitem><para>This option modifies the behaviour of <command>status</command>. Only prints the path
+        to the EFI System Partition (ESP) to standard output and exits.</para></listitem>
       </varlistentry>
 
       <varlistentry>
+        <term><option>-x</option></term>
         <term><option>--print-boot-path</option></term>
-        <listitem><para>This option modifies the behaviour of <command>status</command>.  Prints only the
-        path to the Extended Boot Loader partition if it exists, and the path to the ESP otherwise to
-        standard output and exit. This command is useful to determine where to place boot loader entries, as
-        they are preferably placed in the Extended Boot Loader partition if it exists and in the ESP
-        otherwise.</para></listitem>
+        <listitem><para>This option modifies the behaviour of <command>status</command>. Only prints the path
+        to the Extended Boot Loader partition if it exists, and the path to the ESP otherwise to standard
+        output and exit. This command is useful to determine where to place boot loader entries, as they are
+        preferably placed in the Extended Boot Loader partition if it exists and in the ESP otherwise.
+        </para></listitem>
       </varlistentry>
 
       <varlistentry>
diff --git a/man/html.in b/man/html.in
new file mode 100755 (executable)
index 0000000..d4debcc
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+if [ -z "$1" ]; then
+    echo "Use: $0 page-name (with no section suffix)"
+    exit 1
+fi
+
+target="man/$1.html"
+ninja -C "@BUILD_ROOT@" "$target"
+set -x
+exec xdg-open build/"$target"
diff --git a/man/man.in b/man/man.in
new file mode 100755 (executable)
index 0000000..5700a64
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -e
+
+if [ -z "$1" ]; then
+    echo "Use: $0 page-name (with no section suffix)"
+    exit 1
+fi
+
+target=$(ninja -C "@BUILD_ROOT@" -t query man/man | grep -E -m1 "man/$1\.[0-9]$" | awk '{print $2}')
+if [ -z "$target" ]; then
+    echo "Cannot find page $1"
+    exit 1
+fi
+ninja -C "@BUILD_ROOT@" "$target"
+exec man build/"$target"
index ae9c941fcdafe54b42286c4e4068f1dcf71204b0..f3992b28341698418be576efbaae07608be6174b 100644 (file)
@@ -204,3 +204,15 @@ if git.found()
                            'mv t @0@/rules/meson.build'.format(meson.current_source_dir())],
                 depend_files : custom_entities_ent)
 endif
+
+############################################################
+
+configure_file(
+        input : 'man.in',
+        output : 'man',
+        configuration : substs)
+
+configure_file(
+        input : 'html.in',
+        output : 'html',
+        configuration : substs)
index 5ba162b93cadf2fa3a252ddbb19b5b30315fa9d8..f1d6f14812519b6765078d71fcdb17853e4f85c1 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version='1.0'?>
 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
-<!ENTITY fedora_latest_version "28">
-<!ENTITY fedora_cloud_release "1.1">
+<!ENTITY fedora_latest_version "30">
+<!ENTITY fedora_cloud_release "1.2">
 ]>
 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
 
 
       <programlisting># machinectl pull-raw --verify=no \
       https://download.fedoraproject.org/pub/fedora/linux/releases/&fedora_latest_version;/Cloud/x86_64/images/Fedora-Cloud-Base-&fedora_latest_version;-&fedora_cloud_release;.x86_64.raw.xz
-# systemd-nspawn -M Fedora-Cloud-Base-&fedora_latest_version;-&fedora_cloud_release;.x86_64.raw</programlisting>
+# systemd-nspawn -M Fedora-Cloud-Base-&fedora_latest_version;-&fedora_cloud_release;.x86_64</programlisting>
 
       <para>This downloads an image using
       <citerefentry><refentrytitle>machinectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
index 022e227e837ec81d054742b489b0213f1dbf62f6..178dc188a5a2a35ea096cc96b2d0027e398834d0 100644 (file)
     mount options are understood by systemd which influence how
     dependencies are created for mount points. systemd will create a
     dependency of type <varname>Wants=</varname> or
-    <option>Requires</option> (see option <option>nofail</option>
+    <option>Requires=</option> (see option <option>nofail</option>
     below), from either <filename>local-fs.target</filename> or
     <filename>remote-fs.target</filename>, depending whether the file
     system is local or remote.</para>
index 4279326bc27bce8fdb89802d0760cc748193b671..695bcaa0a47020475e8056457cff8d6891e7cb25 100644 (file)
           </listitem>
         </varlistentry>
 
+        <varlistentry>
+          <term><varname>BlackList=</varname></term>
+          <listitem>
+            <para>A whitespace-separated list of IPv4 addresses. DHCP offers from servers in the list are rejected.</para>
+          </listitem>
+        </varlistentry>
+
       </variablelist>
     </refsect1>
 
         <varlistentry>
           <term><varname>BlackList=</varname></term>
           <listitem>
-            <para>A whitespace-separated list of IPv4 addresses. DHCP offers from servers in the list are rejected.</para>
+            <para>A whitespace-separated list of IPv6 prefixes. IPv6 prefixes supplied via router advertisements in the list are ignored.</para>
           </listitem>
         </varlistentry>
 
index 84af5109b82a546fe24684e4f74336dc3e2561ff..3079db1a6ba6177e12e031e2c05b3b5f2611fd1c 100644 (file)
         "Forward" and "reverse" unit properties
       </title>
 
-      <tgroup cols='2'>
+      <tgroup cols='4'>
         <colspec colname='forward' />
         <colspec colname='reverse' />
-        <colspec colname='notes' />
+        <colspec colname='fuse' />
+        <colspec colname='ruse' />
         <thead>
           <row>
             <entry>"Forward" property</entry>
             <entry>"Reverse" property</entry>
-            <entry>Where used</entry>
+            <entry namest='fuse' nameend='ruse' valign='middle'>Where used</entry>
           </row>
         </thead>
         <tbody>
           <row>
             <entry><varname>Before=</varname></entry>
             <entry><varname>After=</varname></entry>
-            <entry morerows='1' valign='middle'>Both are unit file options</entry>
+            <entry morerows='1' namest='fuse' nameend='ruse' valign='middle'>[Unit] section</entry>
           </row>
           <row>
             <entry><varname>After=</varname></entry>
           <row>
             <entry><varname>Requires=</varname></entry>
             <entry><varname>RequiredBy=</varname></entry>
-            <entry>A unit file option; an option in the [Install] section</entry>
+            <entry>[Unit] section</entry>
+            <entry>[Install] section</entry>
           </row>
           <row>
             <entry><varname>Wants=</varname></entry>
             <entry><varname>WantedBy=</varname></entry>
-            <entry>A unit file option; an option in the [Install] section</entry>
+            <entry>[Unit] section</entry>
+            <entry>[Install] section</entry>
           </row>
           <row>
             <entry><varname>PartOf=</varname></entry>
             <entry><varname>ConsistsOf=</varname></entry>
-            <entry>A unit file option; an automatic property</entry>
+            <entry>[Unit] section</entry>
+            <entry>an automatic property</entry>
           </row>
           <row>
             <entry><varname>BindsTo=</varname></entry>
             <entry><varname>BoundBy=</varname></entry>
-            <entry>A unit file option; an automatic property</entry>
+            <entry>[Unit] section</entry>
+            <entry>an automatic property</entry>
           </row>
           <row>
             <entry><varname>Requisite=</varname></entry>
             <entry><varname>RequisiteOf=</varname></entry>
-            <entry>A unit file option; an automatic property</entry>
+            <entry>[Unit] section</entry>
+            <entry>an automatic property</entry>
           </row>
           <row>
             <entry><varname>Triggers=</varname></entry>
             <entry><varname>TriggeredBy=</varname></entry>
-            <entry>Automatic properties, see notes below</entry>
+            <entry namest='fuse' nameend='ruse' valign='middle'>Automatic properties, see notes below</entry>
           </row>
           <row>
             <entry><varname>Conflicts=</varname></entry>
             <entry><varname>ConflictedBy=</varname></entry>
-            <entry>A unit file option; an automatic property</entry>
+            <entry>[Unit] section</entry>
+            <entry>an automatic property</entry>
           </row>
           <row>
             <entry><varname>PropagatesReloadTo=</varname></entry>
             <entry><varname>ReloadPropagatedFrom=</varname></entry>
-            <entry morerows='1' valign='middle'>Both are unit file options</entry>
+            <entry morerows='1' namest='fuse' nameend='ruse' valign='middle'>[Unit] section</entry>
           </row>
           <row>
             <entry><varname>ReloadPropagatedFrom=</varname></entry>
index 3bbe79f41fd16813e6e1e475bcada67c70b83a17..cd2fbd5796d960e2a819c70c1a53d3549cee440f 100644 (file)
@@ -283,6 +283,7 @@ substs.set('RC_LOCAL_SCRIPT_PATH_START',                      get_option('rc-loc
 substs.set('RC_LOCAL_SCRIPT_PATH_STOP',                       get_option('halt-local'))
 substs.set('MEMORY_ACCOUNTING_DEFAULT',                       memory_accounting_default ? 'yes' : 'no')
 substs.set('HIGH_RLIMIT_NOFILE',                              conf.get('HIGH_RLIMIT_NOFILE'))
+substs.set('BUILD_ROOT',                                      meson.current_build_dir())
 
 #####################################################################
 
index c1cb4617d0fc2511dd8dec7d318bd45fb341f4ab..5d68970ff6b5c776d292b1743ac62a6e823a336b 100644 (file)
@@ -126,6 +126,7 @@ option('hwdb', type : 'boolean',
 option('rfkill', type : 'boolean',
        description : 'support for the rfkill tools')
 option('man', type : 'combo', choices : ['auto', 'true', 'false'],
+       value : 'false',
        description : 'build and install man pages')
 option('html', type : 'combo', choices : ['auto', 'true', 'false'],
        value : 'false',
index dc1c8ff40c63c2ebcf87ee4284523884e5a76249..1951dcbbada6a8e9fe6bdf33025ac99e8b8fb4ea 100755 (executable)
@@ -88,7 +88,7 @@ EOF
             # disable autopkgtests which are not for upstream
             sed -i '/# NOUPSTREAM/ q' debian/tests/control
             # enable more unit tests
-            sed -i '/^CONFFLAGS =/ s/=/= -Dtests=unsafe -Dsplit-usr=true -Dslow-tests=true /' debian/rules
+            sed -i '/^CONFFLAGS =/ s/=/= -Dtests=unsafe -Dsplit-usr=true -Dslow-tests=true -Dman=true /' debian/rules
             # no orig tarball
             echo '1.0' > debian/source/format
 
index 1d5c6412b5ba50bcd587a3e2dba92acb6b84abb9..c1fab51b5e43db651d29dce01077d269bb98d862 100644 (file)
@@ -738,3 +738,15 @@ static int in_addr_data_compare_func(const struct in_addr_data *x, const struct
 }
 
 DEFINE_HASH_OPS(in_addr_data_hash_ops, struct in_addr_data, in_addr_data_hash_func, in_addr_data_compare_func);
+
+static void in6_addr_hash_func(const struct in6_addr *addr, struct siphash *state) {
+        assert(addr);
+
+        siphash24_compress(addr, sizeof(*addr), state);
+}
+
+static int in6_addr_compare_func(const struct in6_addr *a, const struct in6_addr *b) {
+        return memcmp(a, b, sizeof(*a));
+}
+
+DEFINE_HASH_OPS(in6_addr_hash_ops, struct in6_addr, in6_addr_hash_func, in6_addr_compare_func);
index a6a685b9188b5084e1b699a0afbb535cf77a1c41..2ca7f4b32fc88b5d8a9ecd2674661839821f4015 100644 (file)
@@ -72,3 +72,4 @@ static inline size_t FAMILY_ADDRESS_SIZE(int family) {
 #define IN_ADDR_NULL ((union in_addr_union) { .in6 = {} })
 
 extern const struct hash_ops in_addr_data_hash_ops;
+extern const struct hash_ops in6_addr_hash_ops;
index 3dc3534e1ab21556b2bc81918345ed93c3876ad5..052bce6645f396694cac5da55274d792c0547d1f 100644 (file)
@@ -44,7 +44,7 @@
 #include "terminal-util.h"
 #include "user-util.h"
 
-int get_process_state(pid_t pid) {
+static int get_process_state(pid_t pid) {
         const char *p;
         char state;
         int r;
index 7e1d65a7bf1b3c52c9b7c8d3e982d72be127308d..83ba93d0d74aa3b45aa8558ce14bfe85dd025118 100644 (file)
@@ -31,7 +31,6 @@
                 _r_;                                                    \
         })
 
-int get_process_state(pid_t pid);
 int get_process_comm(pid_t pid, char **name);
 int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char **line);
 int get_process_exe(pid_t pid, char **name);
index 9df181a10c957860d1b5dbc8b771f168455b61e2..55924adf069cdd0daf10c3d38b62d4e61a9a8e0f 100644 (file)
@@ -326,7 +326,7 @@ static int boot_entry_file_check(const char *root, const char *p) {
 static void boot_entry_file_list(const char *field, const char *root, const char *p, int *ret_status) {
         int status = boot_entry_file_check(root, p);
 
-        printf("%13s%s", strempty(field), field ? ":" : " ");
+        printf("%13s%s ", strempty(field), field ? ":" : " ");
         if (status < 0) {
                 errno = -status;
                 printf("%s%s%s (%m)\n", ansi_highlight_red(), p, ansi_normal());
@@ -997,7 +997,7 @@ static int help(int argc, char *argv[], void *userdata) {
                "     --esp-path=PATH   Path to the EFI System Partition (ESP)\n"
                "     --boot-path=PATH  Path to the $BOOT partition\n"
                "  -p --print-esp-path  Print path to the EFI System Partition\n"
-               "     --print-boot-path Print path to the $BOOT partition\n"
+               "  -x --print-boot-path Print path to the $BOOT partition\n"
                "     --no-variables    Don't touch EFI variables\n"
                "     --no-pager        Do not pipe output into a pager\n"
                "\nBoot Loader Commands:\n"
@@ -1020,7 +1020,6 @@ static int parse_argv(int argc, char *argv[]) {
         enum {
                 ARG_ESP_PATH = 0x100,
                 ARG_BOOT_PATH,
-                ARG_PRINT_BOOT_PATH,
                 ARG_VERSION,
                 ARG_NO_VARIABLES,
                 ARG_NO_PAGER,
@@ -1034,7 +1033,7 @@ static int parse_argv(int argc, char *argv[]) {
                 { "boot-path",       required_argument, NULL, ARG_BOOT_PATH       },
                 { "print-esp-path",  no_argument,       NULL, 'p'                 },
                 { "print-path",      no_argument,       NULL, 'p'                 }, /* Compatibility alias */
-                { "print-boot-path", no_argument,       NULL, ARG_PRINT_BOOT_PATH },
+                { "print-boot-path", no_argument,       NULL, 'x'                 },
                 { "no-variables",    no_argument,       NULL, ARG_NO_VARIABLES    },
                 { "no-pager",        no_argument,       NULL, ARG_NO_PAGER        },
                 {}
@@ -1045,7 +1044,7 @@ static int parse_argv(int argc, char *argv[]) {
         assert(argc >= 0);
         assert(argv);
 
-        while ((c = getopt_long(argc, argv, "hp", options, NULL)) >= 0)
+        while ((c = getopt_long(argc, argv, "hpx", options, NULL)) >= 0)
                 switch (c) {
 
                 case 'h':
@@ -1068,10 +1067,16 @@ static int parse_argv(int argc, char *argv[]) {
                         break;
 
                 case 'p':
+                        if (arg_print_dollar_boot_path)
+                                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                                       "--print-boot-path/-x cannot be combined with --print-esp-path/-p");
                         arg_print_esp_path = true;
                         break;
 
-                case ARG_PRINT_BOOT_PATH:
+                case 'x':
+                        if (arg_print_esp_path)
+                                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                                       "--print-boot-path/-x cannot be combined with --print-esp-path/-p");
                         arg_print_dollar_boot_path = true;
                         break;
 
index b7848648bebfd430ed0c86c161937feff3200e1d..c11cb23aa9f2f0488c11ea95f1f63955d5c15ada 100644 (file)
@@ -2472,7 +2472,7 @@ static int manager_dispatch_sigchld(sd_event_source *source, void *userdata) {
         assert(source);
         assert(m);
 
-        /* First we call waitd() for a PID and do not reap the zombie. That way we can still access /proc/$PID for it
+        /* First we call waitid() for a PID and do not reap the zombie. That way we can still access /proc/$PID for it
          * while it is a zombie. */
 
         if (waitid(P_ALL, 0, &si, WEXITED|WNOHANG|WNOWAIT) < 0) {
index 1af25dc812c6275acfbaedfe46987348df5befd0..de177e6d1abfa9e80d72a4eed5f519fbc97ec3c1 100644 (file)
@@ -1264,18 +1264,6 @@ static int dhcp6_route_add_handler(sd_netlink *nl, sd_netlink_message *m, Link *
         return 0;
 }
 
-static void dhcp6_prefixes_hash_func(const struct in6_addr *addr, struct siphash *state) {
-        assert(addr);
-
-        siphash24_compress(addr, sizeof(*addr), state);
-}
-
-static int dhcp6_prefixes_compare_func(const struct in6_addr *a, const struct in6_addr *b) {
-        return memcmp(a, b, sizeof(*a));
-}
-
-DEFINE_PRIVATE_HASH_OPS(dhcp6_prefixes_hash_ops, struct in6_addr, dhcp6_prefixes_hash_func, dhcp6_prefixes_compare_func);
-
 int manager_dhcp6_prefix_add(Manager *m, struct in6_addr *addr, Link *link) {
         _cleanup_free_ struct in6_addr *a = NULL;
         _cleanup_free_ char *buf = NULL;
@@ -1308,7 +1296,7 @@ int manager_dhcp6_prefix_add(Manager *m, struct in6_addr *addr, Link *link) {
         if (!a)
                 return -ENOMEM;
 
-        r = hashmap_ensure_allocated(&m->dhcp6_prefixes, &dhcp6_prefixes_hash_ops);
+        r = hashmap_ensure_allocated(&m->dhcp6_prefixes, &in6_addr_hash_ops);
         if (r < 0)
                 return r;
 
index 28d46f5fe37c456a26ad8b06cc462d18cdf58aec..3016f3448bddc9644767010f21f0246ae62e71d4 100644 (file)
@@ -557,6 +557,46 @@ static int ndisc_router_process_options(Link *link, sd_ndisc_router *rt) {
         return 0;
 }
 
+static int ndisc_prefix_is_black_listed(Link *link, sd_ndisc_router *rt) {
+        int r;
+
+        assert(link);
+        assert(link->network);
+        assert(rt);
+
+        for (r = sd_ndisc_router_option_rewind(rt); ; r = sd_ndisc_router_option_next(rt)) {
+                union in_addr_union a;
+                uint8_t type;
+
+                if (r < 0)
+                        return log_link_warning_errno(link, r, "Failed to iterate through options: %m");
+                if (r == 0) /* EOF */
+                        return false;
+
+                r = sd_ndisc_router_option_get_type(rt, &type);
+                if (r < 0)
+                        return log_link_warning_errno(link, r, "Failed to get RA option type: %m");
+
+                if (type != SD_NDISC_OPTION_PREFIX_INFORMATION)
+                        continue;
+
+                r = sd_ndisc_router_prefix_get_address(rt, &a.in6);
+                if (r < 0)
+                        return log_link_error_errno(link, r, "Failed to get prefix address: %m");
+
+                if (set_contains(link->network->ndisc_black_listed_prefix, &a.in6)) {
+                        if (DEBUG_LOGGING) {
+                                _cleanup_free_ char *b = NULL;
+
+                                (void) in_addr_to_string(AF_INET6, &a, &b);
+                                log_link_debug(link, "Prefix '%s' is black listed, ignoring", strna(b));
+                        }
+
+                        return true;
+                }
+        }
+}
+
 static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) {
         uint64_t flags;
         int r;
@@ -581,8 +621,10 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) {
                 }
         }
 
-        (void) ndisc_router_process_default(link, rt);
-        (void) ndisc_router_process_options(link, rt);
+        if (ndisc_prefix_is_black_listed(link, rt) == 0) {
+                (void) ndisc_router_process_default(link, rt);
+                (void) ndisc_router_process_options(link, rt);
+        }
 
         return r;
 }
@@ -672,3 +714,76 @@ void ndisc_flush(Link *link) {
         link->ndisc_rdnss = set_free_free(link->ndisc_rdnss);
         link->ndisc_dnssl = set_free_free(link->ndisc_dnssl);
 }
+
+int config_parse_ndisc_black_listed_prefix(
+                const char *unit,
+                const char *filename,
+                unsigned line,
+                const char *section,
+                unsigned section_line,
+                const char *lvalue,
+                int ltype,
+                const char *rvalue,
+                void *data,
+                void *userdata) {
+
+        Network *network = data;
+        const char *p;
+        int r;
+
+        assert(filename);
+        assert(lvalue);
+        assert(rvalue);
+        assert(data);
+
+        if (isempty(rvalue)) {
+                network->ndisc_black_listed_prefix = set_free_free(network->ndisc_black_listed_prefix);
+                return 0;
+        }
+
+        for (p = rvalue;;) {
+                _cleanup_free_ char *n = NULL;
+                _cleanup_free_ struct in6_addr *a = NULL;
+                union in_addr_union ip;
+
+                r = extract_first_word(&p, &n, NULL, 0);
+                if (r < 0) {
+                        log_syntax(unit, LOG_ERR, filename, line, r,
+                                   "Failed to parse NDISC black listed prefix, ignoring assignment: %s",
+                                   rvalue);
+                        return 0;
+                }
+                if (r == 0)
+                        return 0;
+
+                r = in_addr_from_string(AF_INET6, n, &ip);
+                if (r < 0) {
+                        log_syntax(unit, LOG_ERR, filename, line, r,
+                                   "NDISC black listed prefix is invalid, ignoring assignment: %s", n);
+                        continue;
+                }
+
+                r = set_ensure_allocated(&network->ndisc_black_listed_prefix, &in6_addr_hash_ops);
+                if (r < 0)
+                        return log_oom();
+
+                a = newdup(struct in6_addr, &ip.in6, 1);
+                if (!a)
+                        return log_oom();
+
+                r = set_put(network->ndisc_black_listed_prefix, a);
+                if (r < 0) {
+                        if (r == -EEXIST)
+                                log_syntax(unit, LOG_WARNING, filename, line, r,
+                                           "NDISC black listed prefixs is duplicated, ignoring assignment: %s", n);
+                        else
+                                log_syntax(unit, LOG_ERR, filename, line, r,
+                                           "Failed to store NDISC black listed prefix '%s', ignoring assignment: %m", n);
+                        continue;
+                }
+
+                TAKE_PTR(a);
+        }
+
+        return 0;
+}
index 0b614bf50ffcc35c1186004a96223129f4726b4b..dc0a44f523096dd5b075d358994f1a9b7ff95cf3 100644 (file)
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 #pragma once
 
+#include "conf-parser.h"
 #include "networkd-link.h"
 #include "time-util.h"
 
@@ -21,3 +22,5 @@ static inline char* NDISC_DNSSL_DOMAIN(const NDiscDNSSL *n) {
 int ndisc_configure(Link *link);
 void ndisc_vacuum(Link *link);
 void ndisc_flush(Link *link);
+
+CONFIG_PARSER_PROTOTYPE(config_parse_ndisc_black_listed_prefix);
index 4d2f41fe400a1674a98cf9e3c8bdff0ca356f5ed..9ef07ea372be1927393cc95028d4f5284b51aa0d 100644 (file)
@@ -6,6 +6,7 @@ _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
 #include "conf-parser.h"
 #include "network-internal.h"
 #include "networkd-conf.h"
+#include "networkd-ndisc.h"
 #include "networkd-network.h"
 #include "vlan-util.h"
 %}
@@ -162,6 +163,7 @@ IPv6AcceptRA.UseOnLinkPrefix,           config_parse_bool,
 IPv6AcceptRA.UseDNS,                    config_parse_bool,                               0,                             offsetof(Network, ipv6_accept_ra_use_dns)
 IPv6AcceptRA.UseDomains,                config_parse_dhcp_use_domains,                   0,                             offsetof(Network, ipv6_accept_ra_use_domains)
 IPv6AcceptRA.RouteTable,                config_parse_section_route_table,                0,                             0
+IPv6AcceptRA.BlackList,                 config_parse_ndisc_black_listed_prefix,          0,                             0
 DHCPServer.MaxLeaseTimeSec,             config_parse_sec,                                0,                             offsetof(Network, dhcp_server_max_lease_time_usec)
 DHCPServer.DefaultLeaseTimeSec,         config_parse_sec,                                0,                             offsetof(Network, dhcp_server_default_lease_time_usec)
 DHCPServer.EmitDNS,                     config_parse_bool,                               0,                             offsetof(Network, dhcp_server_emit_dns)
index fcfb6d2e17f881141367666b7148700d981873d4..a5e7cad58a4c9b910d4bd647e8397fe26912a424 100644 (file)
@@ -505,6 +505,7 @@ static Network *network_free(Network *network) {
 
         ordered_set_free_free(network->router_search_domains);
         free(network->router_dns);
+        set_free_free(network->ndisc_black_listed_prefix);
 
         free(network->bridge_name);
         free(network->bond_name);
@@ -1658,11 +1659,6 @@ int config_parse_dhcp_black_listed_ip_address(
                         return log_oom();
 
                 r = set_put(network->dhcp_black_listed_ip, UINT32_TO_PTR(ip.in.s_addr));
-                if (r == -EEXIST) {
-                        log_syntax(unit, LOG_WARNING, filename, line, r,
-                                   "DHCP black listed ip address is duplicated, ignoring assignment: %s", n);
-                        continue;
-                }
                 if (r < 0)
                         log_syntax(unit, LOG_ERR, filename, line, r,
                                    "Failed to store DHCP black listed ip address '%s', ignoring assignment: %m", n);
index 7c434f6af22493ab57cc691b2cfd68a238874f48..d2a0b8c5f14ee6d59e637d4033d7da34390ae7a7 100644 (file)
@@ -214,6 +214,7 @@ struct Network {
         DHCPUseDomains ipv6_accept_ra_use_domains;
         uint32_t ipv6_accept_ra_route_table;
         bool ipv6_accept_ra_route_table_set;
+        Set *ndisc_black_listed_prefix;
 
         union in_addr_union ipv6_token;
         IPv6PrivacyExtensions ipv6_privacy_extensions;
index 1bd8835633c2d31202ff53d080e8be56b2bb9a67..f16c2db739625598add525dd43034fcee5589095 100644 (file)
@@ -909,7 +909,7 @@ bool efi_loader_entry_name_valid(const char *s) {
         if (strlen(s) > FILENAME_MAX) /* Make sure entry names fit in filenames */
                 return false;
 
-        return in_charset(s, ALPHANUMERICAL "-_.");
+        return in_charset(s, ALPHANUMERICAL "+-_.");
 }
 
 char *efi_tilt_backslashes(char *s) {
index 073f800b3464301eae6595549b71a3e8ab2cedc3..782d80af16aac0a2d77e591bd872b95e445340e2 100644 (file)
@@ -2296,9 +2296,9 @@ static int json_parse_internal(
                 column = &column_buffer;
 
         for (;;) {
+                _cleanup_(json_variant_unrefp) JsonVariant *add = NULL;
                 _cleanup_free_ char *string = NULL;
                 unsigned line_token, column_token;
-                JsonVariant *add = NULL;
                 JsonStack *current;
                 JsonValue value;
                 int token;
@@ -2591,7 +2591,7 @@ static int json_parse_internal(
                                 goto finish;
                         }
 
-                        current->elements[current->n_elements++] = add;
+                        current->elements[current->n_elements++] = TAKE_PTR(add);
                 }
         }
 
index ace2302589f486d4febc2259dfab078c4b635148..27084f62424bf2cf3407c7a1a6bcc6bed2aa15b9 100644 (file)
@@ -40,7 +40,3 @@ fs.protected_symlinks = 1
 # Enable regular file and FIFO protection
 fs.protected_regular = 1
 fs.protected_fifos = 1
-
-# Bump the numeric PID range to its maximum of 2^22 (from the in-kernel default
-# of 2^16), to make PID collisions less likely.
-kernel.pid_max = 4194304
diff --git a/sysctl.d/50-pid-max.conf b/sysctl.d/50-pid-max.conf
new file mode 100644 (file)
index 0000000..1eff2d7
--- /dev/null
@@ -0,0 +1,16 @@
+#  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.
+
+# See sysctl.d(5) and core(5) for documentation.
+
+# To override settings in this file, create a local file in /etc
+# (e.g. /etc/sysctl.d/90-override.conf), and put any assignments
+# there.
+
+# Bump the numeric PID range to its maximum of 2^22 (from the in-kernel default
+# of 2^16), to make PID collisions less likely.
+kernel.pid_max = 4194304
index 64f6ce942edd6bd6f8c9f61aaeaca0744265ba44..3f072e3db77cd85af37a7cec9d04f1c41024eee8 100644 (file)
@@ -6,6 +6,13 @@ install_data(
 
 in_files = []
 
+# Kernel determines PID_MAX_LIMIT by
+# #define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
+#         (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
+if cc.sizeof('long') > 4
+        install_data('50-pid-max.conf', install_dir : sysctldir)
+endif
+
 if conf.get('ENABLE_COREDUMP') == 1
         in_files += ['50-coredump.conf']
 endif
similarity index 92%
rename from test/TEST-31-OOMPOLICY/test.sh
rename to test/TEST-32-OOMPOLICY/test.sh
index 55752e6a701d84060044c968568d6ffd67a28df9..7e9431dd11df8951a168957c427340ca5c906f12 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -e
 TEST_DESCRIPTION="test OOM killer logic"
 TEST_NO_NSPAWN=1
similarity index 91%
rename from test/TEST-31-OOMPOLICY/testsuite.sh
rename to test/TEST-32-OOMPOLICY/testsuite.sh
index f0b1470d42e69df08a8eac78f79599ebbf05cb46..8aab487c6e7fb4708a45a5cf752fddcc99658bd5 100755 (executable)
@@ -1,6 +1,4 @@
 #!/bin/bash
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
 set -ex
 set -o pipefail
 
index c905be0bcca05a44ccb05241d81b806cd21fc2b6..bba8948d35271dcc0a8a3ed1f8d19f9722fc07c6 100644 (file)
@@ -198,6 +198,7 @@ RouteTable=
 UseDNS=
 UseAutonomousPrefix=
 UseOnLinkPrefix=
+BlackList=
 [DHCPServer]
 EmitNTP=
 PoolSize=
index 30b559097b868d44d8a2fb5997b2ed347499180f..0394076f0aafc4350d950efa15687324e36e610d 100644 (file)
@@ -14,7 +14,7 @@ NSPAWN_TIMEOUT="${NSPAWN_TIMEOUT:-infinity}"
 TIMED_OUT=  # will be 1 after run_* if *_TIMEOUT is set and test timed out
 [[ "$LOOKS_LIKE_SUSE" ]] && FSTYPE="${FSTYPE:-btrfs}" || FSTYPE="${FSTYPE:-ext4}"
 UNIFIED_CGROUP_HIERARCHY="${UNIFIED_CGROUP_HIERARCHY:-default}"
-EFI_MOUNT="$(bootctl -p 2>/dev/null || echo /boot)"
+EFI_MOUNT="$(bootctl -x 2>/dev/null || echo /boot)"
 QEMU_MEM="${QEMU_MEM:-512M}"
 
 if ! ROOTLIBDIR=$(pkg-config --variable=systemdutildir systemd); then
index a8605b6bc94167b6ea2df7dc265be171da1c7e53..5dc95fa8c15ad4fd61a84c5ade936010c8594482 100755 (executable)
@@ -15,4 +15,8 @@ fi
 # Apparently git describe has a bug where it always considers the work-tree
 # dirty when invoked with --git-dir (even though 'git status' is happy). Work
 # around this issue by cd-ing to the source directory.
-cd "$dir" && git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback"
+cd "$dir"
+# Check that we have either .git/ (a normal clone) or a .git file (a work-tree)
+# and that we don't get confused if a tarball is extracted in a higher-level
+# git repository.
+[ -e .git ] && git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback"
index c34bf4ba5fe04e371b857e5563be645c3f5be2e8..dd9b816c986928a872e36b1bc66f892c13977eec 100755 (executable)
@@ -47,7 +47,7 @@ for phase in "${PHASES[@]}"; do
             if [[ "$phase" = "RUN_CLANG" ]]; then
                 ENV_VARS="-e CC=clang -e CXX=clang++"
             fi
-            docker exec $ENV_VARS -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dsplit-usr=true build
+            docker exec $ENV_VARS -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dsplit-usr=true -Dman=true build
             $DOCKER_EXEC ninja -v -C build
             docker exec -e "TRAVIS=$TRAVIS" -it $CONT_NAME ninja -C build test
             ;;
index 71c794821f64f032e95f2d79d306fed697a04e0e..38cb3d3158454a604890fd07bab79a68a0108486 100755 (executable)
@@ -60,7 +60,7 @@ for phase in "${PHASES[@]}"; do
             $DOCKER_EXEC ninja -C build test
             ;;
         RUN_CLANG)
-            docker exec -e CC=clang -e CXX=clang++ -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true build
+            docker exec -e CC=clang -e CXX=clang++ -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dman=true build
             $DOCKER_EXEC ninja -v -C build
             $DOCKER_EXEC ninja -C build test
             ;;
index ee912db3224d4b09b29f5f90174515559329d61a..0080b065d89cf201f06a2546ca782d1c393f67bd 100755 (executable)
@@ -36,4 +36,4 @@ sudo mount --bind "$REPO_ROOT" "$t"
 # helper.py is wrapped in script to trick it into thinking it's "interactive"
 # See https://github.com/systemd/systemd/pull/12542#issuecomment-491563572
 sudo script -e -c "./infra/helper.py build_fuzzers --clean --sanitizer=memory systemd $t"
-sudo script -e -c "./infra/helper.py check_build --sanitizer=memory systemd"
+sudo script -e -c "./infra/helper.py check_build --sanitizer=memory -e ALLOWED_BROKEN_TARGETS_PERCENTAGE=0 systemd"
index 865d63170f3d703f8a483ec2598e3bd3447d1782..475a1510aa20ef3bc0faa3769e54706bd78f7316 100755 (executable)
@@ -47,7 +47,7 @@ cd ${REPO_ROOT:-$PWD}
 
 sed -i 's/2\.30/2.27/' meson.build
 
-meson --werror -Db_sanitize=address,undefined -Dsplit-usr=true build
+meson --werror -Db_sanitize=address,undefined -Dsplit-usr=true -Dman=true build
 ninja -v -C build
 
 make -C test/TEST-01-BASIC clean setup run NSPAWN_TIMEOUT=600 TEST_NO_QEMU=yes NSPAWN_ARGUMENTS=--keep-unit RUN_IN_UNPRIVILEGED_CONTAINER=no