network: enable IP masquerade when address is assigned
Previously, IP masquerade is enabled when configuring the address. But, the request of assigning the address may be refused by kernel.
This commit is contained in:
@@ -454,6 +454,10 @@ static int address_update(Address *address, const Address *src) {
|
||||
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
|
||||
return 0;
|
||||
|
||||
r = address_set_masquerade(address, true);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Could not enable IP masquerading: %m");
|
||||
|
||||
link_update_operstate(link, true);
|
||||
link_check_ready(link);
|
||||
|
||||
@@ -1290,10 +1294,6 @@ int request_process_address(Request *req) {
|
||||
return r;
|
||||
}
|
||||
|
||||
r = address_set_masquerade(a, true);
|
||||
if (r < 0)
|
||||
log_link_warning_errno(link, r, "Could not enable IP masquerading, ignoring: %m");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user