mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 09:21:26 +03:00
Merge pull request #11274 from yuwata/fix-11272
network: set link state configuring before setting addresses
This commit is contained in:
commit
788291d3b4
@ -787,13 +787,16 @@ void link_check_ready(Link *link) {
|
||||
return;
|
||||
}
|
||||
|
||||
static int link_set_routing_policy_rule(Link *link) {
|
||||
static int link_request_set_routing_policy_rule(Link *link) {
|
||||
RoutingPolicyRule *rule, *rrule = NULL;
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
assert(link->network);
|
||||
|
||||
link_set_state(link, LINK_STATE_CONFIGURING);
|
||||
link->routing_policy_rules_configured = false;
|
||||
|
||||
LIST_FOREACH(rules, rule, link->network->rules) {
|
||||
r = routing_policy_rule_get(link->manager, rule->family, &rule->from, rule->from_prefixlen, &rule->to,
|
||||
rule->to_prefixlen, rule->tos, rule->fwmark, rule->table, rule->iif, rule->oif,
|
||||
@ -865,8 +868,11 @@ static int link_request_set_routes(Link *link) {
|
||||
assert(link->state != _LINK_STATE_INVALID);
|
||||
|
||||
link_set_state(link, LINK_STATE_CONFIGURING);
|
||||
link->static_routes_configured = false;
|
||||
|
||||
(void) link_set_routing_policy_rule(link);
|
||||
r = link_request_set_routing_policy_rule(link);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* First add the routes that enable us to talk to gateways, then add in the others that need a gateway. */
|
||||
for (phase = 0; phase < _PHASE_MAX; phase++)
|
||||
@ -903,6 +909,7 @@ static int link_request_set_neighbors(Link *link) {
|
||||
assert(link->state != _LINK_STATE_INVALID);
|
||||
|
||||
link_set_state(link, LINK_STATE_CONFIGURING);
|
||||
link->neighbors_configured = false;
|
||||
|
||||
LIST_FOREACH(neighbors, neighbor, link->network->neighbors) {
|
||||
r = neighbor_configure(neighbor, link, NULL);
|
||||
@ -1073,13 +1080,21 @@ static int link_request_set_addresses(Link *link) {
|
||||
assert(link->network);
|
||||
assert(link->state != _LINK_STATE_INVALID);
|
||||
|
||||
link_set_state(link, LINK_STATE_CONFIGURING);
|
||||
|
||||
/* Reset all *_configured flags we are configuring. */
|
||||
link->addresses_configured = false;
|
||||
link->neighbors_configured = false;
|
||||
link->static_routes_configured = false;
|
||||
link->routing_policy_rules_configured = false;
|
||||
|
||||
r = link_set_bridge_fdb(link);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
link_set_state(link, LINK_STATE_CONFIGURING);
|
||||
|
||||
link_request_set_neighbors(link);
|
||||
r = link_request_set_neighbors(link);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
LIST_FOREACH(addresses, ad, link->network->static_addresses) {
|
||||
r = address_configure(ad, link, address_handler, false);
|
||||
@ -1216,7 +1231,7 @@ static int link_request_set_addresses(Link *link) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log_link_debug(link, "Offering DHCPv4 leases");
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ networkd_ci_path='/run/networkd-ci'
|
||||
network_sysctl_ipv6_path='/proc/sys/net/ipv6/conf'
|
||||
network_sysctl_ipv4_path='/proc/sys/net/ipv4/conf'
|
||||
|
||||
dnsmasq_config_file='/run/networkd-ci/test-dnsmasq.conf'
|
||||
dnsmasq_pid_file='/run/networkd-ci/test-test-dnsmasq.pid'
|
||||
dnsmasq_log_file='/run/networkd-ci/test-dnsmasq-log-file'
|
||||
|
||||
@ -101,7 +100,7 @@ class Utilities():
|
||||
shutil.rmtree(os.path.join(network_unit_file_path, unit + '.d'))
|
||||
|
||||
def start_dnsmasq(self):
|
||||
subprocess.check_call('dnsmasq -8 /var/run/networkd-ci/test-dnsmasq-log-file --log-queries=extra --log-dhcp --pid-file=/var/run/networkd-ci/test-test-dnsmasq.pid --conf-file=/dev/null --interface=veth-peer --enable-ra --dhcp-range=2600::10,2600::20 --dhcp-range=192.168.5.10,192.168.5.200 -R --dhcp-leasefile=/var/run/networkd-ci/lease --dhcp-option=26,1492 --dhcp-option=option:router,192.168.5.1 --dhcp-option=33,192.168.5.4,192.168.5.5', shell=True)
|
||||
subprocess.check_call('dnsmasq -8 /var/run/networkd-ci/test-dnsmasq-log-file --log-queries=extra --log-dhcp --pid-file=/var/run/networkd-ci/test-test-dnsmasq.pid --conf-file=/dev/null --interface=veth-peer --enable-ra --dhcp-range=2600::10,2600::20 --dhcp-range=192.168.5.10,192.168.5.200 -R --dhcp-leasefile=/var/run/networkd-ci/lease --dhcp-option=26,1492 --dhcp-option=option:router,192.168.5.1 --dhcp-option=33,192.168.5.4,192.168.5.5 --port=0', shell=True)
|
||||
|
||||
time.sleep(10)
|
||||
|
||||
@ -795,7 +794,7 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
|
||||
output = subprocess.check_output(['ip', 'neigh', 'list']).rstrip().decode('utf-8')
|
||||
print(output)
|
||||
self.assertRegex(output, '192.168.10.1.*00:00:5e:00:02:65.*PERMANENT')
|
||||
self.assertRegex(output, '2004:da8:1:0::1.*00:00:5e:00:02:66.*PERMANENT')
|
||||
self.assertRegex(output, '2004:da8:1::1.*00:00:5e:00:02:66.*PERMANENT')
|
||||
|
||||
def test_sysctl(self):
|
||||
self.copy_unit_to_networkd_unit_path('25-sysctl.network', '12-dummy.netdev')
|
||||
|
Loading…
Reference in New Issue
Block a user