• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

systemd / systemd / 15263807472

26 May 2025 08:53PM UTC coverage: 72.046% (-0.002%) from 72.048%
15263807472

push

github

yuwata
src/core/manager.c: log preset activity on first boot

This gives us a little more information about what units were enabled
or disabled on that first boot and will be useful for OS developers
tracking down the source of unit state.

An example with this enabled looks like:

```
NET: Registered PF_VSOCK protocol family
systemd[1]: Applying preset policy.
systemd[1]: Unit /etc/systemd/system/dnsmasq.service is masked, ignoring.
systemd[1]: Unit /etc/systemd/system/systemd-repart.service is masked, ignoring.
systemd[1]: Removed '/etc/systemd/system/sockets.target.wants/systemd-resolved-monitor.socket'.
systemd[1]: Removed '/etc/systemd/system/sockets.target.wants/systemd-resolved-varlink.socket'.
systemd[1]: Created symlink '/etc/systemd/system/multi-user.target.wants/var-mnt-workdir.mount' → '/etc/systemd/system/var-mnt-workdir.mount'.
systemd[1]: Created symlink '/etc/systemd/system/multi-user.target.wants/var-mnt-workdir\x2dtmp.mount' → '/etc/systemd/system/var-mnt-workdir\x2dtmp.mount'.
systemd[1]: Created symlink '/etc/systemd/system/afterburn-sshkeys.target.requires/afterburn-sshkeys@core.service' → '/usr/lib/systemd/system/afterburn-sshkeys@.service'.
systemd[1]: Created symlink '/etc/systemd/system/sockets.target.wants/systemd-resolved-varlink.socket' → '/usr/lib/systemd/system/systemd-resolved-varlink.socket'.
systemd[1]: Created symlink '/etc/systemd/system/sockets.target.wants/systemd-resolved-monitor.socket' → '/usr/lib/systemd/system/systemd-resolved-monitor.socket'.
systemd[1]: Populated /etc with preset unit settings.
```

Considering it only happens on first boot and not on every boot I think
the extra information is worth the extra verbosity in the logs just for
that boot.

5 of 6 new or added lines in 1 file covered. (83.33%)

5463 existing lines in 165 files now uncovered.

299151 of 415222 relevant lines covered (72.05%)

702386.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

67.11
/src/network/netdev/macvlan.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include <linux/if_arp.h>
4

5
#include "sd-netlink.h"
6

7
#include "conf-parser.h"
8
#include "macvlan.h"
9
#include "macvlan-util.h"
10
#include "networkd-link.h"
11
#include "networkd-network.h"
12
#include "parse-util.h"
13
#include "set.h"
14
#include "string-util.h"
15

16
typedef enum BCQueueThreshold {
17
        BC_QUEUE_THRESHOLD_UNDEF   = INT32_MIN,
18
        BC_QUEUE_THRESHOLD_DISABLE = -1,
19
} BCQueueThreshold;
20

21
DEFINE_CONFIG_PARSE_ENUM(config_parse_macvlan_mode, macvlan_mode, MacVlanMode);
16✔
22

23
static int netdev_macvlan_fill_message_create(NetDev *netdev, Link *link, sd_netlink_message *req) {
12✔
24
        assert(netdev);
12✔
25
        assert(netdev->ifname);
12✔
26
        assert(link);
12✔
27
        assert(link->network);
12✔
28

29
        MacVlan *m = netdev->kind == NETDEV_KIND_MACVLAN ? MACVLAN(netdev) : MACVTAP(netdev);
12✔
30
        int r;
12✔
31

32
        if (m->mode == NETDEV_MACVLAN_MODE_SOURCE && !set_isempty(m->match_source_mac)) {
12✔
UNCOV
33
                const struct ether_addr *mac_addr;
×
34

35
                r = sd_netlink_message_append_u32(req, IFLA_MACVLAN_MACADDR_MODE, MACVLAN_MACADDR_SET);
×
36
                if (r < 0)
×
UNCOV
37
                        return r;
×
38

39
                r = sd_netlink_message_open_container(req, IFLA_MACVLAN_MACADDR_DATA);
×
UNCOV
40
                if (r < 0)
×
41
                        return r;
42

43
                SET_FOREACH(mac_addr, m->match_source_mac) {
×
44
                        r = sd_netlink_message_append_ether_addr(req, IFLA_MACVLAN_MACADDR, mac_addr);
×
45
                        if (r < 0)
×
UNCOV
46
                                return r;
×
47
                }
48

49
                r = sd_netlink_message_close_container(req);
×
UNCOV
50
                if (r < 0)
×
51
                        return r;
52
        }
53

54
        if (m->mode != _NETDEV_MACVLAN_MODE_INVALID) {
12✔
55
                r = sd_netlink_message_append_u32(req, IFLA_MACVLAN_MODE, m->mode);
12✔
56
                if (r < 0)
12✔
57
                        return r;
58
        }
59

60
        /* set the nopromisc flag if Promiscuous= of the link is explicitly set to false */
61
        if (m->mode == NETDEV_MACVLAN_MODE_PASSTHRU && link->network->promiscuous == 0) {
12✔
62
                r = sd_netlink_message_append_u16(req, IFLA_MACVLAN_FLAGS, MACVLAN_FLAG_NOPROMISC);
×
UNCOV
63
                if (r < 0)
×
64
                        return r;
65
        }
66

67
        if (m->bc_queue_length != UINT32_MAX) {
12✔
68
                r = sd_netlink_message_append_u32(req, IFLA_MACVLAN_BC_QUEUE_LEN, m->bc_queue_length);
8✔
69
                if (r < 0)
8✔
70
                        return r;
71
        }
72

73
        if (m->bc_queue_threshold != BC_QUEUE_THRESHOLD_UNDEF) {
12✔
74
                r = sd_netlink_message_append_s32(req, IFLA_MACVLAN_BC_CUTOFF, m->bc_queue_threshold);
8✔
75
                if (r < 0)
8✔
UNCOV
76
                        return r;
×
77
        }
78

79
        return 0;
80
}
81

82
int config_parse_macvlan_broadcast_queue_size(
8✔
83
                const char *unit,
84
                const char *filename,
85
                unsigned line,
86
                const char *section,
87
                unsigned section_line,
88
                const char *lvalue,
89
                int ltype,
90
                const char *rvalue,
91
                void *data,
92
                void *userdata) {
93

94
        assert(filename);
8✔
95
        assert(section);
8✔
96
        assert(lvalue);
8✔
97
        assert(rvalue);
8✔
98
        assert(data);
8✔
99

100
        MacVlan *m = ASSERT_PTR(userdata);
8✔
101

102
        if (isempty(rvalue)) {
8✔
103
                m->bc_queue_length = UINT32_MAX;
×
UNCOV
104
                return 0;
×
105
        }
106

107
        return config_parse_uint32_bounded(
8✔
108
                        unit, filename, line, section, section_line, lvalue, rvalue,
109
                        0, UINT32_MAX - 1, true,
110
                        &m->bc_queue_length);
111
}
112

113
int config_parse_macvlan_broadcast_queue_threshold(
8✔
114
                const char *unit,
115
                const char *filename,
116
                unsigned line,
117
                const char *section,
118
                unsigned section_line,
119
                const char *lvalue,
120
                int ltype,
121
                const char *rvalue,
122
                void *data,
123
                void *userdata) {
124

125
        assert(filename);
8✔
126
        assert(lvalue);
8✔
127
        assert(rvalue);
8✔
128

129
        int32_t v, *threshold = ASSERT_PTR(data);
8✔
130
        int r;
8✔
131

132
        if (isempty(rvalue)) {
8✔
133
                *threshold = BC_QUEUE_THRESHOLD_UNDEF;
×
UNCOV
134
                return 0;
×
135
        }
136

137
        if (streq(rvalue, "no")) {
8✔
138
                *threshold = BC_QUEUE_THRESHOLD_DISABLE;
×
UNCOV
139
                return 0;
×
140
        }
141

142
        r = safe_atoi32(rvalue, &v);
8✔
143
        if (r < 0) {
8✔
UNCOV
144
                log_syntax(unit, LOG_WARNING, filename, line, r,
×
145
                           "Failed to parse %s=, ignoring assignment: %s",
146
                           lvalue, rvalue);
UNCOV
147
                return 0;
×
148
        }
149
        if (v < 0) {
8✔
UNCOV
150
                log_syntax(unit, LOG_WARNING, filename, line, 0,
×
151
                           "Invalid %s= value specified, ignoring assignment: %s",
152
                           lvalue, rvalue);
UNCOV
153
                return 0;
×
154
        }
155

156
        *threshold = v;
8✔
157
        return 0;
8✔
158
}
159

160
static void macvlan_done(NetDev *netdev) {
16✔
161
        MacVlan *m = ASSERT_PTR(netdev)->kind == NETDEV_KIND_MACVLAN ? MACVLAN(netdev) : MACVTAP(netdev);
16✔
162

163
        set_free(m->match_source_mac);
16✔
164
}
16✔
165

166
static void macvlan_init(NetDev *netdev) {
16✔
167
        MacVlan *m = ASSERT_PTR(netdev)->kind == NETDEV_KIND_MACVLAN ? MACVLAN(netdev) : MACVTAP(netdev);
16✔
168

169
        m->mode = _NETDEV_MACVLAN_MODE_INVALID;
16✔
170
        m->bc_queue_length = UINT32_MAX;
16✔
171
        m->bc_queue_threshold = BC_QUEUE_THRESHOLD_UNDEF;
16✔
172
}
16✔
173

174
const NetDevVTable macvtap_vtable = {
175
        .object_size = sizeof(MacVlan),
176
        .init = macvlan_init,
177
        .done = macvlan_done,
178
        .sections = NETDEV_COMMON_SECTIONS "MACVTAP\0",
179
        .fill_message_create = netdev_macvlan_fill_message_create,
180
        .create_type = NETDEV_CREATE_STACKED,
181
        .iftype = ARPHRD_ETHER,
182
        .generate_mac = true,
183
        .keep_existing = true,
184
};
185

186
const NetDevVTable macvlan_vtable = {
187
        .object_size = sizeof(MacVlan),
188
        .init = macvlan_init,
189
        .done = macvlan_done,
190
        .sections = NETDEV_COMMON_SECTIONS "MACVLAN\0",
191
        .fill_message_create = netdev_macvlan_fill_message_create,
192
        .create_type = NETDEV_CREATE_STACKED,
193
        .iftype = ARPHRD_ETHER,
194
        .generate_mac = true,
195
        .keep_existing = true,
196
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc