Coverage Report

Created: 2025-11-16 06:36

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/systemd/src/shared/conf-parser.h
Line
Count
Source
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2
#pragma once
3
4
#include <syslog.h>
5
6
#include "alloc-util.h"
7
#include "conf-parser-forward.h"
8
#include "shared-forward.h"
9
#include "log.h"
10
11
/* An abstract parser for simple, line based, shallow configuration files consisting of variable assignments only. */
12
13
typedef enum ConfigParseFlags {
14
        CONFIG_PARSE_RELAXED       = 1 << 0, /* Do not warn about unknown non-extension fields */
15
        CONFIG_PARSE_WARN          = 1 << 1, /* Emit non-debug messages */
16
} ConfigParseFlags;
17
18
/* Wraps information for parsing a specific configuration variable, to
19
 * be stored in a simple array */
20
typedef struct ConfigTableItem {
21
        const char *section;            /* Section */
22
        const char *lvalue;             /* Name of the variable */
23
        ConfigParserCallback parse;     /* Function that is called to parse the variable's value */
24
        int ltype;                      /* Distinguish different variables passed to the same callback */
25
        void *data;                     /* Where to store the variable's data */
26
} ConfigTableItem;
27
28
/* Wraps information for parsing a specific configuration variable, to
29
 * be stored in a gperf perfect hashtable */
30
typedef struct ConfigPerfItem {
31
        const char *section_and_lvalue; /* Section + "." + name of the variable */
32
        ConfigParserCallback parse;     /* Function that is called to parse the variable's value */
33
        int ltype;                      /* Distinguish different variables passed to the same callback */
34
        size_t offset;                  /* Offset where to store data, from the beginning of userdata */
35
} ConfigPerfItem;
36
37
/* Prototype for a low-level gperf lookup function */
38
typedef const ConfigPerfItem* (*ConfigPerfItemLookup)(const char *section_and_lvalue, GPERF_LEN_TYPE length);
39
40
/* Prototype for a generic high-level lookup function */
41
typedef int (*ConfigItemLookup)(
42
                const void *table,
43
                const char *section,
44
                const char *lvalue,
45
                ConfigParserCallback *ret_func,
46
                int *ret_ltype,
47
                void **ret_data,
48
                void *userdata);
49
50
/* Linear table search implementation of ConfigItemLookup, based on
51
 * ConfigTableItem arrays */
52
int config_item_table_lookup(const void *table, const char *section, const char *lvalue, ConfigParserCallback *ret_func, int *ret_ltype, void **ret_data, void *userdata);
53
54
/* gperf implementation of ConfigItemLookup, based on gperf
55
 * ConfigPerfItem tables */
56
int config_item_perf_lookup(const void *table, const char *section, const char *lvalue, ConfigParserCallback *ret_func, int *ret_ltype, void **ret_data, void *userdata);
57
58
int config_parse(
59
                const char *unit,
60
                const char *filename,
61
                FILE *f,
62
                const char *sections,       /* nulstr */
63
                ConfigItemLookup lookup,
64
                const void *table,
65
                ConfigParseFlags flags,
66
                void *userdata,
67
                struct stat *ret_stat);     /* possibly NULL */
68
69
int config_parse_many(
70
                const char* const* conf_files,  /* possibly empty */
71
                const char* const* conf_file_dirs,
72
                const char *dropin_dirname,
73
                const char *root,
74
                const char *sections,         /* nulstr */
75
                ConfigItemLookup lookup,
76
                const void *table,
77
                ConfigParseFlags flags,
78
                void *userdata,
79
                Hashmap **ret_stats_by_path,  /* possibly NULL */
80
                char ***ret_drop_in_files);   /* possibly NULL */
81
82
int config_parse_standard_file_with_dropins_full(
83
                const char *root,
84
                const char *main_file,        /* A path like "systemd/frobnicator.conf" */
85
                const char *sections,
86
                ConfigItemLookup lookup,
87
                const void *table,
88
                ConfigParseFlags flags,
89
                void *userdata,
90
                Hashmap **ret_stats_by_path,  /* possibly NULL */
91
                char ***ret_dropin_files);    /* possibly NULL */
92
93
static inline int config_parse_standard_file_with_dropins(
94
                const char *main_file,        /* A path like "systemd/frobnicator.conf" */
95
                const char *sections,         /* nulstr */
96
                ConfigItemLookup lookup,
97
                const void *table,
98
                ConfigParseFlags flags,
99
0
                void *userdata) {
100
0
        return config_parse_standard_file_with_dropins_full(
101
0
                        /* root= */ NULL,
102
0
                        main_file,
103
0
                        sections,
104
0
                        lookup,
105
0
                        table,
106
0
                        flags,
107
0
                        userdata,
108
0
                        /* ret_stats_by_path= */ NULL,
109
0
                        /* ret_dropin_files= */ NULL);
110
0
}
Unexecuted instantiation: link-config.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: udev-builtin-usb_id.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: udev-config.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: udev-event.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: udev-format.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: udev-manager.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: udev-rules.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: udev-watch.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: udev-worker.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: link-config-gperf.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: nspawn-network.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: nspawn-settings.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: nspawn-gperf.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: journald-config.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: journald-gperf.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: resolved-conf.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: resolved-dns-delegate.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: resolved-dnssd.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: resolved-gperf.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: resolved-dnssd-gperf.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: resolved-dns-delegate-gperf.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: bareudp.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: batadv.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: bond.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: bridge.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: fou-tunnel.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: geneve.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: hsr.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: ipoib.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: ipvlan.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: l2tp-tunnel.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: macsec.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: macvlan.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: netdev.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: tunnel.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: vxlan.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: wireguard.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-address-label.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-address.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-bridge-fdb.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-bridge-mdb.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-conf.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-dhcp-server-static-lease.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-dhcp-server.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-dhcp4.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-dhcp6.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-dns.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-ipv6ll.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-json.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-link.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-lldp-rx.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-manager.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-ndisc.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-neighbor.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-network.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-nexthop.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-radv.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-route.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-route-metric.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-route-nexthop.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-routing-policy-rule.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-sysctl.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-util.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-wiphy.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: qdisc.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: tclass.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-gperf.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: networkd-network-gperf.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: netdev-gperf.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: fuzz-unit-file.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: xdg-autostart-service.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: conf-parser.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: dissect-image.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: ethtool-util.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: install.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: kernel-config.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: netif-sriov.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: resolve-util.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: sleep-config.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: udev-util.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: load-fragment-gperf.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: device.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: load-dropin.c:config_parse_standard_file_with_dropins
Unexecuted instantiation: load-fragment.c:config_parse_standard_file_with_dropins
111
112
int config_get_stats_by_path(
113
                const char *suffix,
114
                const char *root,
115
                unsigned flags,
116
                const char* const* dirs,
117
                bool check_dropins,
118
                Hashmap **ret);
119
120
int hashmap_put_stats_by_path(Hashmap **stats_by_path, const char *path, const struct stat *st);
121
bool stats_by_path_equal(Hashmap *a, Hashmap *b);
122
123
typedef struct ConfigSectionParser {
124
        ConfigParserCallback parser;
125
        int ltype;
126
        size_t offset;
127
} ConfigSectionParser;
128
129
int config_section_parse(
130
                const ConfigSectionParser *parsers,
131
                size_t n_parsers,
132
                const char *unit,
133
                const char *filename,
134
                unsigned line,
135
                const char *section,
136
                unsigned section_line,
137
                const char *lvalue,
138
                int ltype,
139
                const char *rvalue,
140
                void *userdata);
141
142
592k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
592k
        return mfree(cs);
144
592k
}
Unexecuted instantiation: link-config.c:config_section_free
Unexecuted instantiation: udev-builtin-usb_id.c:config_section_free
Unexecuted instantiation: udev-config.c:config_section_free
Unexecuted instantiation: udev-event.c:config_section_free
Unexecuted instantiation: udev-format.c:config_section_free
Unexecuted instantiation: udev-manager.c:config_section_free
Unexecuted instantiation: udev-rules.c:config_section_free
Unexecuted instantiation: udev-watch.c:config_section_free
Unexecuted instantiation: udev-worker.c:config_section_free
Unexecuted instantiation: link-config-gperf.c:config_section_free
Unexecuted instantiation: nspawn-network.c:config_section_free
Unexecuted instantiation: nspawn-settings.c:config_section_free
Unexecuted instantiation: nspawn-gperf.c:config_section_free
Unexecuted instantiation: journald-config.c:config_section_free
Unexecuted instantiation: journald-gperf.c:config_section_free
Unexecuted instantiation: resolved-conf.c:config_section_free
Unexecuted instantiation: resolved-dns-delegate.c:config_section_free
Unexecuted instantiation: resolved-dnssd.c:config_section_free
Unexecuted instantiation: resolved-gperf.c:config_section_free
Unexecuted instantiation: resolved-dnssd-gperf.c:config_section_free
Unexecuted instantiation: resolved-dns-delegate-gperf.c:config_section_free
Unexecuted instantiation: bareudp.c:config_section_free
Unexecuted instantiation: batadv.c:config_section_free
Unexecuted instantiation: bond.c:config_section_free
Unexecuted instantiation: bridge.c:config_section_free
Unexecuted instantiation: fou-tunnel.c:config_section_free
Unexecuted instantiation: geneve.c:config_section_free
Unexecuted instantiation: hsr.c:config_section_free
Unexecuted instantiation: ipoib.c:config_section_free
Unexecuted instantiation: ipvlan.c:config_section_free
l2tp-tunnel.c:config_section_free
Line
Count
Source
142
80.2k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
80.2k
}
macsec.c:config_section_free
Line
Count
Source
142
27.6k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
27.6k
}
Unexecuted instantiation: macvlan.c:config_section_free
Unexecuted instantiation: netdev.c:config_section_free
Unexecuted instantiation: tunnel.c:config_section_free
Unexecuted instantiation: vxlan.c:config_section_free
wireguard.c:config_section_free
Line
Count
Source
142
33.5k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
33.5k
}
networkd-address-label.c:config_section_free
Line
Count
Source
142
4.18k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
4.18k
}
networkd-address.c:config_section_free
Line
Count
Source
142
101k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
101k
}
networkd-bridge-fdb.c:config_section_free
Line
Count
Source
142
5.86k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
5.86k
}
networkd-bridge-mdb.c:config_section_free
Line
Count
Source
142
6.21k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
6.21k
}
Unexecuted instantiation: networkd-conf.c:config_section_free
networkd-dhcp-server-static-lease.c:config_section_free
Line
Count
Source
142
4.86k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
4.86k
}
Unexecuted instantiation: networkd-dhcp-server.c:config_section_free
Unexecuted instantiation: networkd-dhcp4.c:config_section_free
Unexecuted instantiation: networkd-dhcp6.c:config_section_free
Unexecuted instantiation: networkd-dns.c:config_section_free
Unexecuted instantiation: networkd-ipv6ll.c:config_section_free
Unexecuted instantiation: networkd-json.c:config_section_free
Unexecuted instantiation: networkd-link.c:config_section_free
Unexecuted instantiation: networkd-lldp-rx.c:config_section_free
Unexecuted instantiation: networkd-manager.c:config_section_free
Unexecuted instantiation: networkd-ndisc.c:config_section_free
networkd-neighbor.c:config_section_free
Line
Count
Source
142
4.96k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
4.96k
}
Unexecuted instantiation: networkd-network.c:config_section_free
networkd-nexthop.c:config_section_free
Line
Count
Source
142
23.0k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
23.0k
}
networkd-radv.c:config_section_free
Line
Count
Source
142
18.5k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
18.5k
}
networkd-route.c:config_section_free
Line
Count
Source
142
87.7k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
87.7k
}
Unexecuted instantiation: networkd-route-metric.c:config_section_free
Unexecuted instantiation: networkd-route-nexthop.c:config_section_free
networkd-routing-policy-rule.c:config_section_free
Line
Count
Source
142
20.5k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
20.5k
}
Unexecuted instantiation: networkd-sysctl.c:config_section_free
Unexecuted instantiation: networkd-util.c:config_section_free
Unexecuted instantiation: networkd-wiphy.c:config_section_free
qdisc.c:config_section_free
Line
Count
Source
142
56.8k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
56.8k
}
tclass.c:config_section_free
Line
Count
Source
142
12.0k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
12.0k
}
Unexecuted instantiation: networkd-gperf.c:config_section_free
Unexecuted instantiation: networkd-network-gperf.c:config_section_free
Unexecuted instantiation: netdev-gperf.c:config_section_free
Unexecuted instantiation: fuzz-unit-file.c:config_section_free
Unexecuted instantiation: xdg-autostart-service.c:config_section_free
Unexecuted instantiation: conf-parser.c:config_section_free
Unexecuted instantiation: dissect-image.c:config_section_free
Unexecuted instantiation: ethtool-util.c:config_section_free
Unexecuted instantiation: install.c:config_section_free
Unexecuted instantiation: kernel-config.c:config_section_free
netif-sriov.c:config_section_free
Line
Count
Source
142
104k
static inline ConfigSection* config_section_free(ConfigSection *cs) {
143
        return mfree(cs);
144
104k
}
Unexecuted instantiation: resolve-util.c:config_section_free
Unexecuted instantiation: sleep-config.c:config_section_free
Unexecuted instantiation: udev-util.c:config_section_free
Unexecuted instantiation: load-fragment-gperf.c:config_section_free
Unexecuted instantiation: device.c:config_section_free
Unexecuted instantiation: load-dropin.c:config_section_free
Unexecuted instantiation: load-fragment.c:config_section_free
145
DEFINE_TRIVIAL_CLEANUP_FUNC(ConfigSection*, config_section_free);
146
147
int config_section_new(const char *filename, unsigned line, ConfigSection **ret);
148
149
void config_section_hash_func(const ConfigSection *c, struct siphash *state);
150
int config_section_compare_func(const ConfigSection *x, const ConfigSection *y);
151
extern const struct hash_ops config_section_hash_ops;
152
153
int hashmap_by_section_find_unused_line(Hashmap *entries_by_section, const char *filename, unsigned *ret);
154
int ordered_hashmap_by_section_find_unused_line(OrderedHashmap *entries_by_section, const char *filename, unsigned *ret);
155
156
171k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
171k
        if (!section)
160
0
                return false;
161
162
171k
        return section->invalid;
163
171k
}
Unexecuted instantiation: link-config.c:section_is_invalid
Unexecuted instantiation: udev-builtin-usb_id.c:section_is_invalid
Unexecuted instantiation: udev-config.c:section_is_invalid
Unexecuted instantiation: udev-event.c:section_is_invalid
Unexecuted instantiation: udev-format.c:section_is_invalid
Unexecuted instantiation: udev-manager.c:section_is_invalid
Unexecuted instantiation: udev-rules.c:section_is_invalid
Unexecuted instantiation: udev-watch.c:section_is_invalid
Unexecuted instantiation: udev-worker.c:section_is_invalid
Unexecuted instantiation: link-config-gperf.c:section_is_invalid
Unexecuted instantiation: nspawn-network.c:section_is_invalid
Unexecuted instantiation: nspawn-settings.c:section_is_invalid
Unexecuted instantiation: nspawn-gperf.c:section_is_invalid
Unexecuted instantiation: journald-config.c:section_is_invalid
Unexecuted instantiation: journald-gperf.c:section_is_invalid
Unexecuted instantiation: resolved-conf.c:section_is_invalid
Unexecuted instantiation: resolved-dns-delegate.c:section_is_invalid
Unexecuted instantiation: resolved-dnssd.c:section_is_invalid
Unexecuted instantiation: resolved-gperf.c:section_is_invalid
Unexecuted instantiation: resolved-dnssd-gperf.c:section_is_invalid
Unexecuted instantiation: resolved-dns-delegate-gperf.c:section_is_invalid
Unexecuted instantiation: bareudp.c:section_is_invalid
Unexecuted instantiation: batadv.c:section_is_invalid
Unexecuted instantiation: bond.c:section_is_invalid
Unexecuted instantiation: bridge.c:section_is_invalid
Unexecuted instantiation: fou-tunnel.c:section_is_invalid
Unexecuted instantiation: geneve.c:section_is_invalid
Unexecuted instantiation: hsr.c:section_is_invalid
Unexecuted instantiation: ipoib.c:section_is_invalid
Unexecuted instantiation: ipvlan.c:section_is_invalid
l2tp-tunnel.c:section_is_invalid
Line
Count
Source
156
21.7k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
21.7k
        if (!section)
160
0
                return false;
161
162
21.7k
        return section->invalid;
163
21.7k
}
macsec.c:section_is_invalid
Line
Count
Source
156
9.02k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
9.02k
        if (!section)
160
0
                return false;
161
162
9.02k
        return section->invalid;
163
9.02k
}
Unexecuted instantiation: macvlan.c:section_is_invalid
Unexecuted instantiation: netdev.c:section_is_invalid
Unexecuted instantiation: tunnel.c:section_is_invalid
Unexecuted instantiation: vxlan.c:section_is_invalid
wireguard.c:section_is_invalid
Line
Count
Source
156
4.74k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
4.74k
        if (!section)
160
0
                return false;
161
162
4.74k
        return section->invalid;
163
4.74k
}
networkd-address-label.c:section_is_invalid
Line
Count
Source
156
902
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
902
        if (!section)
160
0
                return false;
161
162
902
        return section->invalid;
163
902
}
networkd-address.c:section_is_invalid
Line
Count
Source
156
38.2k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
38.2k
        if (!section)
160
0
                return false;
161
162
38.2k
        return section->invalid;
163
38.2k
}
networkd-bridge-fdb.c:section_is_invalid
Line
Count
Source
156
460
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
460
        if (!section)
160
0
                return false;
161
162
460
        return section->invalid;
163
460
}
networkd-bridge-mdb.c:section_is_invalid
Line
Count
Source
156
3.00k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
3.00k
        if (!section)
160
0
                return false;
161
162
3.00k
        return section->invalid;
163
3.00k
}
Unexecuted instantiation: networkd-conf.c:section_is_invalid
networkd-dhcp-server-static-lease.c:section_is_invalid
Line
Count
Source
156
1.02k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
1.02k
        if (!section)
160
0
                return false;
161
162
1.02k
        return section->invalid;
163
1.02k
}
networkd-dhcp-server.c:section_is_invalid
Line
Count
Source
156
1.53k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
1.53k
        if (!section)
160
0
                return false;
161
162
1.53k
        return section->invalid;
163
1.53k
}
Unexecuted instantiation: networkd-dhcp4.c:section_is_invalid
Unexecuted instantiation: networkd-dhcp6.c:section_is_invalid
Unexecuted instantiation: networkd-dns.c:section_is_invalid
Unexecuted instantiation: networkd-ipv6ll.c:section_is_invalid
Unexecuted instantiation: networkd-json.c:section_is_invalid
Unexecuted instantiation: networkd-link.c:section_is_invalid
Unexecuted instantiation: networkd-lldp-rx.c:section_is_invalid
Unexecuted instantiation: networkd-manager.c:section_is_invalid
Unexecuted instantiation: networkd-ndisc.c:section_is_invalid
networkd-neighbor.c:section_is_invalid
Line
Count
Source
156
2.57k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
2.57k
        if (!section)
160
0
                return false;
161
162
2.57k
        return section->invalid;
163
2.57k
}
Unexecuted instantiation: networkd-network.c:section_is_invalid
networkd-nexthop.c:section_is_invalid
Line
Count
Source
156
4.32k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
4.32k
        if (!section)
160
0
                return false;
161
162
4.32k
        return section->invalid;
163
4.32k
}
networkd-radv.c:section_is_invalid
Line
Count
Source
156
2.61k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
2.61k
        if (!section)
160
0
                return false;
161
162
2.61k
        return section->invalid;
163
2.61k
}
networkd-route.c:section_is_invalid
Line
Count
Source
156
32.1k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
32.1k
        if (!section)
160
0
                return false;
161
162
32.1k
        return section->invalid;
163
32.1k
}
Unexecuted instantiation: networkd-route-metric.c:section_is_invalid
Unexecuted instantiation: networkd-route-nexthop.c:section_is_invalid
networkd-routing-policy-rule.c:section_is_invalid
Line
Count
Source
156
3.35k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
3.35k
        if (!section)
160
0
                return false;
161
162
3.35k
        return section->invalid;
163
3.35k
}
Unexecuted instantiation: networkd-sysctl.c:section_is_invalid
Unexecuted instantiation: networkd-util.c:section_is_invalid
Unexecuted instantiation: networkd-wiphy.c:section_is_invalid
qdisc.c:section_is_invalid
Line
Count
Source
156
6.06k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
6.06k
        if (!section)
160
0
                return false;
161
162
6.06k
        return section->invalid;
163
6.06k
}
tclass.c:section_is_invalid
Line
Count
Source
156
1.74k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
1.74k
        if (!section)
160
0
                return false;
161
162
1.74k
        return section->invalid;
163
1.74k
}
Unexecuted instantiation: networkd-gperf.c:section_is_invalid
Unexecuted instantiation: networkd-network-gperf.c:section_is_invalid
Unexecuted instantiation: netdev-gperf.c:section_is_invalid
Unexecuted instantiation: fuzz-unit-file.c:section_is_invalid
Unexecuted instantiation: xdg-autostart-service.c:section_is_invalid
Unexecuted instantiation: conf-parser.c:section_is_invalid
Unexecuted instantiation: dissect-image.c:section_is_invalid
Unexecuted instantiation: ethtool-util.c:section_is_invalid
Unexecuted instantiation: install.c:section_is_invalid
Unexecuted instantiation: kernel-config.c:section_is_invalid
netif-sriov.c:section_is_invalid
Line
Count
Source
156
38.3k
static inline bool section_is_invalid(ConfigSection *section) {
157
        /* If this returns false, then it does _not_ mean the section is valid. */
158
159
38.3k
        if (!section)
160
0
                return false;
161
162
38.3k
        return section->invalid;
163
38.3k
}
Unexecuted instantiation: resolve-util.c:section_is_invalid
Unexecuted instantiation: sleep-config.c:section_is_invalid
Unexecuted instantiation: udev-util.c:section_is_invalid
Unexecuted instantiation: load-fragment-gperf.c:section_is_invalid
Unexecuted instantiation: device.c:section_is_invalid
Unexecuted instantiation: load-dropin.c:section_is_invalid
Unexecuted instantiation: load-fragment.c:section_is_invalid
164
165
#define log_section_full_errno_zerook(section, level, error, ...)       \
166
15.1k
        ({                                                              \
167
22.2k
                const ConfigSection *_s = (section);                    \
168
15.1k
                log_syntax(/* unit = */ NULL,                           \
169
15.1k
                           level,                                       \
170
15.1k
                           _s ? _s->filename : NULL,                    \
171
15.1k
                           _s ? _s->line : 0,                           \
172
15.1k
                           error,                                       \
173
15.1k
                           __VA_ARGS__);                                \
174
15.1k
        })
175
176
#define log_section_full_errno(section, level, error, ...)              \
177
10.3k
        ({                                                              \
178
10.3k
                int _error = (error);                                   \
179
10.3k
                ASSERT_NON_ZERO(_error);                                \
180
10.3k
                log_section_full_errno_zerook(section, level, _error, __VA_ARGS__); \
181
10.3k
        })
182
183
#define log_section_full(section, level, fmt, ...)                      \
184
4.82k
        ({                                                              \
185
4.82k
                if (BUILD_MODE_DEVELOPER)                               \
186
4.82k
                        assert(!strstr(fmt, "%m"));                     \
187
4.82k
                (void) log_section_full_errno_zerook(section, level, 0, fmt, ##__VA_ARGS__); \
188
194
        })
189
190
#define log_section_debug(section, ...)                  log_section_full(section, LOG_DEBUG,   __VA_ARGS__)
191
#define log_section_info(section, ...)                   log_section_full(section, LOG_INFO,    __VA_ARGS__)
192
#define log_section_notice(section, ...)                 log_section_full(section, LOG_NOTICE,  __VA_ARGS__)
193
4.82k
#define log_section_warning(section, ...)                log_section_full(section, LOG_WARNING, __VA_ARGS__)
194
#define log_section_error(section, ...)                  log_section_full(section, LOG_ERR,     __VA_ARGS__)
195
196
#define log_section_debug_errno(section, error, ...)     log_section_full_errno(section, LOG_DEBUG,   error, __VA_ARGS__)
197
#define log_section_info_errno(section, error, ...)      log_section_full_errno(section, LOG_INFO,    error, __VA_ARGS__)
198
#define log_section_notice_errno(section, error, ...)    log_section_full_errno(section, LOG_NOTICE,  error, __VA_ARGS__)
199
10.3k
#define log_section_warning_errno(section, error, ...)   log_section_full_errno(section, LOG_WARNING, error, __VA_ARGS__)
200
#define log_section_error_errno(section, error, ...)     log_section_full_errno(section, LOG_ERR,     error, __VA_ARGS__)
201
202
CONFIG_PARSER_PROTOTYPE(config_parse_int);
203
CONFIG_PARSER_PROTOTYPE(config_parse_unsigned);
204
CONFIG_PARSER_PROTOTYPE(config_parse_long);
205
CONFIG_PARSER_PROTOTYPE(config_parse_uint8);
206
CONFIG_PARSER_PROTOTYPE(config_parse_uint16);
207
CONFIG_PARSER_PROTOTYPE(config_parse_uint32);
208
CONFIG_PARSER_PROTOTYPE(config_parse_int32);
209
CONFIG_PARSER_PROTOTYPE(config_parse_uint64);
210
CONFIG_PARSER_PROTOTYPE(config_parse_double);
211
CONFIG_PARSER_PROTOTYPE(config_parse_iec_size);
212
CONFIG_PARSER_PROTOTYPE(config_parse_si_uint64);
213
CONFIG_PARSER_PROTOTYPE(config_parse_iec_uint64);
214
CONFIG_PARSER_PROTOTYPE(config_parse_iec_uint64_infinity);
215
CONFIG_PARSER_PROTOTYPE(config_parse_bool);
216
CONFIG_PARSER_PROTOTYPE(config_parse_uint32_flag);
217
CONFIG_PARSER_PROTOTYPE(config_parse_uint32_invert_flag);
218
CONFIG_PARSER_PROTOTYPE(config_parse_id128);
219
CONFIG_PARSER_PROTOTYPE(config_parse_tristate);
220
CONFIG_PARSER_PROTOTYPE(config_parse_string);
221
CONFIG_PARSER_PROTOTYPE(config_parse_dns_name);
222
CONFIG_PARSER_PROTOTYPE(config_parse_hostname);
223
CONFIG_PARSER_PROTOTYPE(config_parse_path);
224
CONFIG_PARSER_PROTOTYPE(config_parse_strv);
225
CONFIG_PARSER_PROTOTYPE(config_parse_sec);
226
CONFIG_PARSER_PROTOTYPE(config_parse_sec_def_infinity);
227
CONFIG_PARSER_PROTOTYPE(config_parse_sec_def_unset);
228
CONFIG_PARSER_PROTOTYPE(config_parse_nsec);
229
CONFIG_PARSER_PROTOTYPE(config_parse_mode);
230
CONFIG_PARSER_PROTOTYPE(config_parse_warn_compat);
231
CONFIG_PARSER_PROTOTYPE(config_parse_log_facility);
232
CONFIG_PARSER_PROTOTYPE(config_parse_log_level);
233
CONFIG_PARSER_PROTOTYPE(config_parse_signal);
234
CONFIG_PARSER_PROTOTYPE(config_parse_personality);
235
CONFIG_PARSER_PROTOTYPE(config_parse_permille);
236
CONFIG_PARSER_PROTOTYPE(config_parse_ifname);
237
CONFIG_PARSER_PROTOTYPE(config_parse_ifnames);
238
CONFIG_PARSER_PROTOTYPE(config_parse_ip_port);
239
CONFIG_PARSER_PROTOTYPE(config_parse_mtu);
240
CONFIG_PARSER_PROTOTYPE(config_parse_rlimit);
241
CONFIG_PARSER_PROTOTYPE(config_parse_vlanprotocol);
242
CONFIG_PARSER_PROTOTYPE(config_parse_hw_addr);
243
CONFIG_PARSER_PROTOTYPE(config_parse_hw_addrs);
244
CONFIG_PARSER_PROTOTYPE(config_parse_ether_addr);
245
CONFIG_PARSER_PROTOTYPE(config_parse_ether_addrs);
246
CONFIG_PARSER_PROTOTYPE(config_parse_in_addr_non_null);
247
CONFIG_PARSER_PROTOTYPE(config_parse_in_addr_data);
248
CONFIG_PARSER_PROTOTYPE(config_parse_in_addr_prefix);
249
CONFIG_PARSER_PROTOTYPE(config_parse_percent);
250
CONFIG_PARSER_PROTOTYPE(config_parse_permyriad);
251
CONFIG_PARSER_PROTOTYPE(config_parse_pid);
252
CONFIG_PARSER_PROTOTYPE(config_parse_sec_fix_0);
253
CONFIG_PARSER_PROTOTYPE(config_parse_timezone);
254
CONFIG_PARSER_PROTOTYPE(config_parse_calendar);
255
CONFIG_PARSER_PROTOTYPE(config_parse_ip_protocol);
256
CONFIG_PARSER_PROTOTYPE(config_parse_loadavg);
257
258
typedef enum Disabled {
259
        DISABLED_CONFIGURATION,
260
        DISABLED_LEGACY,
261
        DISABLED_EXPERIMENTAL,
262
} Disabled;
263
264
typedef enum ConfigParseStringFlags {
265
        CONFIG_PARSE_STRING_SAFE  = 1 << 0,
266
        CONFIG_PARSE_STRING_ASCII = 1 << 1,
267
268
        CONFIG_PARSE_STRING_SAFE_AND_ASCII = CONFIG_PARSE_STRING_SAFE | CONFIG_PARSE_STRING_ASCII,
269
} ConfigParseStringFlags;
270
271
#define DEFINE_CONFIG_PARSE(function, parser)                           \
272
4.57k
        CONFIG_PARSER_PROTOTYPE(function) {                             \
273
4.57k
                int *i = data, r;                                       \
274
4.57k
                                                                        \
275
4.57k
                assert(filename);                                       \
276
4.57k
                assert(lvalue);                                         \
277
4.57k
                assert(rvalue);                                         \
278
4.57k
                assert(data);                                           \
279
4.57k
                                                                        \
280
4.57k
                r = parser(rvalue);                                     \
281
4.57k
                if (r < 0)                                              \
282
4.57k
                        return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue); \
283
4.57k
                                                                        \
284
4.57k
                *i = r;                                                 \
285
1.95k
                return 1;                                               \
286
4.57k
        }
287
288
#define DEFINE_CONFIG_PARSE_PTR(function, parser, type)                 \
289
21.4k
        CONFIG_PARSER_PROTOTYPE(function) {                             \
290
21.4k
                type *i = ASSERT_PTR(data);                             \
291
21.4k
                int r;                                                  \
292
21.4k
                                                                        \
293
21.4k
                assert(filename);                                       \
294
21.4k
                assert(lvalue);                                         \
295
21.4k
                assert(rvalue);                                         \
296
21.4k
                                                                        \
297
21.4k
                r = parser(rvalue, i);                                  \
298
21.4k
                if (r < 0)                                              \
299
21.4k
                        return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue); \
300
21.4k
                                                                        \
301
21.4k
                return 1;                                               \
302
21.4k
        }
303
304
#define DEFINE_CONFIG_PARSE_ENUM_FULL(function, from_string, type)      \
305
30.6k
        CONFIG_PARSER_PROTOTYPE(function) {                             \
306
30.6k
                type *i = data, x;                                      \
307
30.6k
                                                                        \
308
30.6k
                assert(filename);                                       \
309
30.6k
                assert(lvalue);                                         \
310
27.0k
                assert(rvalue);                                         \
311
27.0k
                assert(data);                                           \
312
3.68k
                                                                        \
313
3.68k
                x = from_string(rvalue);                                \
314
30.6k
                if (x < 0)                                              \
315
14.2k
                        return log_syntax_parse_error(unit, filename, line, x, lvalue, rvalue); \
316
3.68k
                                                                        \
317
16.4k
                *i = x;                                                 \
318
16.4k
                return 1;                                               \
319
3.68k
        }
320
321
#define DEFINE_CONFIG_PARSE_ENUM(function, name, type)                  \
322
        DEFINE_CONFIG_PARSE_ENUM_FULL(function, name##_from_string, type)
323
324
#define DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(function, name, type, default_value) \
325
4.57k
        CONFIG_PARSER_PROTOTYPE(function) {                             \
326
4.57k
                type *i = data, x;                                      \
327
4.57k
                                                                        \
328
4.57k
                assert(filename);                                       \
329
4.57k
                assert(lvalue);                                         \
330
3.99k
                assert(rvalue);                                         \
331
3.99k
                assert(data);                                           \
332
584
                                                                        \
333
4.57k
                if (isempty(rvalue)) {                                  \
334
1.08k
                        *i = default_value;                             \
335
1.08k
                        return 1;                                       \
336
1.08k
                }                                                       \
337
584
                                                                        \
338
3.49k
                x = name##_from_string(rvalue);                         \
339
3.49k
                if (x < 0)                                              \
340
3.49k
                        return log_syntax_parse_error(unit, filename, line, x, lvalue, rvalue); \
341
3.49k
                                                                        \
342
3.49k
                *i = x;                                                 \
343
2.07k
                return 1;                                               \
344
3.49k
        }
345
346
#define DEFINE_CONFIG_PARSE_ENUMV(function, name, type, invalid)               \
347
1.33k
        CONFIG_PARSER_PROTOTYPE(function) {                                    \
348
1.33k
                type **enums = ASSERT_PTR(data);                               \
349
1.33k
                _cleanup_free_ type *xs = NULL;                                \
350
1.33k
                size_t n = 0;                                                  \
351
1.33k
                int r;                                                         \
352
1.33k
                                                                               \
353
1.33k
                assert(lvalue);                                                \
354
1.33k
                                                                               \
355
3.39k
                for (const char *p = rvalue;;) {                               \
356
3.39k
                        _cleanup_free_ char *en = NULL;                        \
357
3.39k
                        type x;                                                \
358
3.39k
                                                                               \
359
3.39k
                        r = extract_first_word(&p, &en, NULL, 0);              \
360
3.39k
                        if (r < 0)                                             \
361
3.39k
                                return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue); \
362
3.39k
                        if (r == 0)                                            \
363
3.00k
                                break;                                         \
364
3.00k
                                                                               \
365
3.00k
                        x = name##_from_string(en);                            \
366
2.06k
                        if (x < 0) {                                           \
367
506
                                log_syntax(unit, LOG_WARNING, filename, line, x, \
368
506
                                           "Failed to parse %s in %s=, ignoring.", \
369
506
                                           en, lvalue);                        \
370
506
                                continue;                                      \
371
506
                        }                                                      \
372
2.06k
                                                                               \
373
2.06k
                        FOREACH_ARRAY(i, xs, n)                                \
374
2.85k
                                if (*i == x) {                                 \
375
667
                                        log_syntax(unit, LOG_NOTICE, filename, line, 0, \
376
667
                                                   "Duplicate entry %s in %s=, ignoring.", \
377
667
                                                   en, lvalue);                \
378
667
                                        x = invalid;                           \
379
667
                                        break;                                 \
380
667
                                }                                              \
381
1.55k
                                                                               \
382
1.55k
                        if (x == invalid)                                      \
383
1.55k
                                continue;                                      \
384
1.55k
                                                                               \
385
1.55k
                        /* Allocate one more for the trailing 'invalid'. */    \
386
1.55k
                        if (!GREEDY_REALLOC(xs, n + 2))                        \
387
887
                                return log_oom();                              \
388
887
                                                                               \
389
887
                        xs[n++] = x;                                           \
390
887
                }                                                              \
391
1.33k
                                                                               \
392
1.33k
                if (n <= 0) {                                                  \
393
422
                        /* An empty string, or invalid values only. */         \
394
422
                        *enums = mfree(*enums);                                \
395
422
                        return 1;                                              \
396
422
                }                                                              \
397
948
                                                                               \
398
948
                /* Terminate with 'invalid' */                                 \
399
948
                xs[n] = invalid;                                               \
400
526
                free_and_replace(*enums, xs);                                  \
401
526
                return 1;                                                      \
402
948
        }
403
404
int config_parse_unsigned_bounded(
405
                const char *unit,
406
                const char *filename,
407
                unsigned line,
408
                const char *section,
409
                unsigned section_line,
410
                const char *lvalue,
411
                const char *rvalue,
412
                unsigned min,
413
                unsigned max,
414
                bool ignoring,
415
                unsigned *ret);
416
417
static inline int config_parse_uint32_bounded(
418
                const char *unit,
419
                const char *filename,
420
                unsigned line,
421
                const char *section,
422
                unsigned section_line,
423
                const char *lvalue,
424
                const char *rvalue,
425
                uint32_t min,
426
                uint32_t max,
427
                bool ignoring,
428
7.98k
                uint32_t *ret) {
429
430
7.98k
        unsigned t;
431
7.98k
        int r;
432
433
7.98k
        r = config_parse_unsigned_bounded(
434
7.98k
                        unit, filename, line, section, section_line, lvalue, rvalue,
435
7.98k
                        min, max, ignoring,
436
7.98k
                        &t);
437
7.98k
        if (r <= 0)
438
1.73k
                return r;
439
6.25k
        assert(t <= UINT32_MAX);
440
6.25k
        *ret = t;
441
6.25k
        return 1;
442
7.98k
}
Unexecuted instantiation: link-config.c:config_parse_uint32_bounded
Unexecuted instantiation: udev-builtin-usb_id.c:config_parse_uint32_bounded
Unexecuted instantiation: udev-config.c:config_parse_uint32_bounded
Unexecuted instantiation: udev-event.c:config_parse_uint32_bounded
Unexecuted instantiation: udev-format.c:config_parse_uint32_bounded
Unexecuted instantiation: udev-manager.c:config_parse_uint32_bounded
Unexecuted instantiation: udev-rules.c:config_parse_uint32_bounded
Unexecuted instantiation: udev-watch.c:config_parse_uint32_bounded
Unexecuted instantiation: udev-worker.c:config_parse_uint32_bounded
Unexecuted instantiation: link-config-gperf.c:config_parse_uint32_bounded
Unexecuted instantiation: nspawn-network.c:config_parse_uint32_bounded
Unexecuted instantiation: nspawn-settings.c:config_parse_uint32_bounded
Unexecuted instantiation: nspawn-gperf.c:config_parse_uint32_bounded
Unexecuted instantiation: journald-config.c:config_parse_uint32_bounded
Unexecuted instantiation: journald-gperf.c:config_parse_uint32_bounded
Unexecuted instantiation: resolved-conf.c:config_parse_uint32_bounded
Unexecuted instantiation: resolved-dns-delegate.c:config_parse_uint32_bounded
Unexecuted instantiation: resolved-dnssd.c:config_parse_uint32_bounded
Unexecuted instantiation: resolved-gperf.c:config_parse_uint32_bounded
Unexecuted instantiation: resolved-dnssd-gperf.c:config_parse_uint32_bounded
Unexecuted instantiation: resolved-dns-delegate-gperf.c:config_parse_uint32_bounded
Unexecuted instantiation: bareudp.c:config_parse_uint32_bounded
Unexecuted instantiation: batadv.c:config_parse_uint32_bounded
Unexecuted instantiation: bond.c:config_parse_uint32_bounded
Unexecuted instantiation: bridge.c:config_parse_uint32_bounded
Unexecuted instantiation: fou-tunnel.c:config_parse_uint32_bounded
geneve.c:config_parse_uint32_bounded
Line
Count
Source
428
599
                uint32_t *ret) {
429
430
599
        unsigned t;
431
599
        int r;
432
433
599
        r = config_parse_unsigned_bounded(
434
599
                        unit, filename, line, section, section_line, lvalue, rvalue,
435
599
                        min, max, ignoring,
436
599
                        &t);
437
599
        if (r <= 0)
438
385
                return r;
439
214
        assert(t <= UINT32_MAX);
440
214
        *ret = t;
441
214
        return 1;
442
599
}
Unexecuted instantiation: hsr.c:config_parse_uint32_bounded
Unexecuted instantiation: ipoib.c:config_parse_uint32_bounded
Unexecuted instantiation: ipvlan.c:config_parse_uint32_bounded
l2tp-tunnel.c:config_parse_uint32_bounded
Line
Count
Source
428
6.16k
                uint32_t *ret) {
429
430
6.16k
        unsigned t;
431
6.16k
        int r;
432
433
6.16k
        r = config_parse_unsigned_bounded(
434
6.16k
                        unit, filename, line, section, section_line, lvalue, rvalue,
435
6.16k
                        min, max, ignoring,
436
6.16k
                        &t);
437
6.16k
        if (r <= 0)
438
711
                return r;
439
5.45k
        assert(t <= UINT32_MAX);
440
5.45k
        *ret = t;
441
5.45k
        return 1;
442
6.16k
}
Unexecuted instantiation: macsec.c:config_parse_uint32_bounded
macvlan.c:config_parse_uint32_bounded
Line
Count
Source
428
392
                uint32_t *ret) {
429
430
392
        unsigned t;
431
392
        int r;
432
433
392
        r = config_parse_unsigned_bounded(
434
392
                        unit, filename, line, section, section_line, lvalue, rvalue,
435
392
                        min, max, ignoring,
436
392
                        &t);
437
392
        if (r <= 0)
438
198
                return r;
439
194
        assert(t <= UINT32_MAX);
440
194
        *ret = t;
441
194
        return 1;
442
392
}
Unexecuted instantiation: netdev.c:config_parse_uint32_bounded
tunnel.c:config_parse_uint32_bounded
Line
Count
Source
428
827
                uint32_t *ret) {
429
430
827
        unsigned t;
431
827
        int r;
432
433
827
        r = config_parse_unsigned_bounded(
434
827
                        unit, filename, line, section, section_line, lvalue, rvalue,
435
827
                        min, max, ignoring,
436
827
                        &t);
437
827
        if (r <= 0)
438
438
                return r;
439
389
        assert(t <= UINT32_MAX);
440
389
        *ret = t;
441
389
        return 1;
442
827
}
Unexecuted instantiation: vxlan.c:config_parse_uint32_bounded
Unexecuted instantiation: wireguard.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-address-label.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-address.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-bridge-fdb.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-bridge-mdb.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-conf.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-dhcp-server-static-lease.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-dhcp-server.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-dhcp4.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-dhcp6.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-dns.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-ipv6ll.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-json.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-link.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-lldp-rx.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-manager.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-ndisc.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-neighbor.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-network.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-nexthop.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-radv.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-route.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-route-metric.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-route-nexthop.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-routing-policy-rule.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-sysctl.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-util.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-wiphy.c:config_parse_uint32_bounded
Unexecuted instantiation: qdisc.c:config_parse_uint32_bounded
Unexecuted instantiation: tclass.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-gperf.c:config_parse_uint32_bounded
Unexecuted instantiation: networkd-network-gperf.c:config_parse_uint32_bounded
Unexecuted instantiation: netdev-gperf.c:config_parse_uint32_bounded
Unexecuted instantiation: fuzz-unit-file.c:config_parse_uint32_bounded
Unexecuted instantiation: xdg-autostart-service.c:config_parse_uint32_bounded
Unexecuted instantiation: conf-parser.c:config_parse_uint32_bounded
Unexecuted instantiation: dissect-image.c:config_parse_uint32_bounded
Unexecuted instantiation: ethtool-util.c:config_parse_uint32_bounded
Unexecuted instantiation: install.c:config_parse_uint32_bounded
Unexecuted instantiation: kernel-config.c:config_parse_uint32_bounded
Unexecuted instantiation: netif-sriov.c:config_parse_uint32_bounded
Unexecuted instantiation: resolve-util.c:config_parse_uint32_bounded
Unexecuted instantiation: sleep-config.c:config_parse_uint32_bounded
Unexecuted instantiation: udev-util.c:config_parse_uint32_bounded
Unexecuted instantiation: load-fragment-gperf.c:config_parse_uint32_bounded
Unexecuted instantiation: device.c:config_parse_uint32_bounded
Unexecuted instantiation: load-dropin.c:config_parse_uint32_bounded
Unexecuted instantiation: load-fragment.c:config_parse_uint32_bounded
443
444
static inline int config_parse_uint16_bounded(
445
                const char *unit,
446
                const char *filename,
447
                unsigned line,
448
                const char *section,
449
                unsigned section_line,
450
                const char *lvalue,
451
                const char *rvalue,
452
                uint16_t min,
453
                uint16_t max,
454
                bool ignoring,
455
1.80k
                uint16_t *ret) {
456
457
1.80k
        unsigned t;
458
1.80k
        int r;
459
460
1.80k
        r = config_parse_unsigned_bounded(
461
1.80k
                        unit, filename, line, section, section_line, lvalue, rvalue,
462
1.80k
                        min, max, ignoring,
463
1.80k
                        &t);
464
1.80k
        if (r <= 0)
465
1.02k
                return r;
466
785
        assert(t <= UINT16_MAX);
467
785
        *ret = t;
468
785
        return 1;
469
1.80k
}
Unexecuted instantiation: link-config.c:config_parse_uint16_bounded
Unexecuted instantiation: udev-builtin-usb_id.c:config_parse_uint16_bounded
Unexecuted instantiation: udev-config.c:config_parse_uint16_bounded
Unexecuted instantiation: udev-event.c:config_parse_uint16_bounded
Unexecuted instantiation: udev-format.c:config_parse_uint16_bounded
Unexecuted instantiation: udev-manager.c:config_parse_uint16_bounded
Unexecuted instantiation: udev-rules.c:config_parse_uint16_bounded
Unexecuted instantiation: udev-watch.c:config_parse_uint16_bounded
Unexecuted instantiation: udev-worker.c:config_parse_uint16_bounded
Unexecuted instantiation: link-config-gperf.c:config_parse_uint16_bounded
Unexecuted instantiation: nspawn-network.c:config_parse_uint16_bounded
Unexecuted instantiation: nspawn-settings.c:config_parse_uint16_bounded
Unexecuted instantiation: nspawn-gperf.c:config_parse_uint16_bounded
Unexecuted instantiation: journald-config.c:config_parse_uint16_bounded
Unexecuted instantiation: journald-gperf.c:config_parse_uint16_bounded
Unexecuted instantiation: resolved-conf.c:config_parse_uint16_bounded
Unexecuted instantiation: resolved-dns-delegate.c:config_parse_uint16_bounded
Unexecuted instantiation: resolved-dnssd.c:config_parse_uint16_bounded
Unexecuted instantiation: resolved-gperf.c:config_parse_uint16_bounded
Unexecuted instantiation: resolved-dnssd-gperf.c:config_parse_uint16_bounded
Unexecuted instantiation: resolved-dns-delegate-gperf.c:config_parse_uint16_bounded
Unexecuted instantiation: bareudp.c:config_parse_uint16_bounded
Unexecuted instantiation: batadv.c:config_parse_uint16_bounded
bond.c:config_parse_uint16_bounded
Line
Count
Source
455
777
                uint16_t *ret) {
456
457
777
        unsigned t;
458
777
        int r;
459
460
777
        r = config_parse_unsigned_bounded(
461
777
                        unit, filename, line, section, section_line, lvalue, rvalue,
462
777
                        min, max, ignoring,
463
777
                        &t);
464
777
        if (r <= 0)
465
388
                return r;
466
389
        assert(t <= UINT16_MAX);
467
389
        *ret = t;
468
389
        return 1;
469
777
}
bridge.c:config_parse_uint16_bounded
Line
Count
Source
455
633
                uint16_t *ret) {
456
457
633
        unsigned t;
458
633
        int r;
459
460
633
        r = config_parse_unsigned_bounded(
461
633
                        unit, filename, line, section, section_line, lvalue, rvalue,
462
633
                        min, max, ignoring,
463
633
                        &t);
464
633
        if (r <= 0)
465
433
                return r;
466
200
        assert(t <= UINT16_MAX);
467
200
        *ret = t;
468
200
        return 1;
469
633
}
Unexecuted instantiation: fou-tunnel.c:config_parse_uint16_bounded
Unexecuted instantiation: geneve.c:config_parse_uint16_bounded
Unexecuted instantiation: hsr.c:config_parse_uint16_bounded
Unexecuted instantiation: ipoib.c:config_parse_uint16_bounded
Unexecuted instantiation: ipvlan.c:config_parse_uint16_bounded
Unexecuted instantiation: l2tp-tunnel.c:config_parse_uint16_bounded
Unexecuted instantiation: macsec.c:config_parse_uint16_bounded
Unexecuted instantiation: macvlan.c:config_parse_uint16_bounded
Unexecuted instantiation: netdev.c:config_parse_uint16_bounded
tunnel.c:config_parse_uint16_bounded
Line
Count
Source
455
397
                uint16_t *ret) {
456
457
397
        unsigned t;
458
397
        int r;
459
460
397
        r = config_parse_unsigned_bounded(
461
397
                        unit, filename, line, section, section_line, lvalue, rvalue,
462
397
                        min, max, ignoring,
463
397
                        &t);
464
397
        if (r <= 0)
465
201
                return r;
466
196
        assert(t <= UINT16_MAX);
467
196
        *ret = t;
468
196
        return 1;
469
397
}
Unexecuted instantiation: vxlan.c:config_parse_uint16_bounded
Unexecuted instantiation: wireguard.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-address-label.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-address.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-bridge-fdb.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-bridge-mdb.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-conf.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-dhcp-server-static-lease.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-dhcp-server.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-dhcp4.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-dhcp6.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-dns.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-ipv6ll.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-json.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-link.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-lldp-rx.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-manager.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-ndisc.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-neighbor.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-network.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-nexthop.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-radv.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-route.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-route-metric.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-route-nexthop.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-routing-policy-rule.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-sysctl.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-util.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-wiphy.c:config_parse_uint16_bounded
Unexecuted instantiation: qdisc.c:config_parse_uint16_bounded
Unexecuted instantiation: tclass.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-gperf.c:config_parse_uint16_bounded
Unexecuted instantiation: networkd-network-gperf.c:config_parse_uint16_bounded
Unexecuted instantiation: netdev-gperf.c:config_parse_uint16_bounded
Unexecuted instantiation: fuzz-unit-file.c:config_parse_uint16_bounded
Unexecuted instantiation: xdg-autostart-service.c:config_parse_uint16_bounded
Unexecuted instantiation: conf-parser.c:config_parse_uint16_bounded
Unexecuted instantiation: dissect-image.c:config_parse_uint16_bounded
Unexecuted instantiation: ethtool-util.c:config_parse_uint16_bounded
Unexecuted instantiation: install.c:config_parse_uint16_bounded
Unexecuted instantiation: kernel-config.c:config_parse_uint16_bounded
Unexecuted instantiation: netif-sriov.c:config_parse_uint16_bounded
Unexecuted instantiation: resolve-util.c:config_parse_uint16_bounded
Unexecuted instantiation: sleep-config.c:config_parse_uint16_bounded
Unexecuted instantiation: udev-util.c:config_parse_uint16_bounded
Unexecuted instantiation: load-fragment-gperf.c:config_parse_uint16_bounded
Unexecuted instantiation: device.c:config_parse_uint16_bounded
Unexecuted instantiation: load-dropin.c:config_parse_uint16_bounded
Unexecuted instantiation: load-fragment.c:config_parse_uint16_bounded
470
471
static inline int config_parse_uint8_bounded(
472
                const char *unit,
473
                const char *filename,
474
                unsigned line,
475
                const char *section,
476
                unsigned section_line,
477
                const char *lvalue,
478
                const char *rvalue,
479
                uint8_t min,
480
                uint8_t max,
481
                bool ignoring,
482
1.29k
                uint8_t *ret) {
483
484
1.29k
        unsigned t;
485
1.29k
        int r;
486
487
1.29k
        r = config_parse_unsigned_bounded(
488
1.29k
                        unit, filename, line, section, section_line, lvalue, rvalue,
489
1.29k
                        min, max, ignoring,
490
1.29k
                        &t);
491
1.29k
        if (r <= 0)
492
703
                return r;
493
589
        assert(t <= UINT8_MAX);
494
589
        *ret = t;
495
589
        return 1;
496
1.29k
}
Unexecuted instantiation: link-config.c:config_parse_uint8_bounded
Unexecuted instantiation: udev-builtin-usb_id.c:config_parse_uint8_bounded
Unexecuted instantiation: udev-config.c:config_parse_uint8_bounded
Unexecuted instantiation: udev-event.c:config_parse_uint8_bounded
Unexecuted instantiation: udev-format.c:config_parse_uint8_bounded
Unexecuted instantiation: udev-manager.c:config_parse_uint8_bounded
Unexecuted instantiation: udev-rules.c:config_parse_uint8_bounded
Unexecuted instantiation: udev-watch.c:config_parse_uint8_bounded
Unexecuted instantiation: udev-worker.c:config_parse_uint8_bounded
Unexecuted instantiation: link-config-gperf.c:config_parse_uint8_bounded
Unexecuted instantiation: nspawn-network.c:config_parse_uint8_bounded
Unexecuted instantiation: nspawn-settings.c:config_parse_uint8_bounded
Unexecuted instantiation: nspawn-gperf.c:config_parse_uint8_bounded
Unexecuted instantiation: journald-config.c:config_parse_uint8_bounded
Unexecuted instantiation: journald-gperf.c:config_parse_uint8_bounded
Unexecuted instantiation: resolved-conf.c:config_parse_uint8_bounded
Unexecuted instantiation: resolved-dns-delegate.c:config_parse_uint8_bounded
Unexecuted instantiation: resolved-dnssd.c:config_parse_uint8_bounded
Unexecuted instantiation: resolved-gperf.c:config_parse_uint8_bounded
Unexecuted instantiation: resolved-dnssd-gperf.c:config_parse_uint8_bounded
Unexecuted instantiation: resolved-dns-delegate-gperf.c:config_parse_uint8_bounded
Unexecuted instantiation: bareudp.c:config_parse_uint8_bounded
Unexecuted instantiation: batadv.c:config_parse_uint8_bounded
Unexecuted instantiation: bond.c:config_parse_uint8_bounded
Unexecuted instantiation: bridge.c:config_parse_uint8_bounded
Unexecuted instantiation: fou-tunnel.c:config_parse_uint8_bounded
geneve.c:config_parse_uint8_bounded
Line
Count
Source
482
480
                uint8_t *ret) {
483
484
480
        unsigned t;
485
480
        int r;
486
487
480
        r = config_parse_unsigned_bounded(
488
480
                        unit, filename, line, section, section_line, lvalue, rvalue,
489
480
                        min, max, ignoring,
490
480
                        &t);
491
480
        if (r <= 0)
492
282
                return r;
493
198
        assert(t <= UINT8_MAX);
494
198
        *ret = t;
495
198
        return 1;
496
480
}
Unexecuted instantiation: hsr.c:config_parse_uint8_bounded
Unexecuted instantiation: ipoib.c:config_parse_uint8_bounded
Unexecuted instantiation: ipvlan.c:config_parse_uint8_bounded
Unexecuted instantiation: l2tp-tunnel.c:config_parse_uint8_bounded
Unexecuted instantiation: macsec.c:config_parse_uint8_bounded
Unexecuted instantiation: macvlan.c:config_parse_uint8_bounded
Unexecuted instantiation: netdev.c:config_parse_uint8_bounded
tunnel.c:config_parse_uint8_bounded
Line
Count
Source
482
812
                uint8_t *ret) {
483
484
812
        unsigned t;
485
812
        int r;
486
487
812
        r = config_parse_unsigned_bounded(
488
812
                        unit, filename, line, section, section_line, lvalue, rvalue,
489
812
                        min, max, ignoring,
490
812
                        &t);
491
812
        if (r <= 0)
492
421
                return r;
493
391
        assert(t <= UINT8_MAX);
494
391
        *ret = t;
495
391
        return 1;
496
812
}
Unexecuted instantiation: vxlan.c:config_parse_uint8_bounded
Unexecuted instantiation: wireguard.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-address-label.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-address.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-bridge-fdb.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-bridge-mdb.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-conf.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-dhcp-server-static-lease.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-dhcp-server.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-dhcp4.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-dhcp6.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-dns.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-ipv6ll.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-json.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-link.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-lldp-rx.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-manager.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-ndisc.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-neighbor.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-network.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-nexthop.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-radv.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-route.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-route-metric.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-route-nexthop.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-routing-policy-rule.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-sysctl.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-util.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-wiphy.c:config_parse_uint8_bounded
Unexecuted instantiation: qdisc.c:config_parse_uint8_bounded
Unexecuted instantiation: tclass.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-gperf.c:config_parse_uint8_bounded
Unexecuted instantiation: networkd-network-gperf.c:config_parse_uint8_bounded
Unexecuted instantiation: netdev-gperf.c:config_parse_uint8_bounded
Unexecuted instantiation: fuzz-unit-file.c:config_parse_uint8_bounded
Unexecuted instantiation: xdg-autostart-service.c:config_parse_uint8_bounded
Unexecuted instantiation: conf-parser.c:config_parse_uint8_bounded
Unexecuted instantiation: dissect-image.c:config_parse_uint8_bounded
Unexecuted instantiation: ethtool-util.c:config_parse_uint8_bounded
Unexecuted instantiation: install.c:config_parse_uint8_bounded
Unexecuted instantiation: kernel-config.c:config_parse_uint8_bounded
Unexecuted instantiation: netif-sriov.c:config_parse_uint8_bounded
Unexecuted instantiation: resolve-util.c:config_parse_uint8_bounded
Unexecuted instantiation: sleep-config.c:config_parse_uint8_bounded
Unexecuted instantiation: udev-util.c:config_parse_uint8_bounded
Unexecuted instantiation: load-fragment-gperf.c:config_parse_uint8_bounded
Unexecuted instantiation: device.c:config_parse_uint8_bounded
Unexecuted instantiation: load-dropin.c:config_parse_uint8_bounded
Unexecuted instantiation: load-fragment.c:config_parse_uint8_bounded