1
0
mirror of https://github.com/systemd/systemd synced 2026-04-21 22:44:51 +02:00

Compare commits

..

No commits in common. "82a03e8a85967a5eb020b7cf7ca46bcc0a2fe362" and "c00e68c7bdbaa5d57a846e4947d038c926cbc3a6" have entirely different histories.

19 changed files with 39 additions and 119 deletions

2
README
View File

@ -177,7 +177,7 @@ REQUIREMENTS:
libaudit (optional)
libacl (optional)
libbpf >= 0.2.0 (optional)
libfdisk >= 2.32 (from util-linux) (optional)
libfdisk >= 2.33 (from util-linux) (optional)
libselinux (optional)
liblzma (optional)
liblz4 >= 1.3.0 / 130 (optional)

View File

@ -2626,23 +2626,6 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
<filename>/etc/localtime</filename> symlink.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>NextServer=</varname></term>
<listitem>
<para>Takes an IPv4 address. Configures the next server used by e.g. PXE boot systems.
Defaults to unset.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Filename=</varname></term>
<listitem>
<para>Takes a path or url to a file loaded by e.g. a PXE boot loader. Defaults to unset.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>SendOption=</varname></term>
<listitem>

View File

@ -1052,7 +1052,7 @@ libmount = dependency('mount',
want_libfdisk = get_option('fdisk')
if want_libfdisk != 'false' and not skip_deps
libfdisk = dependency('fdisk',
version : '>= 2.32',
version : '>= 2.33',
required : want_libfdisk == 'true')
have = libfdisk.found()
else

View File

@ -65,8 +65,6 @@ struct sd_dhcp_server {
char *timezone;
DHCPServerData servers[_SD_DHCP_LEASE_SERVER_TYPE_MAX];
struct in_addr next_server;
char *filename;
OrderedSet *extra_options;
OrderedSet *vendor_options;

View File

@ -21,7 +21,6 @@
#include "siphash24.h"
#include "string-util.h"
#include "unaligned.h"
#include "utf8.h"
#define DHCP_DEFAULT_LEASE_TIME_USEC USEC_PER_HOUR
#define DHCP_MAX_LEASE_TIME_USEC (USEC_PER_HOUR*12)
@ -163,7 +162,6 @@ static sd_dhcp_server *dhcp_server_free(sd_dhcp_server *server) {
sd_event_unref(server->event);
free(server->filename);
free(server->timezone);
for (sd_dhcp_lease_server_type_t i = 0; i < _SD_DHCP_LEASE_SERVER_TYPE_MAX; i++)
@ -272,26 +270,6 @@ sd_event *sd_dhcp_server_get_event(sd_dhcp_server *server) {
return server->event;
}
int sd_dhcp_server_set_next_server(sd_dhcp_server *server, const struct in_addr *next_server) {
assert_return(server, -EINVAL);
if (next_server)
server->next_server = *next_server;
else
server->next_server = (struct in_addr) {};
return 0;
}
int sd_dhcp_server_set_filename(sd_dhcp_server *server, const char *filename) {
assert_return(server, -EINVAL);
if (filename && !ascii_is_valid(filename))
return -EINVAL;
return free_and_strdup(&server->filename, filename);
}
int sd_dhcp_server_stop(sd_dhcp_server *server) {
bool running;
@ -561,7 +539,6 @@ static int server_send_offer_or_ack(
return r;
packet->dhcp.yiaddr = address;
packet->dhcp.siaddr = server->next_server.s_addr;
lease_time = htobe32(req->lifetime);
r = dhcp_option_append(&packet->dhcp, req->max_optlen, &offset, 0,
@ -585,22 +562,6 @@ static int server_send_offer_or_ack(
return r;
}
if (server->filename) {
/* The pxelinux magic option is marked as deprecated, but let's append it for older
* implementations. */
r = dhcp_option_append(&packet->dhcp, req->max_optlen, &offset, 0,
SD_DHCP_OPTION_PXELINUX_MAGIC, 4,
(const uint8_t[]) { 0xf1, 0x00, 0x74, 0x7e });
if (r < 0)
return r;
r = dhcp_option_append(&packet->dhcp, req->max_optlen, &offset, 0,
SD_DHCP_OPTION_CONFIGURATION_FILE,
strlen(server->filename), server->filename);
if (r < 0)
return r;
}
if (type == DHCP_ACK) {
static const uint8_t option_map[_SD_DHCP_LEASE_SERVER_TYPE_MAX] = {
[SD_DHCP_LEASE_DNS] = SD_DHCP_OPTION_DOMAIN_NAME_SERVER,

View File

@ -643,11 +643,6 @@ static int netdev_is_ready_to_create(NetDev *netdev, Link *link) {
if (link->set_link_messages > 0)
return false;
/* If stacked netdevs are created before the underlying interface being activated, then
* the activation policy for the netdevs are ignored. See issue #22593. */
if (!link->activated)
return false;
}
if (NETDEV_VTABLE(netdev)->is_ready_to_create)

View File

@ -416,14 +416,6 @@ static int dhcp4_server_configure(Link *link) {
return log_link_error_errno(link, r, "Failed to set default lease time for DHCPv4 server instance: %m");
}
r = sd_dhcp_server_set_next_server(link->dhcp_server, &link->network->dhcp_server_next_server);
if (r < 0)
return log_link_warning_errno(link, r, "Failed to set next server for DHCPv4 server instance: %m");
r = sd_dhcp_server_set_filename(link->dhcp_server, link->network->dhcp_server_filename);
if (r < 0)
return log_link_warning_errno(link, r, "Failed to set filename for DHCPv4 server instance: %m");
for (sd_dhcp_lease_server_type_t type = 0; type < _SD_DHCP_LEASE_SERVER_TYPE_MAX; type ++) {
if (!link->network->dhcp_server_emit[type].emit)

View File

@ -305,8 +305,6 @@ DHCPServer.PoolSize, config_parse_uint32,
DHCPServer.SendVendorOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_server_send_vendor_options)
DHCPServer.SendOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_server_send_options)
DHCPServer.BindToInterface, config_parse_bool, 0, offsetof(Network, dhcp_server_bind_to_interface)
DHCPServer.NextServer, config_parse_in_addr_non_null, AF_INET, offsetof(Network, dhcp_server_next_server)
DHCPServer.Filename, config_parse_string, 0, offsetof(Network, dhcp_server_filename)
DHCPServerStaticLease.Address, config_parse_dhcp_static_lease_address, 0, 0
DHCPServerStaticLease.MACAddress, config_parse_dhcp_static_lease_hwaddr, 0, 0
Bridge.Cost, config_parse_uint32, 0, offsetof(Network, cost)

View File

@ -700,7 +700,6 @@ static Network *network_free(Network *network) {
free(network->dhcp_server_relay_agent_circuit_id);
free(network->dhcp_server_relay_agent_remote_id);
free(network->dhcp_server_filename);
free(network->description);
free(network->dhcp_vendor_class_identifier);

View File

@ -200,8 +200,6 @@ struct Network {
uint32_t dhcp_server_pool_size;
OrderedHashmap *dhcp_server_send_options;
OrderedHashmap *dhcp_server_send_vendor_options;
struct in_addr dhcp_server_next_server;
char *dhcp_server_filename;
/* link local addressing support */
AddressFamily link_local;

View File

@ -97,10 +97,6 @@ enum {
SD_DHCP_OPTION_SIP_SERVER = 120,
SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE = 121,
SD_DHCP_OPTION_MUD_URL = 161,
SD_DHCP_OPTION_PXELINUX_MAGIC = 208, /* deprecated */
SD_DHCP_OPTION_CONFIGURATION_FILE = 209,
SD_DHCP_OPTION_PATH_PREFIX = 210,
SD_DHCP_OPTION_REBOOT_TIME = 211,
SD_DHCP_OPTION_6RD = 212,
SD_DHCP_OPTION_PRIVATE_BASE = 224,
/* Windows 10 option to send when Anonymize=true */

View File

@ -58,8 +58,6 @@ int sd_dhcp_server_stop(sd_dhcp_server *server);
int sd_dhcp_server_configure_pool(sd_dhcp_server *server, const struct in_addr *address, unsigned char prefixlen, uint32_t offset, uint32_t size);
int sd_dhcp_server_set_next_server(sd_dhcp_server *server, const struct in_addr *next_server);
int sd_dhcp_server_set_filename(sd_dhcp_server *server, const char *filename);
int sd_dhcp_server_set_bind_to_interface(sd_dhcp_server *server, int enabled);
int sd_dhcp_server_set_timezone(sd_dhcp_server *server, const char *timezone);
int sd_dhcp_server_set_router(sd_dhcp_server *server, const struct in_addr *address);

View File

@ -409,8 +409,6 @@ RelayAgentCircuitId=
RelayAgentRemoteId=
ServerAddress=
UplinkInterface=
NextServer=
Filename=
[DHCPServerStaticLease]
MACAddress=
Address=

View File

@ -1,7 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=test1
Name=vlan99
[Network]
Address=192.168.10.30/24

View File

@ -0,0 +1,8 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[NetDev]
Name=vlan6
Kind=vlan
MTUBytes=1500
[VLAN]
Id=6

View File

@ -0,0 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=vlan6
[Network]
IPv6AcceptRA=false
Address=100.100.100.2/24

View File

@ -609,13 +609,11 @@ class Utilities():
needle = f'{link}: Bringing link {state}'
flag = state.upper()
for iteration in range(timeout+1):
if iteration != 0:
time.sleep(1)
if not link_exists(link):
continue
output = check_output('journalctl _SYSTEMD_INVOCATION_ID=' + invocation_id)
if needle in output and flag in check_output(f'ip link show {link}'):
return True
if iteration < timeout:
time.sleep(1)
if fail_assert:
self.fail(f'Timed out waiting for {link} activated.')
return False
@ -640,14 +638,13 @@ class Utilities():
setup_state = r'\S+'
for secs in range(setup_timeout + 1):
if secs != 0:
time.sleep(1)
if not link_exists(link):
continue
output = check_output(*networkctl_cmd, '-n', '0', 'status', link, env=env)
print(output)
if re.search(rf'(?m)^\s*State:\s+{operstate}\s+\({setup_state}\)\s*$', output):
return True
# don't bother sleeping if time is up
if secs < setup_timeout:
time.sleep(1)
if fail_assert:
self.fail(f'Timed out waiting for {link} to reach state {operstate}/{setup_state}')
return False
@ -2056,7 +2053,6 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'test1',
'veth-peer',
'veth99',
'vlan99',
'vrf99',
]
@ -2064,8 +2060,6 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'11-dummy.netdev',
'12-dummy.netdev',
'12-dummy.network',
'21-vlan.netdev',
'21-vlan-test1.network',
'23-active-slave.network',
'24-keep-configuration-static.network',
'24-search-domain.network',
@ -3121,12 +3115,10 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'inet 192.168.10.30/24 brd 192.168.10.255 scope global test1')
self.wait_operstate('test1', 'routable')
def _test_activation_policy(self, test, interface):
def _test_activation_policy(self, test):
conffile = '25-activation-policy.network'
if test:
conffile = f'{conffile}.d/{test}.conf'
if interface == 'vlan99':
copy_unit_to_networkd_unit_path('21-vlan.netdev', '21-vlan-test1.network')
copy_unit_to_networkd_unit_path('11-dummy.netdev', conffile, dropins=False)
start_networkd()
@ -3136,38 +3128,36 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
next_up = not expect_up
if test.endswith('down'):
self.wait_activated(interface)
self.wait_activated('test1')
for iteration in range(4):
with self.subTest(iteration=iteration, expect_up=expect_up):
operstate = 'routable' if expect_up else 'off'
setup_state = 'configured' if expect_up else ('configuring' if iteration == 0 else None)
self.wait_operstate(interface, operstate, setup_state=setup_state, setup_timeout=20)
self.wait_operstate('test1', operstate, setup_state=setup_state, setup_timeout=20)
if expect_up:
self.assertIn('UP', check_output(f'ip link show {interface}'))
self.assertIn('192.168.10.30/24', check_output(f'ip address show {interface}'))
self.assertIn('default via 192.168.10.1', check_output(f'ip route show dev {interface}'))
self.assertIn('UP', check_output('ip link show test1'))
self.assertIn('192.168.10.30/24', check_output('ip address show test1'))
self.assertIn('default via 192.168.10.1', check_output('ip route show dev test1'))
else:
self.assertIn('DOWN', check_output(f'ip link show {interface}'))
self.assertIn('DOWN', check_output('ip link show test1'))
if next_up:
check_output(f'ip link set dev {interface} up')
check_output('ip link set dev test1 up')
else:
check_output(f'ip link set dev {interface} down')
check_output('ip link set dev test1 down')
expect_up = initial_up if always else next_up
next_up = not next_up
if always:
time.sleep(1)
def test_activation_policy(self):
for interface in ['test1', 'vlan99']:
with self.subTest(interface=interface):
for test in ['up', 'always-up', 'manual', 'always-down', 'down', '']:
with self.subTest(test=test):
self.setUp()
self._test_activation_policy(test, interface)
self.tearDown()
for test in ['up', 'always-up', 'manual', 'always-down', 'down', '']:
with self.subTest(test=test):
self.setUp()
self._test_activation_policy(test)
self.tearDown()
def _test_activation_policy_required_for_online(self, policy, required):
conffile = '25-activation-policy.network'

View File

@ -13,7 +13,7 @@ Documentation=man:systemd-nspawn(1)
Wants=modprobe@tun.service modprobe@loop.service modprobe@dm-mod.service
PartOf=machines.target
Before=machines.target
After=network.target modprobe@tun.service modprobe@loop.service modprobe@dm-mod.service
After=network.target systemd-resolved.service modprobe@tun.service modprobe@loop.service modprobe@dm-mod.service
RequiresMountsFor=/var/lib/machines/%i
[Service]

View File

@ -16,7 +16,7 @@ Documentation=https://www.freedesktop.org/wiki/Software/systemd/writing-resolver
DefaultDependencies=no
After=systemd-sysusers.service
Before=sysinit.target network.target nss-lookup.target shutdown.target
Before=network.target nss-lookup.target shutdown.target
Conflicts=shutdown.target
Wants=nss-lookup.target
@ -54,5 +54,5 @@ User=systemd-resolve
{{SERVICE_WATCHDOG}}
[Install]
WantedBy=sysinit.target
WantedBy=basic.target
Alias=dbus-org.freedesktop.resolve1.service